MPP: Fix implemented modules importing in Android projects (#KT-23697)
This commit is contained in:
+3
-1
@@ -222,7 +222,9 @@ fun configureFacetByGradleModule(
|
|||||||
}
|
}
|
||||||
|
|
||||||
with(kotlinFacet.configuration.settings) {
|
with(kotlinFacet.configuration.settings) {
|
||||||
implementedModuleNames = getImplementedModuleNames(moduleNode, sourceSetName, ideModule.project)
|
val sourceSetNameForImplementedModules = if (ideModule.getBuildSystemType() == AndroidGradle) null else sourceSetName
|
||||||
|
implementedModuleNames = getImplementedModuleNames(moduleNode, sourceSetNameForImplementedModules, ideModule.project)
|
||||||
|
|
||||||
productionOutputPath = getExplicitOutputPath(moduleNode, platformKind, "main")
|
productionOutputPath = getExplicitOutputPath(moduleNode, platformKind, "main")
|
||||||
testOutputPath = getExplicitOutputPath(moduleNode, platformKind, "test")
|
testOutputPath = getExplicitOutputPath(moduleNode, platformKind, "test")
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -221,7 +221,9 @@ fun configureFacetByGradleModule(
|
|||||||
}
|
}
|
||||||
|
|
||||||
with(kotlinFacet.configuration.settings) {
|
with(kotlinFacet.configuration.settings) {
|
||||||
implementedModuleNames = getImplementedModuleNames(moduleNode, sourceSetName, ideModule.project)
|
val sourceSetNameForImplementedModules = if (ideModule.getBuildSystemType() == AndroidGradle) null else sourceSetName
|
||||||
|
implementedModuleNames = getImplementedModuleNames(moduleNode, sourceSetNameForImplementedModules, ideModule.project)
|
||||||
|
|
||||||
productionOutputPath = getExplicitOutputPath(moduleNode, platformKind, "main")
|
productionOutputPath = getExplicitOutputPath(moduleNode, platformKind, "main")
|
||||||
testOutputPath = getExplicitOutputPath(moduleNode, platformKind, "test")
|
testOutputPath = getExplicitOutputPath(moduleNode, platformKind, "test")
|
||||||
}
|
}
|
||||||
|
|||||||
+85
@@ -718,6 +718,91 @@ class MultiplatformProjectImportingTest : GradleImportingTestCase() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun simpleAndroidAppWithCommonModule() {
|
||||||
|
createProjectSubFile(
|
||||||
|
"settings.gradle",
|
||||||
|
"include ':app', ':jvm', ':cmn'"
|
||||||
|
)
|
||||||
|
|
||||||
|
val kotlinVersion = "1.2.41"
|
||||||
|
|
||||||
|
createProjectSubFile(
|
||||||
|
"build.gradle", """
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
maven { url 'https://maven.google.com' }
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
|
||||||
|
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
project('cmn') {
|
||||||
|
apply plugin: 'kotlin-platform-common'
|
||||||
|
}
|
||||||
|
|
||||||
|
project('jvm') {
|
||||||
|
apply plugin: 'kotlin-platform-jvm'
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
expectedBy project(":cmn")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
project('app') {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'com.android.application'
|
||||||
|
apply plugin: 'kotlin-android'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 26
|
||||||
|
buildToolsVersion "23.0.1"
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "org.jetbrains.kotlin"
|
||||||
|
minSdkVersion 18
|
||||||
|
targetSdkVersion 26
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile project(":jvm")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
createProjectSubFile(
|
||||||
|
"local.properties", """
|
||||||
|
sdk.dir=/${KotlinTestUtils.getAndroidSdkSystemIndependentPath()}
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
val isResolveModulePerSourceSet = getCurrentExternalProjectSettings().isResolveModulePerSourceSet
|
||||||
|
try {
|
||||||
|
currentExternalProjectSettings.isResolveModulePerSourceSet = true
|
||||||
|
importProject()
|
||||||
|
|
||||||
|
assertModuleModuleDepScope("app", "cmn", DependencyScope.COMPILE)
|
||||||
|
TestCase.assertEquals(listOf("cmn"), facetSettings("app").implementedModuleNames)
|
||||||
|
|
||||||
|
currentExternalProjectSettings.isResolveModulePerSourceSet = false
|
||||||
|
importProject()
|
||||||
|
|
||||||
|
assertModuleModuleDepScope("app", "cmn", DependencyScope.COMPILE)
|
||||||
|
TestCase.assertEquals(listOf("cmn"), facetSettings("app").implementedModuleNames)
|
||||||
|
} finally {
|
||||||
|
currentExternalProjectSettings.isResolveModulePerSourceSet = isResolveModulePerSourceSet
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testJsTestOutputFile() {
|
fun testJsTestOutputFile() {
|
||||||
createProjectSubFile(
|
createProjectSubFile(
|
||||||
|
|||||||
Reference in New Issue
Block a user