KuiltVersion
The version of the kuilt that is running.
It is the same string the build publishes the artifact under: <line>.0-dev from a local build, <line>.0-dev.<run> from a snapshot, and the tag's x.y.z from a release.
It lives in :kuilt-base, which depends on nothing. No other kuilt module brings it with them, so declare us.tractat.kuilt:kuilt-base to read it; under the BOM it needs no version. The value is the version of :kuilt-base; import the BOM to keep every kuilt module at that version.
It is deliberately a plain val, not a const, for two reasons. A const is copied into the code that reads it when that code compiles, so it would name the kuilt a consumer compiled against rather than the one actually running. And a const puts its value in the classpath snapshot every dependent's JVM compile is keyed on, so every snapshot run, whose version carries its run number, would recompile every module built against it. The generated value underneath is a function for the same reason (#3464).
Samples
// Save the version beside the bytes it describes.
val snapshotHeader = mapOf("writtenBy" to KuiltVersion.VERSION)
// A later run compares it with the kuilt it is running now.
val writtenByThisKuilt = snapshotHeader["writtenBy"] == KuiltVersion.VERSION
check(writtenByThisKuilt)