@@ -145,9 +145,9 @@ subprojects {
145
145
}
146
146
}
147
147
148
- val jacocoRootReport = tasks.register(" jacocoRootReport" , JacocoReport :: class .java ) {
148
+ val jacocoRootReport = tasks.register< JacocoReport > (" jacocoRootReport" ) {
149
149
group = LifecycleBasePlugin .VERIFICATION_GROUP
150
- description = " Generates code coverage report for all sub-projects."
150
+ description = " Generates an HTML code coverage report for all sub-projects."
151
151
152
152
val jacocoReportTasks =
153
153
subprojects
@@ -157,24 +157,17 @@ val jacocoRootReport = tasks.register("jacocoRootReport", JacocoReport::class.ja
157
157
// Otherwise, Jacoco tries to generate coverage data for tests that don't exist
158
158
! it.java.sourceSets[" test" ].allSource.isEmpty
159
159
}
160
- .map { it.tasks[jacocoTestResultTaskName ] as JacocoReport }
160
+ .map { it.tasks[" jacocoTestReport " ] as JacocoReport }
161
161
.toList()
162
162
dependsOn(jacocoReportTasks)
163
163
164
- val allExecutionData = jacocoReportTasks.map { it.executionData }
165
- executionData(* allExecutionData.toTypedArray())
166
-
167
- // Pre-initialize these to empty collections to prevent NPE on += call below.
168
- additionalSourceDirs = files()
169
- sourceDirectories = files()
170
- classDirectories = files()
164
+ executionData.setFrom(Callable { jacocoReportTasks.map { it.executionData } })
171
165
172
166
subprojects.forEach { testedProject ->
173
167
val sourceSets = testedProject.java.sourceSets
174
- this @register.additionalSourceDirs =
175
- this @register.additionalSourceDirs?.plus(files(sourceSets[" main" ].allSource.srcDirs))
176
- this @register.sourceDirectories + = files(sourceSets[" main" ].allSource.srcDirs)
177
- this @register.classDirectories + = files(sourceSets[" main" ].output)
168
+ val mainSourceSet = sourceSets[" main" ]
169
+ this @register.additionalSourceDirs(mainSourceSet.allSource.sourceDirectories)
170
+ this @register.additionalClassDirs(mainSourceSet.output)
178
171
}
179
172
180
173
reports {
@@ -202,7 +195,7 @@ tasks.named(LifecycleBasePlugin.CHECK_TASK_NAME).configure {
202
195
203
196
tasks.withType<Wrapper >().configureEach {
204
197
description = " Configure the version of gradle to download and use"
205
- gradleVersion = " 4.10.2 "
198
+ gradleVersion = " 5.1 "
206
199
distributionType = Wrapper .DistributionType .ALL
207
200
}
208
201
0 commit comments