Fix creation of KotlinSDK. GradleFacetImportTest fixed
This commit is contained in:
+14
@@ -7,9 +7,23 @@ package org.jetbrains.kotlin.gradle
|
||||
|
||||
import org.jetbrains.kotlin.idea.configuration.KotlinGradleSharedMultiplatformModuleBuilder
|
||||
import org.jetbrains.kotlin.idea.configuration.KotlinGradleWebMultiplatformModuleBuilder
|
||||
import org.jetbrains.kotlin.idea.test.KotlinSdkCreationChecker
|
||||
import org.junit.Test
|
||||
|
||||
class GradleMultiplatformWizardTest : AbstractGradleMultiplatformWizardTest() {
|
||||
|
||||
lateinit var sdkCreationChecker: KotlinSdkCreationChecker
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
sdkCreationChecker = KotlinSdkCreationChecker()
|
||||
}
|
||||
|
||||
override fun tearDown() {
|
||||
sdkCreationChecker.removeNewKotlinSdk()
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testWeb() {
|
||||
testImportFromBuilder(KotlinGradleWebMultiplatformModuleBuilder(), "SampleTests", "SampleTestsJVM")
|
||||
|
||||
+6
-6
@@ -86,7 +86,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
private fun assertKotlinSdk(vararg moduleNames: String) {
|
||||
private fun assertSameKotlinSdks(vararg moduleNames: String) {
|
||||
val sdks = moduleNames.map { getModule(it).sdk!! }
|
||||
val refSdk = sdks.firstOrNull() ?: return
|
||||
Assert.assertTrue(refSdk.sdkType is KotlinSdkType)
|
||||
@@ -629,7 +629,7 @@ compileTestKotlin {
|
||||
assertEquals(JSLibraryKind, (stdlib as LibraryEx).kind)
|
||||
assertTrue(stdlib.getFiles(OrderRootType.CLASSES).isNotEmpty())
|
||||
|
||||
assertKotlinSdk("project_main", "project_test")
|
||||
assertSameKotlinSdks("project_main", "project_test")
|
||||
|
||||
Assert.assertEquals(
|
||||
listOf("file:///src/main/java" to SourceKotlinRootType,
|
||||
@@ -1339,7 +1339,7 @@ compileTestKotlin {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-eap-44")
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.40")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2040,7 +2040,7 @@ compileTestKotlin {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.0-rc-39")
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.40")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2054,7 +2054,7 @@ compileTestKotlin {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-common:1.2.0-rc-39"
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-common:1.2.40"
|
||||
}
|
||||
|
||||
compileKotlinCommon{
|
||||
@@ -2103,7 +2103,7 @@ compileTestKotlin {
|
||||
val stdlib = rootManager.orderEntries.filterIsInstance<LibraryOrderEntry>().single().library
|
||||
assertEquals(CommonLibraryKind, (stdlib as LibraryEx).kind)
|
||||
|
||||
assertKotlinSdk("project_main", "project_test")
|
||||
assertSameKotlinSdks("project_main", "project_test")
|
||||
|
||||
Assert.assertEquals(
|
||||
listOf("file:///src/main/kotlin" to SourceKotlinRootType,
|
||||
|
||||
+6
-6
@@ -86,7 +86,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
private fun assertKotlinSdk(vararg moduleNames: String) {
|
||||
private fun assertSameKotlinSdks(vararg moduleNames: String) {
|
||||
val sdks = moduleNames.map { getModule(it).sdk!! }
|
||||
val refSdk = sdks.firstOrNull() ?: return
|
||||
Assert.assertTrue(refSdk.sdkType is KotlinSdkType)
|
||||
@@ -629,7 +629,7 @@ compileTestKotlin {
|
||||
assertEquals(JSLibraryKind, (stdlib as LibraryEx).kind)
|
||||
assertTrue(stdlib.getFiles(OrderRootType.CLASSES).isNotEmpty())
|
||||
|
||||
assertKotlinSdk("project_main", "project_test")
|
||||
assertSameKotlinSdks("project_main", "project_test")
|
||||
|
||||
Assert.assertEquals(
|
||||
listOf("file:///src/main/java" to SourceKotlinRootType,
|
||||
@@ -1341,7 +1341,7 @@ compileTestKotlin {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-eap-44")
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.40")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2048,7 +2048,7 @@ compileTestKotlin {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.0-rc-39")
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.40")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2062,7 +2062,7 @@ compileTestKotlin {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-common:1.2.0-rc-39"
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-common:1.2.40"
|
||||
}
|
||||
|
||||
compileKotlinCommon{
|
||||
@@ -2111,7 +2111,7 @@ compileTestKotlin {
|
||||
val stdlib = rootManager.orderEntries.filterIsInstance<LibraryOrderEntry>().single().library
|
||||
assertEquals(CommonLibraryKind, (stdlib as LibraryEx).kind)
|
||||
|
||||
assertKotlinSdk("project_main", "project_test")
|
||||
assertSameKotlinSdks("project_main", "project_test")
|
||||
|
||||
Assert.assertEquals(
|
||||
listOf("file:///src/main/kotlin" to SourceKotlinRootType,
|
||||
|
||||
+1
-1
@@ -1149,7 +1149,7 @@ compileTestKotlin {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-eap-44")
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.40")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -240,6 +240,7 @@ private fun Module.configureSdkIfPossible(compilerArguments: CommonCompilerArgum
|
||||
if (isAndroidModule(modelsProvider) || hasNonOverriddenExternalSdkConfiguration(compilerArguments)) return
|
||||
|
||||
val projectSdk = ProjectRootManager.getInstance(project).projectSdk
|
||||
KotlinSdkType.setUpIfNeeded()
|
||||
val allSdks = ProjectJdkTable.getInstance().allJdks
|
||||
val sdk = if (compilerArguments is K2JVMCompilerArguments) {
|
||||
val jdkHome = compilerArguments.jdkHome
|
||||
@@ -256,7 +257,6 @@ private fun Module.configureSdkIfPossible(compilerArguments: CommonCompilerArgum
|
||||
.asSequence()
|
||||
.mapNotNull { modelsProvider.getModifiableRootModel(it).sdk }
|
||||
.firstOrNull { it.sdkType is KotlinSdkType }
|
||||
?: KotlinSdkType.INSTANCE.createSdkWithUniqueName(allSdks.toList())
|
||||
}
|
||||
|
||||
val rootModel = modelsProvider.getModifiableRootModel(this)
|
||||
|
||||
Reference in New Issue
Block a user