Avoid resolving unused R8 dependency#2101
Merged
Merged
Conversation
``` 1 problem was found storing the configuration cache. - Task `:server:shadowJar` of type `com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar`: error writing value of type 'org.gradle.api.internal.provider.BiProvider' See the complete report at file:///private/var/folders/2m/bd7g5fjj4b35fqvp1msqsk740000gn/T/junit-881383515820473092/build/reports/configuration-cache/5zeq7sysso34nq7c1l5z638p6/9iveovp987svtkmp66pbpo78m/configuration-cache-report.html [Incubating] Problems report is available at: file:///private/var/folders/2m/bd7g5fjj4b35fqvp1msqsk740000gn/T/junit-881383515820473092/build/reports/problems/problems-report.html FAILURE: Build failed with an exception. * What went wrong: Configuration cache state could not be cached: field `provider` of `org.gradle.internal.serialize.codecs.core.ProviderBackedFileCollectionSpec` bean found in field `r8Classpath` of task `:server:shadowJar` of type `com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar`: error writing value of type 'org.gradle.api.internal.provider.BiProvider' > Cannot mutate the state of configuration ':server:shadowR8' after the configuration was resolved. After a configuration has been observed, it should not be modified. ``` This reverts commit d8d19b8.
This reverts commit 1ee2537.
…60714/fix-issue-2099 # Conflicts: # src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/JavaPluginsTest.kt # src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.kt
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #2099 by preventing the shadowR8 dependency from being resolved during “lock all configurations” workflows unless R8 minimization is actually enabled, avoiding resolution failures in environments without Google’s Maven repository.
Changes:
- Make the
shadowR8configuration non-resolvable by default to avoid incidental resolution during dependency locking. - Lazily re-enable resolution of
shadowR8only whenShadowJaris configured to use R8 minimization. - Add a functional test covering dependency locking with
lockAllConfigurations(), and update the Unreleased changelog.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.kt | Lazily marks shadowR8 resolvable only when R8 minimization is enabled. |
| src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowBasePlugin.kt | Registers shadowR8 as non-resolvable by default to avoid unwanted resolution. |
| src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/JavaPluginsTest.kt | Adds regression test ensuring R8 is not resolved/locked when locking all configurations. |
| docs/changes/README.md | Documents the fix in the Unreleased “Fixed” section. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
abd0d63 to
969fe5f
Compare
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.
Closes #2099.