Fix MPP import tests

This commit is contained in:
Andrey Uskov
2019-09-29 22:57:23 +03:00
parent c0f2be478f
commit 6d9be0ab5d
9 changed files with 42 additions and 28 deletions
@@ -852,7 +852,7 @@ open class KotlinMPPGradleProjectResolver : AbstractProjectResolverExtension() {
gradleModule: IdeaModule,
resolverCtx: ProjectResolverContext
): KotlinSourceSetInfo? {
if (sourceSet.actualPlatforms.platforms.filter { !it.isNotSupported() }.isEmpty()) return null
if (sourceSet.actualPlatforms.platforms.none { !it.isNotSupported() }) return null
return KotlinSourceSetInfo(sourceSet).also { info ->
val languageSettings = sourceSet.languageSettings
info.moduleId = getKotlinModuleId(gradleModule, sourceSet, resolverCtx)
@@ -5,9 +5,11 @@
package org.jetbrains.kotlin.gradle
import org.jetbrains.kotlin.idea.codeInsight.gradle.MultiplePluginVersionGradleImportingTestCase.Companion.MINIMAL_SUPPORTED_VERSION
//BUNCH 181
fun MultiplatformProjectImportingTest.shouldRunTest(kotlinPluginVersion: String, gradleVersion: String): Boolean {
return true
return MINIMAL_SUPPORTED_VERSION == kotlinPluginVersion
}
fun NewMultiplatformProjectImportingTest.shouldRunTest(kotlinPluginVersion: String, gradleVersion: String): Boolean {
@@ -55,6 +55,13 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
apiVersion("1.3")
when (module.name) {
"project", "app", "lib" -> additionalArguments(null)
"app_jvmMain", "app_jvmTest", "lib_jvmMain", "lib_jvmTest" ->
additionalArguments(
if (gradleKotlinPluginVersion == MINIMAL_SUPPORTED_VERSION)
"-version"
else
"-Xallow-no-source-files"
)
else -> additionalArguments("-version")
}
}
@@ -292,6 +299,9 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
libraryDependency("Gradle: org.hamcrest:hamcrest-core:1.3@jar", DependencyScope.TEST)
libraryDependency("Gradle: org.hamcrest:hamcrest-integration:1.3@jar", DependencyScope.TEST)
libraryDependency("Gradle: org.hamcrest:hamcrest-library:1.3@jar", DependencyScope.TEST)
if (gradleKotlinPluginVersion != MINIMAL_SUPPORTED_VERSION) {
libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-android-extensions-runtime:${kotlinVersion()}@jar", DependencyScope.COMPILE)
}
libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${kotlinVersion()}@jar", DependencyScope.COMPILE)
libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlinVersion()}@jar", DependencyScope.COMPILE)
libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion()}@jar", DependencyScope.COMPILE)
@@ -332,10 +342,7 @@ 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.3.10"
else -> "1.3.20"
}
var nativeVersion = kotlinVersion()
module("shared_iOSMain") {
libraryDependency("Kotlin/Native $nativeVersion - stdlib", DependencyScope.PROVIDED)
libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${kotlinVersion()}", DependencyScope.COMPILE)
@@ -24,7 +24,7 @@ abstract class MultiplePluginVersionGradleImportingTestCase : GradleImportingTes
companion object {
const val MINIMAL_SUPPORTED_VERSION = "minimal"// minimal supported version
private val KOTLIN_GRADLE_PLUGIN_VERSIONS = listOf(MINIMAL_SUPPORTED_VERSION, "1.3.20")
private val KOTLIN_GRADLE_PLUGIN_VERSIONS = listOf(MINIMAL_SUPPORTED_VERSION, "1.3.50")
@JvmStatic
@Parameterized.Parameters(name = "{index}: Gradle-{0}, KotlinGradlePlugin-{1}")
@@ -5,7 +5,6 @@ kotlin {
fromPreset(presets.jvm, 'android')
fromPreset(presets.iosArm64, 'iOS') {
compilations.main.outputKinds('FRAMEWORK')
}
}
@@ -10,26 +10,6 @@ allprojects {
}
}
project('library1') {
apply plugin: 'kotlin-multiplatform'
kotlin { targets { fromPreset(presets.jvm, 'jvm') } }
}
project('library2') {
apply plugin: 'kotlin-multiplatform'
kotlin {
targets { fromPreset(presets.jvm, 'jvm') }
sourceSets {
jvmMain {
dependencies {
implementation project(':library1')
}
}
}
}
}
project('java-project') {
apply plugin: 'java'
@@ -0,0 +1,6 @@
apply plugin: 'kotlin-multiplatform'
kotlin {
targets { fromPreset(presets.jvm, 'jvm') }
}
@@ -0,0 +1,14 @@
apply plugin: 'kotlin-multiplatform'
kotlin {
targets { fromPreset(presets.jvm, 'jvm') }
sourceSets {
jvmMain {
dependencies {
implementation project(':library1')
}
}
}
}
@@ -11,6 +11,12 @@ buildscript {
}
}
repositories {
mavenCentral()
jcenter()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
}
apply plugin: 'kotlin-multiplatform'