Conversation
PrepareTask held a ProjectEnv - and with it a live Project - as task
state. Any task holding a Project reference is incompatible with the
Gradle Configuration Cache, and an incompatible task discards the
cache entry for the whole build on every run, not just for itself.
So any project applying this plugin could never benefit from the
Configuration Cache, even though nothing else in the build was
incompatible.
Fix: PrepareTask now only holds plain values and Provider/Property
instances set via project.provider { } for values (AGP version,
application id, project dir path) that are only reliable once the
project has finished evaluating. GradleBuildTracker and
ObjectBoxGradlePlugin.createPrepareTask are updated accordingly, and
the now-unused ProjectEnv-based androidAppId() helper is removed.
Adds assembleWithConfigurationCache() regression test: runs
assembleDebug twice with --configuration-cache and asserts the first
run stores a clean cache entry and the second run reuses it.
Fixes objectbox/objectbox-java#948
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.
PrepareTaskheld aProjectEnv— and with it a liveProject— as taskstate. Any task holding a
Projectreference is incompatible with theGradle Configuration Cache, and an incompatible task discards the cache
entry for the whole build on every run, not just for itself. So any
project applying this plugin could never benefit from the Configuration
Cache, even though nothing else in the build was incompatible.
Fixes objectbox/objectbox-java#948
Fix
PrepareTasknow only holds plain values andProvider/Propertyinstances set via
project.provider { }for values (AGP version,application id, project dir path) that are only reliable once the
project has finished evaluating.
GradleBuildTrackerandObjectBoxGradlePlugin.createPrepareTaskare updated accordingly, andthe now-unused
ProjectEnv-basedandroidAppId()helper is removed.Testing
Added
assembleWithConfigurationCache(): runsassembleDebugtwice with--configuration-cacheand asserts the first run stores a clean cacheentry (no "problem was found storing the configuration cache") and the
second run reuses it ("Reusing configuration cache.").
Ran the full
:objectbox-gradle-plugin:testsuite locally; all failuresare pre-existing and environmental (GitLab-authenticated test repository
not reachable outside ObjectBox's own CI — confirmed unrelated to this
change, same failure mode on
main).