@@ -102,7 +102,7 @@ pluginManager.withPlugin("jacoco") {
102102 // Extracts the JaCoCo runtime jar from the configured JaCoCo Agent
103103 def extractJacocoRuntimeTask = tasks. register(" extractJacocoTestKitRuntime" , Copy ) {
104104 from {
105- zipTree(project. configurations. getByName (JacocoPlugin . AGENT_CONFIGURATION_NAME ). asPath). matching { include ' jacocoagent.jar' }. singleFile
105+ zipTree(project. configurations. named (JacocoPlugin . AGENT_CONFIGURATION_NAME ). map {it . asPath } ). matching { include ' jacocoagent.jar' }. singleFile
106106 }
107107 into project. layout. buildDirectory. dir(" testkit" )
108108 }
@@ -118,12 +118,12 @@ pluginManager.withPlugin("jacoco") {
118118 it. group = " reporting"
119119 it. description = " Generates testkit-gradle.properties file which can be read and added to a TestKit build as gradle.properties"
120120 it. dependsOn(extractJacocoRuntimeTask)
121- it. outputFile = new File (buildDir, " testkit/${ javaTestTask.name} /gradle.properties" )
122- it. property(" org.gradle.jvmargs" , " \" -javaagent:${ buildDir } /testkit/jacocoagent.jar=destfile=${ destinationFileProvider.get()} \" " )
121+ it. destinationFile . set(project . layout . buildDirectory . file( " testkit/${ javaTestTask.name} /gradle.properties" ) )
122+ it. property(" org.gradle.jvmargs" , " \" -javaagent:${ project.layout.buildDirectory.get() } /testkit/jacocoagent.jar=destfile=${ destinationFileProvider.get()} \" " )
123123 }
124124
125125 // Make the generated gradle.properties file available on the test classpath as resource
126- dependencies. add(JavaPlugin . TEST_RUNTIME_ONLY_CONFIGURATION_NAME , files(new File (buildDir, " testkit/${ javaTestTask.name} " )))
126+ dependencies. add(JavaPlugin . TEST_RUNTIME_ONLY_CONFIGURATION_NAME , files(project . layout . buildDirectory . file( " testkit/${ javaTestTask.name} " )))
127127
128128 // "Fixes": https://github.com/gradle/gradle/issues/16603
129129 def jacocoTestReport = tasks. named(" jacocoTestReport" )
0 commit comments