Migrate import tests of composite MPP build to new version of MPP
This commit is contained in:
-16
@@ -90,22 +90,6 @@ class MultiplatformProjectImportingTest : MultiplePluginVersionGradleImportingTe
|
||||
assertNoDepForModule("js_test", "common2_test")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testPlatformToCommonExpByInComposite() { // renamed from testPlatformToCommonExpectedByDependencyInComposite due to lack support of long names under Windows
|
||||
configureByFiles()
|
||||
importProject()
|
||||
|
||||
TestCase.assertEquals(listOf("common_main"), facetSettings("jvm_main").implementedModuleNames)
|
||||
TestCase.assertEquals(listOf("common_test"), facetSettings("jvm_test").implementedModuleNames)
|
||||
TestCase.assertEquals(listOf("common_main"), facetSettings("js_main").implementedModuleNames)
|
||||
TestCase.assertEquals(listOf("common_test"), facetSettings("js_test").implementedModuleNames)
|
||||
|
||||
assertModuleModuleDepScope("jvm_main", "common_main", DependencyScope.COMPILE)
|
||||
assertModuleModuleDepScope("jvm_test", "common_test", DependencyScope.COMPILE)
|
||||
assertModuleModuleDepScope("js_main", "common_main", DependencyScope.COMPILE)
|
||||
assertModuleModuleDepScope("js_test", "common_test", DependencyScope.COMPILE)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testPlatformToCommonDependencyRoot() {
|
||||
configureByFiles()
|
||||
|
||||
+58
-6
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.config.JvmTarget
|
||||
import org.jetbrains.kotlin.config.KotlinResourceRootType
|
||||
import org.jetbrains.kotlin.config.KotlinSourceRootType
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.ExternalSystemImportingTestCase
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.GradleImportingTestCase
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.MultiplePluginVersionGradleImportingTestCase
|
||||
import org.jetbrains.kotlin.platform.impl.CommonIdePlatformKind
|
||||
import org.jetbrains.kotlin.platform.impl.JsIdePlatformKind
|
||||
@@ -21,7 +20,6 @@ import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runners.Parameterized
|
||||
|
||||
class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportingTestCase() {
|
||||
private fun kotlinVersion() = if (gradleKotlinPluginVersion == MINIMAL_SUPPORTED_VERSION) "1.3.0-rc-146" else gradleKotlinPluginVersion
|
||||
@@ -334,16 +332,20 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
||||
sourceFolder("shared/src/androidTest/kotlin", JavaSourceRootType.TEST_SOURCE)
|
||||
sourceFolder("shared/src/androidTest/resources", JavaResourceRootType.TEST_RESOURCE)
|
||||
}
|
||||
var nativeVersion = when (gradleKotlinPluginVersion) {
|
||||
MINIMAL_SUPPORTED_VERSION -> "1.0.2"
|
||||
else -> "1.1.1"
|
||||
}
|
||||
module("shared_iOSMain") {
|
||||
libraryDependency("Kotlin/Native 0.9.3 - stdlib", DependencyScope.PROVIDED)
|
||||
libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:1.3.0-rc-146", DependencyScope.COMPILE)
|
||||
libraryDependency("Gradle: Kotlin/Native:stdlib:$nativeVersion", DependencyScope.COMPILE)
|
||||
libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${kotlinVersion()}", DependencyScope.COMPILE)
|
||||
moduleDependency("shared_commonMain", DependencyScope.COMPILE)
|
||||
sourceFolder("shared/src/iOSMain/kotlin", KotlinSourceRootType.Source)
|
||||
sourceFolder("shared/src/iOSMain/resources", KotlinResourceRootType.Resource)
|
||||
}
|
||||
module("shared_iOSTest") {
|
||||
libraryDependency("Kotlin/Native 0.9.3 - stdlib", DependencyScope.PROVIDED)
|
||||
libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:1.3.0-rc-146", DependencyScope.TEST)
|
||||
libraryDependency("Gradle: Kotlin/Native:stdlib:$nativeVersion", DependencyScope.TEST)
|
||||
libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${kotlinVersion()}", DependencyScope.TEST)
|
||||
moduleDependency("shared_iOSMain", DependencyScope.TEST)
|
||||
moduleDependency("shared_commonMain", DependencyScope.TEST)
|
||||
moduleDependency("shared_commonTest", DependencyScope.TEST)
|
||||
@@ -479,6 +481,46 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This test is inherited form testPlatformToCommonExpectedByInComposite and actually tests
|
||||
* dependencies in multiplatform project included in composite build
|
||||
*/
|
||||
@Test
|
||||
fun testPlatformToCommonExpByInComposite() {
|
||||
configureByFiles()
|
||||
importProject(true)
|
||||
|
||||
checkProjectStructure(exhaustiveSourceSourceRootList = false) {
|
||||
module("project")
|
||||
module("project.commonMain")
|
||||
module("project.commonTest") {
|
||||
moduleDependency("project.commonMain", DependencyScope.TEST)
|
||||
}
|
||||
module("toInclude")
|
||||
module("toInclude.commonMain")
|
||||
module("toInclude.commonTest") {
|
||||
moduleDependency("toInclude.commonMain", DependencyScope.TEST)
|
||||
}
|
||||
module("toInclude.jsMain") {
|
||||
moduleDependency("toInclude.commonMain", DependencyScope.COMPILE)
|
||||
}
|
||||
|
||||
module("toInclude.jsTest") {
|
||||
moduleDependency("toInclude.commonMain", DependencyScope.TEST)
|
||||
moduleDependency("toInclude.commonTest", DependencyScope.TEST)
|
||||
moduleDependency("toInclude.jsMain", DependencyScope.TEST)
|
||||
}
|
||||
module("toInclude.jvmMain") {
|
||||
moduleDependency("toInclude.commonMain", DependencyScope.COMPILE)
|
||||
}
|
||||
module("toInclude.jvmTest") {
|
||||
moduleDependency("toInclude.commonMain", DependencyScope.TEST)
|
||||
moduleDependency("toInclude.commonTest", DependencyScope.TEST)
|
||||
moduleDependency("toInclude.jvmMain", DependencyScope.TEST)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkProjectStructure(
|
||||
exhaustiveModuleList: Boolean = true,
|
||||
exhaustiveSourceSourceRootList: Boolean = true,
|
||||
@@ -494,6 +536,16 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
||||
body)
|
||||
}
|
||||
|
||||
fun importProject(useQualifiedNames: Boolean) {
|
||||
val isUseQualifiedModuleNames = currentExternalProjectSettings.isUseQualifiedModuleNames
|
||||
currentExternalProjectSettings.isUseQualifiedModuleNames = useQualifiedNames
|
||||
try {
|
||||
importProject()
|
||||
} finally {
|
||||
currentExternalProjectSettings.isUseQualifiedModuleNames = isUseQualifiedModuleNames
|
||||
}
|
||||
}
|
||||
|
||||
override fun importProject() {
|
||||
val isCreateEmptyContentRootDirectories = currentExternalProjectSettings.isCreateEmptyContentRootDirectories
|
||||
currentExternalProjectSettings.isCreateEmptyContentRootDirectories = true
|
||||
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'http://dl.bintray.com/kotlin/kotlin-dev' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
apply from: "include.gradle"
|
||||
def kotlinVersion = gradleKotlinPluginVersion('1.2.0-beta-74')
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
|
||||
}
|
||||
}
|
||||
|
||||
project('common') {
|
||||
apply plugin: 'kotlin-platform-common'
|
||||
}
|
||||
|
||||
project('jvm') {
|
||||
apply plugin: 'kotlin-platform-jvm'
|
||||
|
||||
dependencies {
|
||||
expectedBy project(':common')
|
||||
}
|
||||
}
|
||||
|
||||
project('js') {
|
||||
apply plugin: 'kotlin-platform-js'
|
||||
|
||||
dependencies {
|
||||
expectedBy project(':common')
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
include ':common', ':jvm', ':js'
|
||||
+7
-1
@@ -11,4 +11,10 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: 'kotlin-multiplatform'
|
||||
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'http://dl.bintray.com/kotlin/kotlin-dev' }
|
||||
}
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'http://dl.bintray.com/kotlin/kotlin-dev' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
apply from: "include.gradle"
|
||||
def kotlinVersion = gradleKotlinPluginVersion('1.2.0-beta-74')
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
|
||||
}
|
||||
}
|
||||
|
||||
project('common') {
|
||||
apply plugin: 'kotlin-platform-common'
|
||||
}
|
||||
|
||||
project('jvm') {
|
||||
apply plugin: 'kotlin-platform-jvm'
|
||||
|
||||
dependencies {
|
||||
expectedBy project(':common')
|
||||
}
|
||||
}
|
||||
|
||||
project('js') {
|
||||
apply plugin: 'kotlin-platform-js'
|
||||
|
||||
dependencies {
|
||||
expectedBy project(':common')
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user