Liking cljdoc? Tell your friends :D

Compiling for Production and Development

Systems will usually require the namespaces they need. In the case of Integrant, the AOT list will be very dynamic and ergo hard to setup AOT for. Systems may provide a load-system function which will require any namespaces needed by the system to start.

When compiling, ensure that classes exists and is on the classpath. See the clojure.org guide on aot for more information about AOT.

Wedge’s compile main

$ clj -M -m io.dominic.wedge.compile

A common way to AOT for dev (as from the Improving Development Startup Time guide) would be to include the dev alias and also any dev settings:

$ clj -M:dev -m io.dominic.wedge.compile :profile :dev

As normal, you can control the compiler options by setting Java system properties:

$ clj -J-Dclojure.compiler.direct-linking=true -M -m io.dominic.wedge.compile

Compiling via API, advanced usage

You may want to compile as part of your own build process. To do this, you can use load-system directly, like so:

;; Compile before requiring, so it's been AOT'd
(compile 'io.dominic.wedge.system)
(require '[io.dominic.wedge.system :as wedge.system])

(def opts {:profile :prod})

(binding [*compile-files* true]
  (-> (wedge.system/read-config opts)
      (wedge.system/system-desc opts)
      (wedge.system/load-system opts)))

Can you improve this documentation?Edit on sourcehut

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close