Kotlin Facet: Use Kotlin SDK for non-JVM imported modules
This commit is contained in:
@@ -31,6 +31,7 @@ import org.jetbrains.kotlin.idea.caches.resolve.analyzeAndGetResult
|
||||
import org.jetbrains.kotlin.idea.facet.KotlinFacet
|
||||
import org.jetbrains.kotlin.idea.framework.CommonLibraryKind
|
||||
import org.jetbrains.kotlin.idea.framework.JSLibraryKind
|
||||
import org.jetbrains.kotlin.idea.framework.KotlinSdkType
|
||||
import org.jetbrains.kotlin.idea.refactoring.toPsiFile
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.junit.Assert
|
||||
@@ -627,6 +628,8 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
val rootManager = ModuleRootManager.getInstance(getModule("project"))
|
||||
val stdlib = rootManager.orderEntries.filterIsInstance<LibraryOrderEntry>().single().library
|
||||
assertEquals(JSLibraryKind, (stdlib as LibraryEx).kind)
|
||||
|
||||
Assert.assertTrue(ModuleRootManager.getInstance(getModule("project")).sdk!!.sdkType is KotlinSdkType)
|
||||
}
|
||||
|
||||
fun testFacetSplitConfiguration() {
|
||||
@@ -1013,6 +1016,8 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertImporterStatePresent()
|
||||
|
||||
Assert.assertEquals(TargetPlatformKind.JavaScript, facetSettings.targetPlatformKind)
|
||||
|
||||
Assert.assertTrue(ModuleRootManager.getInstance(getModule("project")).sdk!!.sdkType is KotlinSdkType)
|
||||
}
|
||||
|
||||
fun testJsDetectionByGoalWithJsStdlib() {
|
||||
@@ -1063,6 +1068,8 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertImporterStatePresent()
|
||||
|
||||
Assert.assertEquals(TargetPlatformKind.JavaScript, facetSettings.targetPlatformKind)
|
||||
|
||||
Assert.assertTrue(ModuleRootManager.getInstance(getModule("project")).sdk!!.sdkType is KotlinSdkType)
|
||||
}
|
||||
|
||||
fun testJsDetectionByGoalWithCommonStdlib() {
|
||||
@@ -1113,6 +1120,8 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertImporterStatePresent()
|
||||
|
||||
Assert.assertEquals(TargetPlatformKind.JavaScript, facetSettings.targetPlatformKind)
|
||||
|
||||
Assert.assertTrue(ModuleRootManager.getInstance(getModule("project")).sdk!!.sdkType is KotlinSdkType)
|
||||
}
|
||||
|
||||
fun testJsAndCommonStdlibKinds() {
|
||||
@@ -1217,6 +1226,8 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertImporterStatePresent()
|
||||
|
||||
Assert.assertEquals(TargetPlatformKind.Common, facetSettings.targetPlatformKind)
|
||||
|
||||
Assert.assertTrue(ModuleRootManager.getInstance(getModule("project")).sdk!!.sdkType is KotlinSdkType)
|
||||
}
|
||||
|
||||
fun testCommonDetectionByGoalWithJsStdlib() {
|
||||
@@ -1261,6 +1272,8 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertImporterStatePresent()
|
||||
|
||||
Assert.assertEquals(TargetPlatformKind.Common, facetSettings.targetPlatformKind)
|
||||
|
||||
Assert.assertTrue(ModuleRootManager.getInstance(getModule("project")).sdk!!.sdkType is KotlinSdkType)
|
||||
}
|
||||
|
||||
fun testCommonDetectionByGoalWithCommonStdlib() {
|
||||
@@ -1309,6 +1322,8 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
val rootManager = ModuleRootManager.getInstance(getModule("project"))
|
||||
val stdlib = rootManager.orderEntries.filterIsInstance<LibraryOrderEntry>().single().library
|
||||
assertEquals(CommonLibraryKind, (stdlib as LibraryEx).kind)
|
||||
|
||||
Assert.assertTrue(ModuleRootManager.getInstance(getModule("project")).sdk!!.sdkType is KotlinSdkType)
|
||||
}
|
||||
|
||||
fun testJvmDetectionByConflictingGoalsAndJvmStdlib() {
|
||||
|
||||
Reference in New Issue
Block a user