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.
This commit is contained in:
Alexey Tsvetkov
2016-12-06 15:40:57 +03:00
parent 51a8f6ee4f
commit fb869277d9
@@ -313,7 +313,7 @@ class KotlinCoreEnvironment private constructor(
companion object { companion object {
init { init {
System.getProperties().setProperty("idea.plugins.compatible.build", "162.9999") setCompatibleBuild()
} }
private val APPLICATION_LOCK = Object() private val APPLICATION_LOCK = Object()
@@ -323,6 +323,7 @@ class KotlinCoreEnvironment private constructor(
@JvmStatic fun createForProduction( @JvmStatic fun createForProduction(
parentDisposable: Disposable, configuration: CompilerConfiguration, configFilePaths: List<String> parentDisposable: Disposable, configuration: CompilerConfiguration, configFilePaths: List<String>
): KotlinCoreEnvironment { ): KotlinCoreEnvironment {
setCompatibleBuild()
val appEnv = getOrCreateApplicationEnvironmentForProduction(configuration, configFilePaths) val appEnv = getOrCreateApplicationEnvironmentForProduction(configuration, configFilePaths)
// Disposing of the environment is unsafe in production then parallel builds are enabled, but turning it off universally // 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 // 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 return environment
} }
@JvmStatic
private fun setCompatibleBuild() {
System.getProperties().setProperty("idea.plugins.compatible.build", "162.9999")
}
@TestOnly @TestOnly
@JvmStatic fun createForTests( @JvmStatic fun createForTests(
parentDisposable: Disposable, configuration: CompilerConfiguration, extensionConfigs: List<String> parentDisposable: Disposable, configuration: CompilerConfiguration, extensionConfigs: List<String>