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 var targetPlatform: TargetPlatform? = null
get() { 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 //TODO(auskov): this hack should be removed after fixing equals in SimplePlatform
val args = compilerArguments val args = compilerArguments
val mappedPlatforms = field?.componentPlatforms?.flatMap { val singleSimplePlatform = field?.componentPlatforms?.singleOrNull()
if (JvmPlatforms.defaultJvmPlatform.first() == it && args != null) (IdePlatformKind.platformByCompilerArguments(args) if (singleSimplePlatform == JvmPlatforms.defaultJvmPlatform.singleOrNull() && args != null) {
?: return null) else listOf(it) return IdePlatformKind.platformByCompilerArguments(args)
}?.toSet() ?: return null }
return field
return TargetPlatform(mappedPlatforms)
} }