Skip to content

Do not cache generateLicenseReport tasks - #739

Merged
alexander-yevsyukov merged 2 commits into
masterfrom
do-not-cache-license-report-tasks
Aug 4, 2026
Merged

Do not cache generateLicenseReport tasks#739
alexander-yevsyukov merged 2 commits into
masterfrom
do-not-cache-license-report-tasks

Conversation

@alexander-yevsyukov

Copy link
Copy Markdown
Contributor

What

Opts the per-project generateLicenseReport task out of the Gradle build cache
via outputs.doNotCacheIf().

Why

Gradle Doctor flags every one of these tasks as
slower from cache.
From a build of core-jvm-compiler:

| The following operations were slower to pull from the cache than to rerun:  |
| :routing-tests:generateLicenseReport                                        |
| :grpc:generateLicenseReport                                                 |
| :message-group:generateLicenseReport                                        |
| ... (16 tasks in total)                                                     |
| Consider disabling caching them.                                            |

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

  • Up-to-date checks are unaffected. doNotCacheIf suppresses only
    build-cache store/load, not incremental skipping, so an unchanged project
    still skips the task entirely.
  • The neighbouring comment about the projectVersion input was reworded: it
    previously 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.
  • doNotCacheIf was chosen over cacheIf { false } because the task is already
    annotated @CacheableTask by the jk1 plugin, so this is an opt-out. The
    reason string surfaces in --info output and build scans.
  • JS projects are covered too. io.spine.gradle.javascript.task.licenseReport()
    configures the same task instance (adding npmLicenseReport as a finalizer)
    rather than registering its own, so it inherits the opt-out.

Testing

./gradlew -p buildSrc build passes, including DependencyReportOutputTest.
The config root has no build lifecycle task, so buildSrc is the
compilation unit here.

🤖 Generated with Claude Code

alexander-yevsyukov and others added 2 commits August 4, 2026 14:01
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 generateLicenseReport via outputs.doNotCacheIf(...).
  • Reworded the projectVersion input comment to focus on up-to-date behavior rather than cache restore.
  • Minor refactor to use imported Paths.relativePath / Paths.outputFilename constants.

@alexander-yevsyukov alexander-yevsyukov moved this from 🏗 In progress to In Review in v2.0 Aug 4, 2026
@alexander-yevsyukov
alexander-yevsyukov merged commit 620e4ca into master Aug 4, 2026
4 checks passed
@alexander-yevsyukov
alexander-yevsyukov deleted the do-not-cache-license-report-tasks branch August 4, 2026 14:41
@github-project-automation github-project-automation Bot moved this from In Review to ✅ Done in v2.0 Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

3 participants