Do not cache generateLicenseReport tasks - #739
Merged
Merged
Conversation
Gradle Doctor reports every per-project `generateLicenseReport` task as "slower from cache": the task only re-renders already resolved dependency metadata into a small Markdown file, so recomputing it costs less than hashing inputs, looking the entry up, and unpacking it. Opt the task out of the build cache via `outputs.doNotCacheIf()`. Up-to-date checks are unaffected, so an unchanged project still skips the task. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The paragraph establishes a singular subject ("The task"), so "these tasks"
had no plural antecedent. "Such tasks" refers to the kind of task instead.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR opts the per-project generateLicenseReport task out of Gradle’s build cache to avoid cache overhead for a task that is cheaper to rerun than to restore, while preserving up-to-date behavior via explicit task inputs.
Changes:
- Disabled build-cache store/load for
generateLicenseReportviaoutputs.doNotCacheIf(...). - Reworded the
projectVersioninput comment to focus on up-to-date behavior rather than cache restore. - Minor refactor to use imported
Paths.relativePath/Paths.outputFilenameconstants.
armiol
approved these changes
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Opts the per-project
generateLicenseReporttask out of the Gradle build cachevia
outputs.doNotCacheIf().Why
Gradle Doctor flags every one of these tasks as
slower from cache.
From a build of
core-jvm-compiler:The task only re-renders already resolved dependency metadata into a small
Markdown file. That costs less than hashing the inputs, looking the entry up,
and unpacking it — so the cache is a net loss here.
Notes for the reviewer
doNotCacheIfsuppresses onlybuild-cache store/load, not incremental skipping, so an unchanged project
still skips the task entirely.
projectVersioninput was reworded: itpreviously argued in terms of "restorable from the build cache", which is no
longer the failure mode. The input itself stays — it still drives the
up-to-date check.
doNotCacheIfwas chosen overcacheIf { false }because the task is alreadyannotated
@CacheableTaskby thejk1plugin, so this is an opt-out. Thereason string surfaces in
--infooutput and build scans.io.spine.gradle.javascript.task.licenseReport()configures the same task instance (adding
npmLicenseReportas a finalizer)rather than registering its own, so it inherits the opt-out.
Testing
./gradlew -p buildSrc buildpasses, includingDependencyReportOutputTest.The
configroot has nobuildlifecycle task, sobuildSrcis thecompilation unit here.
🤖 Generated with Claude Code