diff --git a/build.xml b/build.xml index 57e0f87d20a..68c5171c396 100644 --- a/build.xml +++ b/build.xml @@ -380,8 +380,6 @@ - - diff --git a/compiler/build.gradle.kts b/compiler/build.gradle.kts index 1fa3d43f86c..91c587a649c 100644 --- a/compiler/build.gradle.kts +++ b/compiler/build.gradle.kts @@ -77,9 +77,7 @@ val jar: Jar by tasks jar.apply { from(the().sourceSets.getByName("main").output) from("../idea/src").apply { - include("META-INF/extensions/common.xml", - "META-INF/extensions/kotlin2jvm.xml", - "META-INF/extensions/kotlin2js.xml") + include("META-INF/extensions/common.xml") } } diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/EnvironmentConfigFiles.java b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/EnvironmentConfigFiles.java index 0f995a59f1b..da1a2f9f74d 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/EnvironmentConfigFiles.java +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/EnvironmentConfigFiles.java @@ -16,23 +16,9 @@ package org.jetbrains.kotlin.cli.jvm.compiler; -import java.util.Arrays; -import java.util.List; - public enum EnvironmentConfigFiles { - JVM_CONFIG_FILES("extensions/common.xml", "extensions/kotlin2jvm.xml"), - JS_CONFIG_FILES("extensions/common.xml", "extensions/kotlin2js.xml"), - NATIVE_CONFIG_FILES("extensions/common.xml"), - METADATA_CONFIG_FILES("extensions/common.xml"), - EMPTY(); - - private final List files; - - EnvironmentConfigFiles(String... fileArray) { - files = Arrays.asList(fileArray); - } - - public List getFiles() { - return files; - } + JVM_CONFIG_FILES, + JS_CONFIG_FILES, + NATIVE_CONFIG_FILES, + METADATA_CONFIG_FILES, } 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 43e15c5e6cc..db11b81d097 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 @@ -110,8 +110,6 @@ import org.jetbrains.kotlin.script.StandardScriptDefinition import org.jetbrains.kotlin.utils.PathUtil import java.io.File import java.util.zip.ZipFile -import kotlin.reflect.full.declaredMemberProperties -import kotlin.reflect.jvm.isAccessible class KotlinCoreEnvironment private constructor( parentDisposable: Disposable, @@ -385,14 +383,15 @@ class KotlinCoreEnvironment private constructor( private var ourApplicationEnvironment: JavaCoreApplicationEnvironment? = null private var ourProjectCount = 0 - @JvmStatic fun createForProduction( + @JvmStatic + fun createForProduction( parentDisposable: Disposable, configuration: CompilerConfiguration, configFiles: EnvironmentConfigFiles ): KotlinCoreEnvironment { setCompatibleBuild() - val appEnv = getOrCreateApplicationEnvironmentForProduction(configuration, configFiles.files) + val appEnv = getOrCreateApplicationEnvironmentForProduction(configuration) // 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 - if (!(System.getProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY).toBooleanLenient() ?: false)) { + if (System.getProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY).toBooleanLenient() != true) { // JPS may run many instances of the compiler in parallel (there's an option for compiling independent modules in parallel in IntelliJ) // All projects share the same ApplicationEnvironment, and when the last project is disposed, the ApplicationEnvironment is disposed as well Disposer.register(parentDisposable, Disposable { @@ -418,33 +417,33 @@ class KotlinCoreEnvironment private constructor( } @TestOnly - @JvmStatic fun createForTests( - parentDisposable: Disposable, configuration: CompilerConfiguration, extensionConfigs: EnvironmentConfigFiles + @JvmStatic + fun createForTests( + parentDisposable: Disposable, initialConfiguration: CompilerConfiguration, extensionConfigs: EnvironmentConfigFiles ): KotlinCoreEnvironment { - val config = configuration.copy() - if (config.getList(JVMConfigurationKeys.SCRIPT_DEFINITIONS).isEmpty()) { - config.add(JVMConfigurationKeys.SCRIPT_DEFINITIONS, StandardScriptDefinition) + val configuration = initialConfiguration.copy() + if (configuration.getList(JVMConfigurationKeys.SCRIPT_DEFINITIONS).isEmpty()) { + configuration.add(JVMConfigurationKeys.SCRIPT_DEFINITIONS, StandardScriptDefinition) } // Tests are supposed to create a single project and dispose it right after use - return KotlinCoreEnvironment(parentDisposable, - createApplicationEnvironment(parentDisposable, config, extensionConfigs.files, - unitTestMode = true), - config, - extensionConfigs) + return KotlinCoreEnvironment( + parentDisposable, + createApplicationEnvironment(parentDisposable, configuration, unitTestMode = true), + configuration, + extensionConfigs + ) } // used in the daemon for jar cache cleanup val applicationEnvironment: JavaCoreApplicationEnvironment? get() = ourApplicationEnvironment - private fun getOrCreateApplicationEnvironmentForProduction( - configuration: CompilerConfiguration, configFilePaths: List - ): JavaCoreApplicationEnvironment { + private fun getOrCreateApplicationEnvironmentForProduction(configuration: CompilerConfiguration): JavaCoreApplicationEnvironment { synchronized (APPLICATION_LOCK) { if (ourApplicationEnvironment != null) return ourApplicationEnvironment!! val parentDisposable = Disposer.newDisposable() - ourApplicationEnvironment = createApplicationEnvironment(parentDisposable, configuration, configFilePaths, unitTestMode = false) + ourApplicationEnvironment = createApplicationEnvironment(parentDisposable, configuration, unitTestMode = false) ourProjectCount = 0 Disposer.register(parentDisposable, Disposable { synchronized (APPLICATION_LOCK) { @@ -467,7 +466,6 @@ class KotlinCoreEnvironment private constructor( private fun createApplicationEnvironment( parentDisposable: Disposable, configuration: CompilerConfiguration, - configFilePaths: List, unitTestMode: Boolean ): JavaCoreApplicationEnvironment { Extensions.cleanRootArea(parentDisposable) @@ -476,9 +474,7 @@ class KotlinCoreEnvironment private constructor( override fun createJrtFileSystem(): VirtualFileSystem? = CoreJrtFileSystem() } - for (configPath in configFilePaths) { - registerApplicationExtensionPointsAndExtensionsFrom(configuration, configPath) - } + registerApplicationExtensionPointsAndExtensionsFrom(configuration, "extensions/common.xml") registerApplicationServicesForCLI(applicationEnvironment) registerApplicationServices(applicationEnvironment) diff --git a/compiler/conditional-preprocessor/src/org.jetbrains.kotlin.preprocessor/Preprocessor.kt b/compiler/conditional-preprocessor/src/org.jetbrains.kotlin.preprocessor/Preprocessor.kt index 9dc38838b37..752880ad1a5 100644 --- a/compiler/conditional-preprocessor/src/org.jetbrains.kotlin.preprocessor/Preprocessor.kt +++ b/compiler/conditional-preprocessor/src/org.jetbrains.kotlin.preprocessor/Preprocessor.kt @@ -52,7 +52,7 @@ class Preprocessor(val logger: Logger = SystemOutLogger) { init { val configuration = CompilerConfiguration() - val environment = KotlinCoreEnvironment.createForProduction(Disposable { }, configuration, EnvironmentConfigFiles.EMPTY) + val environment = KotlinCoreEnvironment.createForProduction(Disposable { }, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES) val project = environment.project jetPsiFactory = KtPsiFactory(project) diff --git a/idea/src/META-INF/extensions/kotlin2js.xml b/idea/src/META-INF/extensions/kotlin2js.xml deleted file mode 100644 index efe138dbfdd..00000000000 --- a/idea/src/META-INF/extensions/kotlin2js.xml +++ /dev/null @@ -1,6 +0,0 @@ - - org.jetbrains.kotlin - - - - diff --git a/idea/src/META-INF/extensions/kotlin2jvm.xml b/idea/src/META-INF/extensions/kotlin2jvm.xml deleted file mode 100644 index efe138dbfdd..00000000000 --- a/idea/src/META-INF/extensions/kotlin2jvm.xml +++ /dev/null @@ -1,6 +0,0 @@ - - org.jetbrains.kotlin - - - - diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index 1ebb85cb358..800545e1da7 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -2725,8 +2725,6 @@ - -