Kotlin Facet: Configure facet if kotlin-android plugin is present
#KT-17861 Fixed
This commit is contained in:
@@ -57,7 +57,7 @@ class KotlinGradleModelBuilder : ModelBuilderService {
|
|||||||
"kotlin" to "kotlin-platform-jvm",
|
"kotlin" to "kotlin-platform-jvm",
|
||||||
"kotlin2js" to "kotlin-platform-js"
|
"kotlin2js" to "kotlin-platform-js"
|
||||||
)
|
)
|
||||||
val kotlinPluginIds = listOf("kotlin", "kotlin2js")
|
val kotlinPluginIds = listOf("kotlin", "kotlin2js", "kotlin-android")
|
||||||
private val kotlinPlatformCommonPluginId = "kotlin-platform-common"
|
private val kotlinPlatformCommonPluginId = "kotlin-platform-common"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -749,6 +749,74 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testKotlinAndroidPluginDetection() {
|
||||||
|
createProjectSubFile("build.gradle", """
|
||||||
|
group 'Again'
|
||||||
|
version '1.0-SNAPSHOT'
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
maven {
|
||||||
|
url='https://dl.bintray.com/kotlin/kotlin-eap-1.1'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath "com.android.tools.build:gradle:2.3.0"
|
||||||
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'com.android.application'
|
||||||
|
apply plugin: 'kotlin-android'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 23
|
||||||
|
buildToolsVersion "23.0.1"
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 11
|
||||||
|
targetSdkVersion 23
|
||||||
|
versionCode 1002003
|
||||||
|
versionName version
|
||||||
|
}
|
||||||
|
|
||||||
|
dataBinding {
|
||||||
|
enabled = true
|
||||||
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_7
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_7
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
debug {
|
||||||
|
applicationIdSuffix ".debug"
|
||||||
|
versionNameSuffix "-debug"
|
||||||
|
}
|
||||||
|
release {
|
||||||
|
minifyEnabled true
|
||||||
|
shrinkResources true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
createProjectSubFile("local.properties", """
|
||||||
|
sdk.dir=/${StringUtil.escapeBackSlashes(File(homePath).parent + "/dependencies/androidSDK")}
|
||||||
|
""")
|
||||||
|
createProjectSubFile("src/main/AndroidManifest.xml", """
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
package="my.test.project" >
|
||||||
|
</manifest>
|
||||||
|
""")
|
||||||
|
importProject()
|
||||||
|
|
||||||
|
Assert.assertNotNull(KotlinFacet.get(getModule("project")))
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testNoFacetInModuleWithoutKotlinPlugin() {
|
fun testNoFacetInModuleWithoutKotlinPlugin() {
|
||||||
createProjectSubFile("build.gradle", """
|
createProjectSubFile("build.gradle", """
|
||||||
|
|||||||
Reference in New Issue
Block a user