Skip to content

Commit b67a29a

Browse files
committed
all: Copy mustRunAfter from each project's JacocoTestReport
While JacocoReportBase.getExecutionData() is properly annotated with `@InputFiles` and is a FileCollection, which can propagate dependencies, the JacocoPlugin's configuration of the task [goes through a File][barefile], which doesn't propagate task dependency information. This is overcome in the plugin by mustRunAfter. This may have been on purpose to allow jacocoTestReport to report on the subset of tests already run, but is atypical these days. Because of that, we need to copy the mustRunAfter from the other JacocoTestReports. The dependsOn weren't doing anything because there were no dependsOn; that configuration is quite old so it's hard to say when they stopped functioning. This fixes warnings like: ``` - Gradle detected a problem with the following location: 'grpc-java/core/build/jacoco/test.exec'. Reason: Task ':grpc-all:jacocoTestReport' uses this output of task ':grpc-core:test' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.6/userguide/validation_problems.html#implicit_dependency for more details about this problem. - Gradle detected a problem with the following location: 'grpc-java/testing/build/resources/main'. Reason: Task ':grpc-all:jacocoTestReport' uses this output of task ':grpc-testing:processResources' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.6/userguide/validation_problems.html#implicit_dependency for more details about this problem. ``` I was able to trigger the warnings by: ``` ./gradlew clean ./gradlew :grpc-core:test ./gradlew :grpc-all:jacocoTestReport ./gradlew :grpc-core:test :grpc-all:jacocoTestReport ``` [barefile]: https://github.com/gradle/gradle/blob/bc4029063cb607d90bd798be37f578957cf67746/subprojects/jacoco/src/main/java/org/gradle/testing/jacoco/tasks/JacocoReportBase.java#L162-L168
1 parent a589eac commit b67a29a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

all/build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,10 @@ tasks.named("javadoc").configure {
5252
}
5353

5454
tasks.named("jacocoTestReport").configure {
55-
dependsOn(subprojects.jacocoTestReport.dependsOn)
56-
dependsOn(project(':grpc-interop-testing').jacocoTestReport.dependsOn)
55+
mustRunAfter(subprojects.jacocoTestReport.mustRunAfter)
56+
mustRunAfter(project(':grpc-interop-testing').jacocoTestReport.mustRunAfter)
5757
executionData.from files(subprojects.jacocoTestReport.executionData)
5858
.plus(project(':grpc-interop-testing').jacocoTestReport.executionData)
59-
.filter { f -> f.exists() }
6059
reports {
6160
xml.required = true
6261
html.required = true

0 commit comments

Comments
 (0)