Skip to content

Commit 5774d7c

Browse files
build: setup code coverage tool (#1211)
1 parent 44641c7 commit 5774d7c

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

build.gradle.kts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ buildscript {
1616
plugins {
1717
id("otel.spotless-conventions")
1818
alias(libs.plugins.publishPlugin)
19+
id("org.jetbrains.kotlinx.kover")
1920
}
2021

2122
extra["java_version"] = JavaVersion.VERSION_1_8
@@ -47,3 +48,19 @@ nexusPublishing {
4748
}
4849
}
4950
}
51+
52+
kover {
53+
merge {
54+
subprojects { project ->
55+
true
56+
}
57+
}
58+
reports {
59+
filters {
60+
excludes {
61+
androidGeneratedClasses()
62+
classes("*.BuildConfig")
63+
}
64+
}
65+
}
66+
}

buildSrc/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ dependencies {
2626
implementation(libs.detekt.plugin)
2727
implementation(libs.binary.compat.validator)
2828
implementation(libs.ksp.plugin)
29+
implementation(libs.kover.plugin)
2930
}

buildSrc/src/main/kotlin/otel.android-library-conventions.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ plugins {
1111
id("otel.android-dependency-conventions")
1212
id("io.gitlab.arturbosch.detekt")
1313
id("org.jetbrains.kotlinx.binary-compatibility-validator")
14+
id("org.jetbrains.kotlinx.kover")
1415
}
1516

1617
val javaVersion = rootProject.extra["java_version"] as JavaVersion

gradle/libs.versions.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ androidx-navigation = "2.7.7"
1919
compose = "1.5.4"
2020
detekt = "1.23.8"
2121
binaryCompatValidator = "0.18.1"
22+
koverGradlePlugin = "0.9.1"
2223

2324
[libraries]
2425
opentelemetry-platform-alpha = { module = "io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha", version.ref = "opentelemetry-instrumentation-alpha" }
@@ -89,6 +90,7 @@ byteBuddy-plugin = { module = "net.bytebuddy:byte-buddy-gradle-plugin", version.
8990
kotlin-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
9091
ksp-plugin = { module = "com.google.devtools.ksp:symbol-processing-gradle-plugin", version.ref = "kspPlugin" }
9192
androidx-junit-ktx = { group = "androidx.test.ext", name = "junit-ktx", version.ref = "junitKtx" }
93+
kover-plugin = { module = "org.jetbrains.kotlinx.kover:org.jetbrains.kotlinx.kover.gradle.plugin", version.ref = "koverGradlePlugin" }
9294

9395
[bundles]
9496
mocking = ["mockito-core", "mockito-junit-jupiter", "mockk"]
@@ -99,3 +101,4 @@ publishPlugin = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0
99101
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
100102
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
101103
androidApp = { id = "com.android.application", version.ref = "androidPlugin" }
104+
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "koverGradlePlugin" }

0 commit comments

Comments
 (0)