Migrate "When running on the CI, run only debug test variants".
Following notice here: https://github.com/Kotlin/kotlinx-kover/blob/v0.7.0/docs/gradle-plugin/migrations/migration-to-0.7.0.md#using-isdisabled-boolean-is-an-error-kover-test-task-config-was-removed
This commit is contained in:
parent
b727312040
commit
8f2a1e9e2d
2 changed files with 21 additions and 24 deletions
|
|
@ -20,6 +20,7 @@ import com.android.build.api.variant.FilterConfiguration.FilterType.ABI
|
||||||
import extension.allFeaturesImpl
|
import extension.allFeaturesImpl
|
||||||
import extension.allLibrariesImpl
|
import extension.allLibrariesImpl
|
||||||
import extension.allServicesImpl
|
import extension.allServicesImpl
|
||||||
|
import org.jetbrains.kotlin.cli.common.toBooleanLenient
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("io.element.android-compose-application")
|
id("io.element.android-compose-application")
|
||||||
|
|
@ -229,6 +230,26 @@ dependencies {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val ciBuildProperty = "ci-build"
|
||||||
|
val isCiBuild = if (project.hasProperty(ciBuildProperty)) {
|
||||||
|
val raw = project.property(ciBuildProperty) as? String
|
||||||
|
raw?.toBooleanLenient() == true || raw?.toIntOrNull() == 1
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
kover {
|
||||||
|
// When running on the CI, run only debug test variants
|
||||||
|
if (isCiBuild) {
|
||||||
|
excludeTests {
|
||||||
|
// Disable instrumentation for debug test tasks
|
||||||
|
tasks(
|
||||||
|
"testDebugUnitTest",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// https://kotlin.github.io/kotlinx-kover/
|
// https://kotlin.github.io/kotlinx-kover/
|
||||||
// Run `./gradlew :app:koverHtmlReport` to get report at ./app/build/reports/kover
|
// Run `./gradlew :app:koverHtmlReport` to get report at ./app/build/reports/kover
|
||||||
// Run `./gradlew :app:koverXmlReport` to get XML report
|
// Run `./gradlew :app:koverXmlReport` to get XML report
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import com.google.devtools.ksp.gradle.KspTask
|
import com.google.devtools.ksp.gradle.KspTask
|
||||||
import org.apache.tools.ant.taskdefs.optional.ReplaceRegExp
|
import org.apache.tools.ant.taskdefs.optional.ReplaceRegExp
|
||||||
import org.jetbrains.kotlin.cli.common.toBooleanLenient
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
@ -166,29 +165,6 @@ allprojects {
|
||||||
apply(plugin = "org.jetbrains.kotlinx.kover")
|
apply(plugin = "org.jetbrains.kotlinx.kover")
|
||||||
}
|
}
|
||||||
|
|
||||||
// When running on the CI, run only debug test variants
|
|
||||||
val ciBuildProperty = "ci-build"
|
|
||||||
val isCiBuild = if (project.hasProperty(ciBuildProperty)) {
|
|
||||||
val raw = project.property(ciBuildProperty) as? String
|
|
||||||
raw?.toBooleanLenient() == true || raw?.toIntOrNull() == 1
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
if (isCiBuild) {
|
|
||||||
allprojects {
|
|
||||||
afterEvaluate {
|
|
||||||
tasks.withType<Test>().configureEach {
|
|
||||||
/* TODO
|
|
||||||
extensions.configure<KoverTaskExtension> {
|
|
||||||
val enabled = name.contains("debug", ignoreCase = true)
|
|
||||||
disabledForProject.set(!enabled)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Register quality check tasks.
|
// Register quality check tasks.
|
||||||
tasks.register("runQualityChecks") {
|
tasks.register("runQualityChecks") {
|
||||||
project.subprojects {
|
project.subprojects {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue