From fb869277d97228664098a124c51ec9659dca4b30 Mon Sep 17 00:00:00 2001 From: Alexey Tsvetkov Date: Tue, 6 Dec 2016 15:40:57 +0300 Subject: [PATCH] Set property "idea.plugins.compatible.build" every time production environment is created Gradle can wipe system properties between the build. If this property is not set, "idea.properties is not found exception" can be thrown when creating KotlinCoreEnvironment. --- .../kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt index 4a9bc8af275..6c3625cf405 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt @@ -313,7 +313,7 @@ class KotlinCoreEnvironment private constructor( companion object { init { - System.getProperties().setProperty("idea.plugins.compatible.build", "162.9999") + setCompatibleBuild() } private val APPLICATION_LOCK = Object() @@ -323,6 +323,7 @@ class KotlinCoreEnvironment private constructor( @JvmStatic fun createForProduction( parentDisposable: Disposable, configuration: CompilerConfiguration, configFilePaths: List ): KotlinCoreEnvironment { + setCompatibleBuild() val appEnv = getOrCreateApplicationEnvironmentForProduction(configuration, configFilePaths) // Disposing of the environment is unsafe in production then parallel builds are enabled, but turning it off universally // breaks a lot of tests, therefore it is disabled for production and enabled for tests @@ -345,6 +346,11 @@ class KotlinCoreEnvironment private constructor( return environment } + @JvmStatic + private fun setCompatibleBuild() { + System.getProperties().setProperty("idea.plugins.compatible.build", "162.9999") + } + @TestOnly @JvmStatic fun createForTests( parentDisposable: Disposable, configuration: CompilerConfiguration, extensionConfigs: List