Skip to content

Declare classpath as @Classpath input using ConfigurableFileCollection#439

Open
timtebeek wants to merge 3 commits intomainfrom
tim/fix-gradle-plugin-387
Open

Declare classpath as @Classpath input using ConfigurableFileCollection#439
timtebeek wants to merge 3 commits intomainfrom
tim/fix-gradle-plugin-387

Conversation

@timtebeek
Copy link
Copy Markdown
Member

@timtebeek timtebeek commented Apr 12, 2026

Summary

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.

  • Replace Provider<Set<File>> resolvedDependencies with a ConfigurableFileCollection annotated with @Classpath, wired via .from(detachedConf) using a Callable for lazy creation. This gives Gradle full provenance of the rewrite recipe jars.
  • Add a separate projectClasspath @Classpath input, 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 pass
  • End-to-end validation on three projects: single-module, multi-module, and custom rewrite configuration dependency

…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.
@timtebeek timtebeek marked this pull request as ready for review April 12, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

classPath not declared as required input

1 participant