Avoid invoking Task.project at execution time in ShadowSource - #37246
Open
noojung wants to merge 1 commit into
Open
Avoid invoking Task.project at execution time in ShadowSource#37246noojung wants to merge 1 commit into
noojung wants to merge 1 commit into
Conversation
ShadowSource invoked Task.project at execution time to resolve source artifacts and perform file operations, which Gradle 10 will reject. Inject FileSystemOperations and ArchiveOperations instead of accessing Project, and replace the Configuration input with an ArtifactView-backed ConfigurableFileCollection to support the configuration cache. Also update the javapoet and objenesis dependencies in spring-core to use 'transitive = false' instead of '@jar' so that module metadata is preserved during sources variant reselection. Signed-off-by: Hyunwoo Jung <hyunwoojung@kakao.com>
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.
Currently, running the build with
--warning-mode=allreports the following deprecation warning:ShadowSourcecurrently invokesTask.projectat execution time — to run anArtifactResolutionQueryfor source artifacts, and to callProject.sync()andProject.zipTree(). Gradle deprecates this and will reject it in Gradle 10.This PR injects
FileSystemOperationsandArchiveOperationsin place ofProject, and replaces theList<Configuration>input with aConfigurableFileCollectionpopulated at configuration time from anArtifactViewthat reselects thesourcesvariant. That also removes the last task state that could not be serialized into the configuration cache.Reselecting the variant requires module metadata, so
javapoetandobjenesisin spring-core now usetransitive = falseinstead of the@jarartifact-only notation, which skips metadata entirely. The artifacts resolved for the repack jars are unchanged.However,
ArtifactView.ViewConfiguration#withVariantReselection()is still@Incubatingin Gradle 9.7.1 and has no stable equivalent.Reference: https://docs.gradle.org/9.7.1/userguide/upgrading_version_7.html#task_project