Migrate jacoco.gradle to plugin (#3330)

This commit is contained in:
Anuraag Agrawal 2021-06-17 02:09:05 +09:00 committed by GitHub
parent d8ff44bf40
commit 91a2c18f30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 25 deletions

View File

@ -0,0 +1,19 @@
plugins {
jacoco
}
jacoco {
toolVersion = "0.8.6"
}
tasks {
named<JacocoReport>("jacocoTestReport") {
dependsOn("test")
reports {
xml.isEnabled = true
csv.isEnabled = false
html.destination = file("${buildDir}/reports/jacoco/")
}
}
}

View File

@ -27,17 +27,6 @@ afterEvaluate {
// Version to use to compile code and run tests. // Version to use to compile code and run tests.
val DEFAULT_JAVA_VERSION = JavaVersion.VERSION_11 val DEFAULT_JAVA_VERSION = JavaVersion.VERSION_11
val applyCodeCoverage = !project.path.run {
startsWith(":smoke-tests") ||
startsWith(":benchmark") ||
startsWith(":instrumentation") ||
startsWith(":testing-common")
}
if (applyCodeCoverage) {
apply(from = "${rootDir}/gradle/jacoco.gradle")
}
java { java {
toolchain { toolchain {
languageVersion.set(otelJava.minJavaVersionSupported.map { JavaLanguageVersion.of(Math.max(it.majorVersion.toInt(), DEFAULT_JAVA_VERSION.majorVersion.toInt())) }) languageVersion.set(otelJava.minJavaVersionSupported.map { JavaLanguageVersion.of(Math.max(it.majorVersion.toInt(), DEFAULT_JAVA_VERSION.majorVersion.toInt())) })

View File

@ -1,5 +1,6 @@
plugins { plugins {
id("otel.java-conventions") id("otel.java-conventions")
id("otel.jacoco-conventions")
id("otel.publish-conventions") id("otel.publish-conventions")
id("otel.instrumentation-conventions") id("otel.instrumentation-conventions")
} }

View File

@ -1,14 +0,0 @@
apply plugin: "jacoco"
jacoco {
toolVersion = "0.8.6"
}
tasks.named('jacocoTestReport').configure {
dependsOn('test')
reports {
xml.enabled true
csv.enabled false
html.destination file("${buildDir}/reports/jacoco/")
}
}

View File

@ -5,6 +5,7 @@ plugins {
group = 'io.opentelemetry.instrumentation' group = 'io.opentelemetry.instrumentation'
apply plugin: "otel.java-conventions" apply plugin: "otel.java-conventions"
apply plugin: "otel.jacoco-conventions"
apply plugin: "otel.publish-conventions" apply plugin: "otel.publish-conventions"
def jflexTargetDir = file"${project.buildDir}/generated/jflex/sql" def jflexTargetDir = file"${project.buildDir}/generated/jflex/sql"

View File

@ -1,6 +1,7 @@
group = 'io.opentelemetry.javaagent' group = 'io.opentelemetry.javaagent'
apply plugin: "otel.java-conventions" apply plugin: "otel.java-conventions"
apply plugin: "otel.jacoco-conventions"
apply plugin: "otel.publish-conventions" apply plugin: "otel.publish-conventions"
dependencies { dependencies {