Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ abstract class JacocoJavaagentProvider implements CommandLineArgumentProvider, N
@Override
Iterable<String> asArguments() {
[
"-javaagent:${jacocoAgent.get().asFile}=destfile=${execResultFile.get().asFile},dumponexit=false,append=false,jmx=true,includes=org.spockframework.*".toString(),
"-javaagent:${jacocoAgent.get().asFile}=destfile=${execResultFile.get().asFile},dumponexit=false,append=false,jmx=true,includes=org.spockframework.*:spock.*".toString(),
"-DJacocoAstDumpTrigger=true"
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import org.gradle.api.tasks.testing.Test
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.gradle.jvm.toolchain.JavaToolchainService
import org.gradle.testing.jacoco.plugins.JacocoPluginExtension
import org.gradle.testing.jacoco.plugins.JacocoTaskExtension
import org.jetbrains.annotations.VisibleForTesting

import java.time.Duration
Expand Down Expand Up @@ -130,6 +131,11 @@ class SpockBasePlugin implements Plugin<Project> {
.flatMap { it.findVersion("jacoco") }
.orElseThrow { new IllegalStateException("Jacoco version not found") }
project.extensions.getByType(JacocoPluginExtension).toolVersion = jacocoVersion.requiredVersion

// Only instrument Spock's own packages, not the libraries under test.
project.tasks.withType(Test).configureEach { task ->
task.extensions.getByType(JacocoTaskExtension).includes = ['spock.*', 'org.spockframework.*']
}
}

private static void dependencyInsight(Project project) {
Expand Down
Loading