HMPP: fix importing target platforms for case when JVM targets are involved

This commit is contained in:
Andrey Uskov
2019-06-25 16:16:20 +03:00
parent 8445e3a2a4
commit 87e75bd4cc
@@ -192,15 +192,15 @@ class KotlinFacetSettings {
var targetPlatform: TargetPlatform? = null
get() {
// This work-around is required in order to fix importing of the proper JVM target version.
// This work-around is required in order to fix importing of the proper JVM target version and works only
// for fully actualized JVM target platform
//TODO(auskov): this hack should be removed after fixing equals in SimplePlatform
val args = compilerArguments
val mappedPlatforms = field?.componentPlatforms?.flatMap {
if (JvmPlatforms.defaultJvmPlatform.first() == it && args != null) (IdePlatformKind.platformByCompilerArguments(args)
?: return null) else listOf(it)
}?.toSet() ?: return null
return TargetPlatform(mappedPlatforms)
val singleSimplePlatform = field?.componentPlatforms?.singleOrNull()
if (singleSimplePlatform == JvmPlatforms.defaultJvmPlatform.singleOrNull() && args != null) {
return IdePlatformKind.platformByCompilerArguments(args)
}
return field
}