Declare classpath as @Classpath input using ConfigurableFileCollection#439
Open
Declare classpath as @Classpath input using ConfigurableFileCollection#439
Conversation
…leCollection Fixes #387. The rewrite task classpath was not declared as a Gradle task input, causing Gradle to lack dependency provenance information. Replace Provider<Set<File>> with an abstract ConfigurableFileCollection annotated with @classpath, and wire it via .from(detachedConf) so Gradle can track the full dependency graph.
Managed properties (abstract getters) require Gradle 5.1+, so older versions fail with "Cannot create a proxy class for abstract class". Initialize the ConfigurableFileCollection via getProject().files() in the constructor instead, keeping @classpath semantics while supporting the full Gradle version matrix.
Add a separate projectClasspath @classpath input to rewrite tasks, wired from each source set's compile and runtime classpaths. This lets Gradle infer that dependent project jars (e.g. test-support.jar) must be built before rewrite tasks run, fixing the "File does not exist" error when plugins like extra-java-module-info perform early dependency resolution.
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.
Summary
classPathnot declared as required input #387.The rewrite tasks accessed classpaths without declaring them as Gradle task inputs, so Gradle could not infer task dependencies. This caused "File does not exist" errors when other plugins (e.g.
extra-java-module-info) produced jars that needed to be built first.Provider<Set<File>> resolvedDependencieswith aConfigurableFileCollectionannotated with@Classpath, wired via.from(detachedConf)using aCallablefor lazy creation. This gives Gradle full provenance of the rewrite recipe jars.projectClasspath@Classpathinput, wired from each source set's compile and runtime classpaths. This lets Gradle infer that dependent project jars (e.g.test-support.jar) must be built before rewrite tasks run.Test plan
./gradlew :plugin:test— all tests passrewriteconfiguration dependency