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).

Original commit: 1fb90ac0fd
This commit is contained in:
Yan Zhulanow
2017-01-14 00:26:18 +09:00
committed by Yan Zhulanow
parent f2be1f776d
commit e2fff37ccc
@@ -72,16 +72,22 @@ class JpsKotlinCompilerSettings : JpsElementBase<JpsKotlinCompilerSettings>() {
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 }
}
}
}