Liking cljdoc? Tell your friends :D

clj-zig.cache

Content-address generated artifacts. The hash of the normalized spec, body, dependencies, options, Zig version, and target becomes the artifact path, so an unchanged form reuses its library and a changed form gets a fresh one. The JVM never reloads a stale library.

.clj-zig/cache/macos-aarch64/app.core/add-83a1c0f9e1b2/
  source.zig
  libadd-83a1c0f9e1b2.dylib
  manifest.edn

cache-key and artifact-paths are pure; resolving the toolchain version and target, and reading and writing the filesystem, are the shell.

Content-address generated artifacts. The hash of the
normalized spec, body, dependencies, options, Zig version, and target
becomes the artifact path, so an unchanged form reuses its library and
a changed form gets a fresh one. The JVM never reloads a stale library.

    .clj-zig/cache/macos-aarch64/app.core/add-83a1c0f9e1b2/
      source.zig
      libadd-83a1c0f9e1b2.dylib
      manifest.edn

`cache-key` and `artifact-paths` are pure; resolving the toolchain
version and target, and reading and writing the filesystem, are the
shell.
raw docstring

artifact-pathsclj

(artifact-paths {:keys [root target ns name hash]})

The artifact directory and file paths for a build, under root (default .clj-zig/cache).

The artifact directory and file paths for a build, under `root`
(default `.clj-zig/cache`).
sourceraw docstring

bundled-resource-pathclj

(bundled-resource-path {:keys [target ns name hash]})

The classpath resource path for a baked library, mirroring the cache layout under the resource root. The library's content hash is in the path, so a resource matches a function's hash for a target or it does not.

The classpath resource path for a baked library, mirroring the cache
layout under the resource root. The library's content hash is in the
path, so a resource matches a function's hash for a target or it does
not.
sourceraw docstring

cache-keyclj

(cache-key {:keys [spec body source deps options zig-version target aux-files
                   modules]})

The content hash for these build inputs. The generated source enters the hash directly, so a change to the source generator yields a new key even when the spec and body are unchanged; the spec, body, dependencies, options, Zig version, and target enter it as well. A body that imports other Zig files adds their contents under :aux, so editing an imported file recompiles; a body with no imports hashes exactly as before. External Zig modules enter as :modules, a name-to-fingerprint map, so a changed module relinks its dependents while leaving every other key untouched.

The content hash for these build inputs. The generated `source` enters
the hash directly, so a change to the source generator yields a new key
even when the spec and body are unchanged; the spec, body, dependencies,
options, Zig version, and target enter it as well. A body that imports
other Zig files adds their contents under `:aux`, so editing an imported
file recompiles; a body with no imports hashes exactly as before. External
Zig modules enter as `:modules`, a name-to-fingerprint map, so a changed
module relinks its dependents while leaving every other key untouched.
sourceraw docstring

clean!clj

(clean!)
(clean! root)

Remove the entire artifact cache under root (default .clj-zig/cache).

Remove the entire artifact cache under `root` (default `.clj-zig/cache`).
sourceraw docstring

content-fingerprintclj

(content-fingerprint contents)

The twelve-char content fingerprint of a module's file closure: each file's path paired with the hash of its contents. Order-independent, so it depends only on the set of files and their contents. contents is a seq of {:path :content} read by the shell.

The twelve-char content fingerprint of a module's file closure: each
file's path paired with the hash of its contents. Order-independent, so it
depends only on the set of files and their contents. `contents` is a seq
of `{:path :content}` read by the shell.
sourceraw docstring

dir-signatureclj

(dir-signature stats)

A cheap, order-independent signature over a module's file closure, keyed on each file's path, size, and mtime, no contents read. An untouched tree yields the same signature; a changed size or mtime flips it. stats is a seq of {:path :size :mtime} gathered by the shell.

A cheap, order-independent signature over a module's file closure, keyed
on each file's path, size, and mtime, no contents read. An untouched tree
yields the same signature; a changed size or mtime flips it. `stats` is a
seq of `{:path :size :mtime}` gathered by the shell.
sourceraw docstring

ensure-library!clj

(ensure-library! {:keys [spec source root aux-files module-roots] :as inputs}
                 compile!-fn)

Return the cached artifact paths for these inputs, resolving a library in three steps: a present filesystem artifact, then a baked library on the classpath, then a fresh compile through compile!-fn. A baked library is extracted into the cache and loaded without invoking Zig. Identical inputs reuse a resolved library; any change resolves a fresh path. inputs carries :spec, :body, :source, :deps, :options, :zig-version, :target, and an optional :root.

Return the cached artifact paths for these `inputs`, resolving a library
in three steps: a present filesystem artifact, then a baked library on
the classpath, then a fresh compile through `compile!-fn`. A baked
library is extracted into the cache and loaded without invoking Zig.
Identical inputs reuse a resolved library; any change resolves a fresh
path. `inputs` carries `:spec`, `:body`, `:source`, `:deps`, `:options`,
`:zig-version`, `:target`, and an optional `:root`.
sourceraw docstring

evict!clj

(evict! {:keys [spec root] :as inputs})

Remove the single cached artifact for these inputs, so the next build recompiles instead of reusing it. Inputs match ensure-library!.

Remove the single cached artifact for these `inputs`, so the next build
recompiles instead of reusing it. Inputs match `ensure-library!`.
sourceraw docstring

fs-ioclj

The filesystem reader module-fingerprint uses outside tests: :stat gathers a closure's stat entries for the signature, :read its contents for the fingerprint.

The filesystem reader `module-fingerprint` uses outside tests: `:stat`
gathers a closure's stat entries for the signature, `:read` its contents
for the fingerprint.
sourceraw docstring

library-present?clj

(library-present? paths)

True when a usable library exists. A zero-byte file (left by a failed build) does not count, so a poisoned path recompiles instead of loading an invalid library.

True when a usable library exists. A zero-byte file (left by a failed
build) does not count, so a poisoned path recompiles instead of loading
an invalid library.
sourceraw docstring

memoized-fingerprintclj

(memoized-fingerprint entry signature compute)

Resolve a module's fingerprint against a prior memo entry ({:signature :fingerprint}, or nil when none) and the current signature. Returns [fingerprint next-entry]. When the signature matches the memo, the fingerprint is reused and compute is never called; otherwise compute produces a fresh fingerprint that the returned entry records. Pure; the atom that carries the entry across calls is the shell.

Resolve a module's fingerprint against a prior memo `entry` (`{:signature
:fingerprint}`, or nil when none) and the current `signature`. Returns
`[fingerprint next-entry]`. When the signature matches the memo, the
fingerprint is reused and `compute` is never called; otherwise `compute`
produces a fresh fingerprint that the returned entry records. Pure; the
atom that carries the entry across calls is the shell.
sourceraw docstring

module-fingerprintclj

(module-fingerprint ref {:keys [stat read]})

The twelve-char fingerprint for one external module reference, the single value it contributes to a dependent function's content hash (ADR 34). A pinned :git/sha ref fingerprints from the sha and root, with no filesystem read; a dev :path ref fingerprints its file closure, memoized behind the cheap dir-signature so an unchanged tree reuses the fingerprint without rereading contents. fs-io supplies :stat and :read over the closure; tests inject fakes.

The twelve-char fingerprint for one external module reference, the single
value it contributes to a dependent function's content hash (ADR 34). A
pinned `:git/sha` ref fingerprints from the sha and root, with no
filesystem read; a dev `:path` ref fingerprints its file closure, memoized
behind the cheap `dir-signature` so an unchanged tree reuses the
fingerprint without rereading contents. `fs-io` supplies `:stat` and
`:read` over the closure; tests inject fakes.
sourceraw docstring

module-rootsclj

(module-roots modules)

Each resolvable external module's root source path, keyed by import name, for the compile shell to pass as -M<name>=<root>; nil when none resolve. A pinned reference with no local checkout is omitted (ADR 36). The path counterpart to modules-fingerprint, which feeds the content hash.

Each resolvable external module's root source path, keyed by import name,
for the compile shell to pass as `-M<name>=<root>`; nil when none resolve. A
pinned reference with no local checkout is omitted (ADR 36). The path
counterpart to `modules-fingerprint`, which feeds the content hash.
sourceraw docstring

modules-fingerprintclj

(modules-fingerprint modules)
(modules-fingerprint modules io)

The fingerprint of each external module in a name -> ref map, keyed by import name, for the content hash; nil when there are none. Two wrappers over the same module share a fingerprint, so the cache stays content-addressed.

The fingerprint of each external module in a `name -> ref` map, keyed by
import name, for the content hash; nil when there are none. Two wrappers
over the same module share a fingerprint, so the cache stays
content-addressed.
sourceraw docstring

read-manifestclj

(read-manifest paths)

Read the manifest for a built artifact, or nil when none exists.

Read the manifest for a built artifact, or nil when none exists.
sourceraw docstring

target-tripleclj

(target-triple)

The development target as <os>-<arch>, part of the cache key and the artifact path.

The development target as `<os>-<arch>`, part of the cache key and the
artifact path.
sourceraw docstring

write-manifest!clj

(write-manifest! paths
                 {:keys [spec deps options zig-version target]}
                 artifact-key)

Write the human-readable manifest describing a built artifact.

Write the human-readable manifest describing a built artifact.
sourceraw docstring

zig-versionclj

(zig-version)

The zig compiler version string, part of the cache key.

The `zig` compiler version string, part of the cache key.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close