Do not stop Gradle daemons with the same version as that of the build.

This commit is contained in:
Sergey Igushkin
2017-12-01 19:44:15 +03:00
parent a223870e7a
commit f9dc892c42
2 changed files with 12 additions and 1 deletions
@@ -84,6 +84,8 @@ tasks.withType(Test) {
executable = "${JDK_18}/bin/java"
systemProperty("kotlinVersion", kotlinVersion)
systemProperty("runnerGradleVersion", gradle.gradleVersion)
def mavenLocalRepo = System.getProperty("maven.repo.local")
if (mavenLocalRepo != null) {
systemProperty("maven.repo.local", mavenLocalRepo)
@@ -128,7 +128,14 @@ abstract class BaseGradleIT {
wrapperProperties.modify { it.replace("<GRADLE_WRAPPER_VERSION>", version) }
}
private val runnerGradleVersion = System.getProperty("runnerGradleVersion")
private fun stopDaemon(version: String, environmentVariables: Map<String, String>) {
if (version == runnerGradleVersion) {
println("Not stopping Gradle daemon v$version as it matches the runner version")
return
}
println("Stopping gradle daemon v$version")
val wrapperDir = gradleWrappers[version] ?: error("Was asked to stop unknown daemon $version")
@@ -146,7 +153,9 @@ abstract class BaseGradleIT {
for (version in wrapperVersions) {
stopDaemon(version, environmentVariables)
}
assert(daemonRunCount.isEmpty()) { "Could not stop some daemons ${daemonRunCount.keys.joinToString()}" }
assert(daemonRunCount.keys.none { it != runnerGradleVersion }) {
"Could not stop some daemons ${(daemonRunCount.keys - runnerGradleVersion).joinToString()}"
}
}
}