[Gradle] Remove the system property for compiler execution strategy

#KT-51831 Fixed
This commit is contained in:
Alexander Likhachev
2022-08-02 17:18:24 +02:00
committed by Space
parent 2a16fe1d0f
commit ce72948a21
4 changed files with 5 additions and 49 deletions
@@ -12,7 +12,7 @@ import org.gradle.api.tasks.Internal
enum class KotlinCompilerExecutionStrategy(
/**
* Value that should be passed for `kotlin.compiler.execution.strategy` Gradle or system property to choose the strategy
* Value that should be passed for `kotlin.compiler.execution.strategy` Gradle property to choose the strategy
*/
val propertyValue: String
) {
@@ -75,17 +75,6 @@ abstract class ExecutionStrategyIT : KGPDaemonsBaseTest() {
)
}
@DisplayName("Compilation via Kotlin daemon enabled using system property")
@GradleTest
fun testDaemonViaSystemProperty(gradleVersion: GradleVersion) {
doTestExecutionStrategy(
gradleVersion,
KotlinCompilerExecutionStrategy.DAEMON,
addHeapDumpOptions = false,
viaSystemProperty = true
)
}
@DisplayName("Compilation inside Gradle daemon")
@GradleTest
fun testInProcess(gradleVersion: GradleVersion) {
@@ -95,16 +84,6 @@ abstract class ExecutionStrategyIT : KGPDaemonsBaseTest() {
)
}
@DisplayName("Compilation inside Gradle daemon enabled using system property")
@GradleTest
fun testInProcessViaSystemProperty(gradleVersion: GradleVersion) {
doTestExecutionStrategy(
gradleVersion,
KotlinCompilerExecutionStrategy.IN_PROCESS,
viaSystemProperty = true
)
}
@DisplayName("Compilation via separate compiler process")
@GradleTest
fun testOutOfProcess(gradleVersion: GradleVersion) {
@@ -114,21 +93,10 @@ abstract class ExecutionStrategyIT : KGPDaemonsBaseTest() {
)
}
@DisplayName("Compilation via separate compiler process enabled via system property")
@GradleTest
fun testOutOfProcessViaSystemProperty(gradleVersion: GradleVersion) {
doTestExecutionStrategy(
gradleVersion,
KotlinCompilerExecutionStrategy.OUT_OF_PROCESS,
viaSystemProperty = true
)
}
private fun doTestExecutionStrategy(
gradleVersion: GradleVersion,
executionStrategy: KotlinCompilerExecutionStrategy,
addHeapDumpOptions: Boolean = true,
viaSystemProperty: Boolean = false
) {
project(
projectName = "kotlinBuiltins",
@@ -137,8 +105,7 @@ abstract class ExecutionStrategyIT : KGPDaemonsBaseTest() {
) {
setupProject(this)
val cliArgPrefix = if (viaSystemProperty) "-D" else "-P"
val strategyCLIArg = "${cliArgPrefix}kotlin.compiler.execution.strategy=${executionStrategy.propertyValue}"
val strategyCLIArg = "-Pkotlin.compiler.execution.strategy=${executionStrategy.propertyValue}"
val finishMessage = "Finished executing kotlin compiler using $executionStrategy strategy"
build("build", strategyCLIArg) {
@@ -1 +1,2 @@
org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=512m -Dkotlin.compiler.execution.strategy="out-of-process"
org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=512m
kotlin.compiler.execution.strategy=out-of-process
@@ -417,19 +417,7 @@ internal class PropertiesProvider private constructor(private val project: Proje
get() = property("kotlin.daemon.jvmargs")
val kotlinCompilerExecutionStrategy: KotlinCompilerExecutionStrategy
get() {
val propertyName = "kotlin.compiler.execution.strategy"
val gradleProperty = property(propertyName)
// system property is for backward compatibility
val value = (gradleProperty ?: System.getProperty(propertyName)?.also {
SingleWarningPerBuild.show(
project,
"The '$propertyName' system property is deprecated and will have no effect since Kotlin 1.8.0. " +
"Please use the '$propertyName' project property or the `compilerExecutionStrategy` Kotlin compile task property instead."
)
})
return KotlinCompilerExecutionStrategy.fromProperty(value?.toLowerCase())
}
get() = KotlinCompilerExecutionStrategy.fromProperty(property("kotlin.compiler.execution.strategy")?.toLowerCase())
private fun propertyWithDeprecatedVariant(propName: String, deprecatedPropName: String): String? {
val deprecatedProperty = property(deprecatedPropName)