Mark Gradle codegen tasks as @CacheableTask - #124
Merged
Merged
Conversation
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.
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.
Code generation output is now reproducible — #44 dropped the embedded timestamps by default — so the
@DisableCachingByDefaulton 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.successmarker 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:
clean graphqlCodegenProductService --build-cache→ FROM-CACHE, rerun → UP-TO-DATEgraphqlCodegenValidate: executed → UP-TO-DATE → FROM-CACHE after clean; a broken schema correctly invalidates the cache and re-runs (and fails)validatePluginspassesCloses #45