From 1fb90ac0fd0af48eff6f25dc904b1df18013ec50 Mon Sep 17 00:00:00 2001 From: Yan Zhulanow Date: Sat, 14 Jan 2017 00:26:18 +0900 Subject: [PATCH] Copy compiler arguments from iml even if "Use project settings" checkbox is checked. This is deadly needed for the compiler plugins no-arg and all-open, assuming that the default state of the checkbox is "on". (KT-15686, KT-15686). This is a temporary fix, and it should be reverted when "Use project settings" will be disabled by default in modules imported from external build tools (Maven, Gradle). --- .../kotlin/jps/JpsKotlinCompilerSettings.kt | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/jps-plugin/src/org/jetbrains/kotlin/jps/JpsKotlinCompilerSettings.kt b/jps-plugin/src/org/jetbrains/kotlin/jps/JpsKotlinCompilerSettings.kt index c511a460d09..9795240cdd8 100644 --- a/jps-plugin/src/org/jetbrains/kotlin/jps/JpsKotlinCompilerSettings.kt +++ b/jps-plugin/src/org/jetbrains/kotlin/jps/JpsKotlinCompilerSettings.kt @@ -72,16 +72,22 @@ class JpsKotlinCompilerSettings : JpsElementBase() { fun getCommonCompilerArguments(module: JpsModule): CommonCompilerArguments { val defaultArguments = getSettings(module.project).commonCompilerArguments val facetSettings = module.kotlinFacetExtension?.settings ?: return defaultArguments - if (facetSettings.useProjectSettings) return defaultArguments val (languageLevel, apiLevel) = facetSettings.versionInfo val facetArguments = facetSettings.compilerInfo.commonCompilerArguments ?: return defaultArguments return copyBean(facetArguments).apply { - languageVersion = languageLevel?.description - apiVersion = apiLevel?.description - multiPlatform = module - .dependenciesList - .dependencies - .any { (it as? JpsModuleDependency)?.module?.targetPlatform == TargetPlatformKind.Common } + if (facetSettings.useProjectSettings) { + languageVersion = defaultArguments.languageVersion + apiVersion = defaultArguments.apiVersion + multiPlatform = defaultArguments.multiPlatform + } + else { + languageVersion = languageLevel?.description + apiVersion = apiLevel?.description + multiPlatform = module + .dependenciesList + .dependencies + .any { (it as? JpsModuleDependency)?.module?.targetPlatform == TargetPlatformKind.Common } + } } }