You are reading documentation for 0.8.1. The latest release in the 0.8 line is 0.8.4.
Build-Tool Cache Review
Gradle and Maven releases add cache stores and change existing layouts. Mammoth caches a Gradle workspace directory only when it recognizes its layout, and omits other files from it. This guide is for maintainers and agents reviewing such a layout. Follow the steps in order and record the findings for each step in the pull request.
When to review
Reviews start from persisted cache data, not from release announcements:
- A user report: an issue from the “Unsupported cache layout” form, which the job summary links when a capture omits files. It contains the omitted file patterns.
- Your own job: the post-step warning “Omitted N Gradle files outside a supported workspace”, the “Omitted cache files” job-summary section, or the “Mammoth omitted cache files” log group.
- A pinned test version bump: the integration suites fail through
expectNoOmittedFiles(test/support/streaming-integration.ts) when a real build produces omitted files.
There is no CI job against the latest Gradle or Maven release. A layout matters once real builds persist it.
The reports have blind spots. Mammoth checks layouts only below the Gradle workspace surfaces:
caches/<version>/groovy-dsl/, caches/<version>/kotlin-dsl/ (apart from
classpath-snapshots/), caches/<version>/transforms/ and caches/transforms-*/. Elsewhere,
and for Maven, a new directory is either cached as ordinary files by a partition whose includes
cover it, or not cached at all, and neither case is reported. So run the inventory step below
whenever you bump the pinned Gradle or Maven test version, and when a user reports a cache that
does not help, even without omitted files.
Reading the patterns
Omitted files are grouped by partition and path pattern, with exact counts. Hash path segments
(16 or more lowercase hex characters) appear as <hash>, and other generated IDs (20 or more
letters and digits) as <id>. A pattern ends with ... one level below the first hashed
directory, so caches/9.9.3/kotlin-dsl/ic/<hash>/ic-state/... is one cache entry type. File
names stay literal, so <hash>-VC and <hash>.abi keep their suffixes. When there are more
than 256 patterns, all are shortened by one segment at a time; the counts stay exact.
Review steps
-
Inventory. Run a representative build on the new and on the previous version, each with a fresh user home. Cover Kotlin and Groovy DSL scripts, a version catalog,
buildSrcor included builds, the configuration cache, the build cache and artifact transforms; for Maven, a multi-module build with plugins. Diff the directory trees belowcaches/<version>/,caches/andwrapper/(Maven:~/.m2/) down to the first hashed level. Start from the reported patterns, and look for other new directories too. -
Sources. In the release’s sources, find the code that owns each new directory and compare it with the previous release tag. For Gradle, start from the
createCacheBuilder,createFineGrainedCacheBuilderandbaseDirForCachecalls and their cache-key constants. -
Classify each new or changed directory:
- Immutable workspace (keyed by content, verified or rebuilt by the build tool when incomplete): a complete-unit kind.
- Mutable per-entry state (keyed by path or configuration, rewritten in place, such as
Kotlin DSL
ic/): a complete-unit kind with one producer per entry, so entries from different workers never mix. - Content-addressed single files (such as
kotlin-dsl/classpath-snapshots/snapshots/): ordinary files in the owning partition. - Host-local bookkeeping (locks,
gc.properties,.internal/, journals): excludes.
-
Record for each directory you keep: what the key hashes, the required and optional files and directories of an entry, how the build tool recovers from a missing or torn entry, its cleanup mechanism, and whether concurrent writers are possible.
-
Measure what restoring it saves on a fresh user home, for unchanged and for changed inputs, and its size per entry. Caching costs upload and restore time in every job; keep a directory only when it saves more than that. Document an opt-out exclude when entries are large.
-
Implement. For a new complete-unit kind:
- a row in
GRADLE_UNIT_SURFACES(src/cache/unit-surfaces.ts): the kind, its root pattern and its required files and directories. The kind enum, root and kind recognition, unit markers and capture marker names derive from it. A new surface or ordinary child directory goes into the same table; - excludes for bookkeeping in the adapter’s partition presets
(
src/build-tool/gradle/adapter.ts); - a
layoutVersionbump of the surface, enforced bytest/cache/layout-versions.test.ts; see Maintenance. Older Mammoth versions then skip only the partitions that reach the surface, which start cold once; all other partitions keep restoring.
Ordinary files and new excludes need no new kind. Then update Gradle cache internals or Maven cache internals, cache partitions, and the changelog.
- a row in
-
Verify. Add capture tests with complete, incomplete and bookkeeping-only entries, and extend an integration suite so a real build produces the layout. The suites must pass on the new version without omitted files.