Problem
CreateModuleGraphTask declares projectDirectory as @get:OutputDirectory, and the plugin sets it to the root project directory:
This tells Gradle the task owns the entire project tree as an output. Every other task's outputs (all build/ directories) then sit inside createModuleGraph's declared output, so Gradle's dependency validation fails the build whenever createModuleGraph runs in the same invocation as any other task:
Some problems were found with the configuration of task ':shared:fitify:plans:testAndroidHostTest' (type 'AndroidUnitTest').
Property has implicit dependency
Gradle detected a problem with the following location: '<repo>/shared/fitify/plans/build/classes/kotlin/android/hostTest'
Task ':shared:fitify:plans:testAndroidHostTest' uses this output of task ':createModuleGraph' without declaring an
explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the
tasks are executed
One such failure is reported per overlapping output location, which on a large project means hundreds of them.
Reproduction
On any multi-module project applying the plugin:
./gradlew test createModuleGraph
Fails with the validation errors above. Running createModuleGraph on its own works.
Root cause
The task only uses projectDirectory to resolve the relative readmePath of each graph config (CreateModuleGraphTask.kt#L154-L155). It is a base directory for path resolution, not an output. The task's real outputs are the readme files it writes.
Suggested fix
Mark projectDirectory as @get:Internal and declare the actual outputs instead, e.g. an @OutputFiles provider that maps each graph config's readmePath resolved against projectDirectory. That keeps up-to-date checks and configuration-cache support while removing the overlap with every other task's outputs.
Workaround
Run createModuleGraph in its own Gradle invocation, separate from other tasks.
Environment
- module-graph 0.13.0
- Gradle 9.6.1
Problem
CreateModuleGraphTaskdeclaresprojectDirectoryas@get:OutputDirectory, and the plugin sets it to the root project directory:CreateModuleGraphTask.kt#L127-L129ModuleGraphPlugin.kt#L43This tells Gradle the task owns the entire project tree as an output. Every other task's outputs (all
build/directories) then sit insidecreateModuleGraph's declared output, so Gradle's dependency validation fails the build whenevercreateModuleGraphruns in the same invocation as any other task:One such failure is reported per overlapping output location, which on a large project means hundreds of them.
Reproduction
On any multi-module project applying the plugin:
Fails with the validation errors above. Running
createModuleGraphon its own works.Root cause
The task only uses
projectDirectoryto resolve the relativereadmePathof each graph config (CreateModuleGraphTask.kt#L154-L155). It is a base directory for path resolution, not an output. The task's real outputs are the readme files it writes.Suggested fix
Mark
projectDirectoryas@get:Internaland declare the actual outputs instead, e.g. an@OutputFilesprovider that maps each graph config'sreadmePathresolved againstprojectDirectory. That keeps up-to-date checks and configuration-cache support while removing the overlap with every other task's outputs.Workaround
Run
createModuleGraphin its own Gradle invocation, separate from other tasks.Environment