Skip to content

Commit b16aafc

Browse files
committed
Upgraded intellij-coverage version to 1.0.724
Refactoring of Android SDK specification checks has also been performed.
1 parent 36f4c8b commit b16aafc

File tree

6 files changed

+23
-13
lines changed

6 files changed

+23
-13
lines changed

gradle/libs.versions.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[versions]
22

3-
intellij-coverage = "1.0.721"
3+
intellij-coverage = "1.0.724"
44
junit = "5.9.0"
55
kotlinx-bcv = "0.13.0"
66
kotlinx-dokka = "1.8.10"

kover-gradle-plugin/build.gradle.kts

+19-1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ val functionalTest by tasks.registering(Test::class) {
8484

8585

8686
// customizing functional tests
87+
setAndroidSdkDir()
8788
setSystemPropertyFromProject("kover.release.version")
8889
setSystemPropertyFromProject("kover.test.gradle.version")
8990
setSystemPropertyFromProject("kover.test.android.sdk")
@@ -93,6 +94,24 @@ val functionalTest by tasks.registering(Test::class) {
9394
}
9495
}
9596

97+
fun Test.setAndroidSdkDir() {
98+
if (project.hasProperty("kover.test.android.disable")) {
99+
// do nothing if android tests are skipped
100+
return
101+
}
102+
val sdkDir = if (project.hasProperty("kover.test.android.sdk")) {
103+
project.property("kover.test.android.sdk")
104+
} else {
105+
environment["ANDROID_HOME"]
106+
}
107+
108+
if (sdkDir == null) {
109+
throw GradleException("Android SDK directory not specified, specify environment variable ANDROID_HOME or parameter -Pkover.test.android.sdk. To skip Android tests pass parameter -Pkover.test.android.disable")
110+
}
111+
112+
systemProperties[name] = sdkDir
113+
}
114+
96115
fun Test.setSystemPropertyFromProject(name: String) {
97116
if (project.hasProperty(name)) systemProperties[name] = project.property(name)
98117
}
@@ -106,7 +125,6 @@ fun Test.setBooleanSystemPropertyFromProject(
106125

107126
tasks.check { dependsOn(functionalTest) }
108127

109-
110128
tasks.withType<KotlinCompile>().configureEach {
111129
kotlinOptions {
112130
allWarningsAsErrors = true

kover-gradle-plugin/src/functionalTest/kotlin/kotlinx/kover/gradle/plugin/test/functional/framework/checker/Checker.kt

-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ internal fun BuildResult.checkNoAndroidSdk() {
4646
) {
4747
if (isAndroidTestDisabled) {
4848
throw TestAbortedException("Android tests are disabled")
49-
} else {
50-
throw Exception("Android SDK directory not specified, specify environment variable $ANDROID_HOME_ENV or parameter -Pkover.test.android.sdk. To ignore Android tests pass parameter -Pkover.test.android.disable")
5149
}
5250
}
5351
}

kover-gradle-plugin/src/functionalTest/kotlin/kotlinx/kover/gradle/plugin/test/functional/framework/common/Environment.kt

+1-6
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ package kotlinx.kover.gradle.plugin.test.functional.framework.common
66

77
import java.io.File
88

9-
/**
10-
* Name of environment variable with Android SDK path.
11-
*/
12-
internal const val ANDROID_HOME_ENV = "ANDROID_HOME"
13-
149
/**
1510
* Version of current Kover build.
1611
*/
@@ -42,7 +37,7 @@ internal val overriddenGradleWrapperVersion: String? = System.getProperty("kover
4237
/**
4338
* Result path to the Android SDK. `null` if not defined.
4439
*/
45-
internal val androidSdkDir: String? = System.getProperty("kover.test.android.sdk")?: System.getenv(ANDROID_HOME_ENV)
40+
internal val androidSdkDir: String? = System.getProperty("kover.test.android.sdk")
4641

4742

4843

kover-gradle-plugin/src/functionalTest/kotlin/kotlinx/kover/gradle/plugin/test/functional/framework/runner/BuildsRunner.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
package kotlinx.kover.gradle.plugin.test.functional.framework.runner
66

7-
import kotlinx.kover.gradle.plugin.test.functional.framework.common.ANDROID_HOME_ENV
87
import kotlinx.kover.gradle.plugin.test.functional.framework.common.isDebugEnabled
98
import kotlinx.kover.gradle.plugin.test.functional.framework.common.logInfo
109
import kotlinx.kover.gradle.plugin.test.functional.framework.common.uri
@@ -104,7 +103,7 @@ private class GradleBuildImpl(
104103
logInfo("Run Gradle commands $gradleArgs for project '${targetDir.canonicalPath}' with wrapper '${env.wrapperDir.canonicalPath}'")
105104

106105
val envVars: MutableMap<String, String> = mutableMapOf()
107-
env.androidSdkDir?.also { dir -> envVars[ANDROID_HOME_ENV] = dir }
106+
env.androidSdkDir?.also { dir -> envVars["ANDROID_HOME"] = dir }
108107

109108
val result = targetDir.buildGradleByShell(runCount++, env.wrapperDir, gradleArgs, envVars)
110109
logInfo("Success build $buildType '$buildName'")

kover-gradle-plugin/src/main/kotlin/kotlinx/kover/gradle/plugin/dsl/KoverVersions.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public object KoverVersions {
1515
/**
1616
* Kover coverage tool version.
1717
*/
18-
public const val KOVER_TOOL_VERSION = "1.0.721"
18+
public const val KOVER_TOOL_VERSION = "1.0.724"
1919

2020
/**
2121
* JaCoCo coverage tool version used by default.

0 commit comments

Comments
 (0)