MPP: Reset JDK for JVM modules

#KT-26937 Fixed
This commit is contained in:
Alexey Sedunov
2018-09-20 15:48:12 +03:00
parent 6d4f927f7e
commit bd3adbd457
@@ -227,8 +227,8 @@ private val CommonCompilerArguments.ignoredFields: List<String>
private fun Module.configureSdkIfPossible(compilerArguments: CommonCompilerArguments, modelsProvider: IdeModifiableModelsProvider) {
val allSdks = ProjectJdkTable.getInstance().allJdks
val sdk = if (compilerArguments is K2JVMCompilerArguments) {
val jdkHome = compilerArguments.jdkHome ?: return
allSdks.firstOrNull { it.sdkType is JavaSdk && FileUtil.comparePaths(it.homePath, jdkHome) == 0 } ?: return
val jdkHome = compilerArguments.jdkHome
allSdks.firstOrNull { it.sdkType is JavaSdk && FileUtil.comparePaths(it.homePath, jdkHome) == 0 }
} else {
allSdks.firstOrNull { it.sdkType is KotlinSdkType }
?: modelsProvider