Open danielcompton opened 5 years ago
don't know if this would help the compilation.
(duct/load-hierarchy)
(def config
(-> (duct/resource "config.edn")
(duct/read-config)
(duct/prep-config [:duct.profile/dev
:duct.profile/local
:duct.profile/prod])))
(defn -main
[& args]
(let [keys (or (duct/parse-keys args) [:duct/daemon])
profiles [:duct.profile/prod]]
(-> config
(duct/exec-config profiles keys))))
I'm trying to build an AOT'd uberjar using the Duct Leiningen template. I can use the template to build an uberjar, but it doesn't look like Duct modules and components are AOT compiled.
If I add an explicit
:require
forduct.database.sql.hikaricp
in thefoobar.main
ns
form, then theduct.database.sql
andduct.database.sql.hikaricp
namespaces are AOT compiled in the uberjar.I'm guessing that this is happening because the Clojure compiler isn't able to tell at AOT compile time that those modules are needed.
This also causes issues when compiling with
native-image
, as the SubstrateVM compiler can't tell (without extra config) that some namespaces are going to be required at runtime based on info in theconfig.edn
file.A workaround is to add explicit requires on all namespaces which are dynamically required by Duct or add them manually in the
project.clj
, but this loses some of the benefits of Duct. Is there another way to get all of a Duct application automatically AOT compiled?