google / google/protobuf-gradle-plugin
'explodeCodeSourceDebug' uses this output of task 'generateDebugProto' without declaring an explicit or implicit dependency after Gradle update to 8.0.2
- Dominant language
- Groovy
- Stars
- 1.8k
- Forks
- 288
- PR merge metrics
- No merged PRs in 30d
Description
We're experiencing the following error after updating gradle from `7.6.1` -> `8.0.2`
```
A problem was found with the configuration of task ':my-library:generateDebugProto' (type 'GenerateProtoTask').
- Gradle detected a problem with the following location: '/path/to/MyProject/my-library/build/generated/source/proto/debug'.
Reason: Task ':my-library:explodeCodeSourceDebug' uses this output of task ':my-library:generateDebugProto' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Possible solutions:
1. Declare task ':my-library:generateDebugProto' as an input of ':my-library:explodeCodeSourceDebug'.
2. Declare an explicit dependency on ':my-library:generateDebugProto' from ':my-library:explodeCodeSourceDebug' using Task#dependsOn.
3. Declare an explicit dependency on ':my-library:generateDebugProto' from ':my-library:explodeCodeSourceDebug' using Task#mustRunAfter.
Please refer to https://docs.gradle.org/8.0.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.
```
This appears like a misconfiguration at the plugin level, but not entirely sure.
We've added a workaround by adding the following to the affected module:
```groovy
afterEvaluate {
tasks.forEach {task ->
if (task.name.contains("explodeCodeSourceDebug")) {
task.dependsOn("generateDebugProto")
}
if (task.name.contains("explodeCodeSourceRelease")) {
task.dependsOn("generateReleaseProto")
}
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.