Enable assertions in Kotlin Compile Daemon process
#KT-32992 Fixed
This commit is contained in:
-1
@@ -734,7 +734,6 @@ abstract class BaseGradleIT {
|
||||
|
||||
// Workaround: override a console type set in the user machine gradle.properties (since Gradle 4.3):
|
||||
add("--console=plain")
|
||||
add("-Dkotlin.daemon.ea=true")
|
||||
addAll(options.freeCommandLineArgs)
|
||||
}
|
||||
|
||||
|
||||
+24
-12
@@ -1,6 +1,5 @@
|
||||
package org.jetbrains.kotlin.gradle
|
||||
|
||||
import org.gradle.util.GradleVersion
|
||||
import org.jetbrains.kotlin.gradle.util.checkedReplace
|
||||
import org.jetbrains.kotlin.gradle.util.getFileByName
|
||||
import org.jetbrains.kotlin.gradle.util.modify
|
||||
@@ -66,23 +65,14 @@ abstract class ExecutionStrategyIT : BaseGradleIT() {
|
||||
val strategyCLIArg = "-Dkotlin.compiler.execution.strategy=$executionStrategy"
|
||||
val finishMessage = "Finished executing kotlin compiler using $executionStrategy strategy"
|
||||
|
||||
val isGradleAtLeast50 = project.testGradleVersionAtLeast("5.0")
|
||||
|
||||
project.build("build", strategyCLIArg) {
|
||||
assertSuccessful()
|
||||
assertContains(finishMessage)
|
||||
checkOutput()
|
||||
assertNoWarnings()
|
||||
|
||||
if (executionStrategy == "daemon" && isGradleAtLeast50) {
|
||||
val m = "Kotlin compile daemon JVM options: \\[(.*?)\\]".toRegex().find(output)
|
||||
?: error("Could not find Kotlin compile daemon JVM options in Gradle's output")
|
||||
val kotlinDaemonJvmArgs = m.groupValues[1].split(",").map { it.trim() }
|
||||
val maxMetaspaceArg = "-XX:MaxMetaspaceSize=256m"
|
||||
Assert.assertTrue(
|
||||
"Kotlin daemon JVM args do not contain '$maxMetaspaceArg': $kotlinDaemonJvmArgs",
|
||||
maxMetaspaceArg in kotlinDaemonJvmArgs
|
||||
)
|
||||
if (executionStrategy == "daemon") {
|
||||
checkCompileDaemon()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,6 +88,28 @@ abstract class ExecutionStrategyIT : BaseGradleIT() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun CompiledProject.checkCompileDaemon() {
|
||||
val isGradleAtLeast50 = project.testGradleVersionAtLeast("5.0")
|
||||
|
||||
val m = "Kotlin compile daemon JVM options: \\[(.*?)\\]".toRegex().find(output)
|
||||
?: error("Could not find Kotlin compile daemon JVM options in Gradle's output")
|
||||
val kotlinDaemonJvmArgs = m.groupValues[1].split(",").mapTo(LinkedHashSet()) { it.trim() }
|
||||
|
||||
fun assertDaemonArgsContain(arg: String) {
|
||||
Assert.assertTrue(
|
||||
"Expected '$arg' in kotlin daemon JVM args, got: $kotlinDaemonJvmArgs",
|
||||
arg in kotlinDaemonJvmArgs
|
||||
)
|
||||
}
|
||||
|
||||
if (isGradleAtLeast50) {
|
||||
// 256m is the default value for Gradle 5.0+
|
||||
assertDaemonArgsContain("-XX:MaxMetaspaceSize=256m")
|
||||
}
|
||||
|
||||
assertDaemonArgsContain("-ea")
|
||||
}
|
||||
|
||||
protected open fun setupProject(project: Project) {
|
||||
project.setupWorkingDir()
|
||||
File(project.projectDir, "app/build.gradle").appendText(
|
||||
|
||||
Reference in New Issue
Block a user