Skip to content

Mark Gradle codegen tasks as @CacheableTask - #124

Merged
Besi97 merged 2 commits into
mainfrom
feat/cacheable-gradle-tasks
Sep 2, 2026
Merged

Besi97 merged 2 commits into
mainfrom
feat/cacheable-gradle-tasks

Conversation

@Besi97

@Besi97 Besi97 commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Code generation output is now reproducible — #44 dropped the embedded timestamps by default — so the @DisableCachingByDefault on the codegen task no longer applies.

The validate task is less obvious: Gradle silently refuses to cache tasks that declare no outputs ("Caching disabled ... No outputs declared"), so swapping the annotation there alone would do nothing. It now writes a validation.success marker file under the build directory, which makes it genuinely cacheable and also lets repeated builds skip validation as UP-TO-DATE.

Verified against a locally published plugin snapshot:

  • example-client: clean graphqlCodegenProductService --build-cache → FROM-CACHE, rerun → UP-TO-DATE
  • scratch consumer project with graphqlCodegenValidate: executed → UP-TO-DATE → FROM-CACHE after clean; a broken schema correctly invalidates the cache and re-runs (and fails)
  • validatePlugins passes

Closes #45

Generated sources no longer embed timestamps (#44) and iteration order is
deterministic (#42), so the codegen task output can be safely reused via
the build cache.

The validate task gets a marker file output under the build directory:
Gradle silently skips caching for tasks without declared outputs, so the
annotation alone would have been a no-op there. The marker also makes
repeated validations UP-TO-DATE instead of always re-running.

Closes #45
reviewdog only annotates added lines, and the whole file counts as added,
so its pre-existing-style import block and <p> javadoc placement now have
to follow config/checkstyle/graphql-codegen-check-style.xml.
@Besi97
Besi97 merged commit 6cf4bb8 into main Sep 2, 2026
4 checks passed
@Besi97
Besi97 deleted the feat/cacheable-gradle-tasks branch September 2, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mark Gradle codegen tasks as @CacheableTask

1 participant