Bake a namespace's defnz functions into precompiled native libraries
laid out as classpath resources, so a consumer loads them without a
compiler. This is the release-time counterpart to the REPL loop: it
enumerates the established functions in a namespace, re-derives each
function's build inputs, and cross-compiles it for a target matrix into
the resource tree the loader resolves from.
A build tool entry: bake! is the clj -X and tools.build function. It
loads the target namespace, which establishes each defnz for the host;
baking then re-derives and compiles each for every target.
Bake a namespace's `defnz` functions into precompiled native libraries laid out as classpath resources, so a consumer loads them without a compiler. This is the release-time counterpart to the REPL loop: it enumerates the established functions in a namespace, re-derives each function's build inputs, and cross-compiles it for a target matrix into the resource tree the loader resolves from. A build tool entry: `bake!` is the `clj -X` and tools.build function. It loads the target namespace, which establishes each `defnz` for the host; baking then re-derives and compiles each for every target.
(bake! {:keys [ns out targets] :or {out "resources" targets :all}})Compile every defnz in namespace :ns for :targets into the resource
tree under :out, returning the baked artifacts. :targets is :all
(the default matrix), :host, or a vector of {:id :triple} entries;
:out defaults to resources. The clj -X and tools.build entry:
clojure -X:bake clj-zig.bake/bake! :ns my.app/native :out '"resources"'
Loading :ns establishes its functions for the host; baking then
re-derives and compiles each for every target.
Compile every `defnz` in namespace `:ns` for `:targets` into the resource
tree under `:out`, returning the baked artifacts. `:targets` is `:all`
(the default matrix), `:host`, or a vector of `{:id :triple}` entries;
`:out` defaults to `resources`. The `clj -X` and tools.build entry:
clojure -X:bake clj-zig.bake/bake! :ns my.app/native :out '"resources"'
Loading `:ns` establishes its functions for the host; baking then
re-derives and compiles each for every target.The release target matrix: a clj-zig target id (which keys the content
hash and the resource path) paired with the Zig target triple to compile
for. The musl ids carry a libc-portable build alongside the glibc one; a
host whose resolved id is linux-<arch> selects the glibc build, so the
musl artifacts await a musl-aware target resolver.
The release target matrix: a clj-zig target id (which keys the content hash and the resource path) paired with the Zig target triple to compile for. The musl ids carry a libc-portable build alongside the glibc one; a host whose resolved id is `linux-<arch>` selects the glibc build, so the musl artifacts await a musl-aware target resolver.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |