[Gradle, Import] Ignore incompatible test runs for Native targets.
#Fixed KT-34516
This commit is contained in:
+56
@@ -11,6 +11,7 @@ import org.jetbrains.jps.model.java.JavaResourceRootType
|
|||||||
import org.jetbrains.jps.model.java.JavaSourceRootType
|
import org.jetbrains.jps.model.java.JavaSourceRootType
|
||||||
import org.jetbrains.kotlin.config.*
|
import org.jetbrains.kotlin.config.*
|
||||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.MultiplePluginVersionGradleImportingTestCase
|
import org.jetbrains.kotlin.idea.codeInsight.gradle.MultiplePluginVersionGradleImportingTestCase
|
||||||
|
import org.jetbrains.kotlin.konan.target.HostManager
|
||||||
import org.jetbrains.kotlin.platform.CommonPlatforms
|
import org.jetbrains.kotlin.platform.CommonPlatforms
|
||||||
import org.jetbrains.kotlin.platform.js.JsPlatforms
|
import org.jetbrains.kotlin.platform.js.JsPlatforms
|
||||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||||
@@ -886,6 +887,61 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@PluginTargetVersions(gradleVersion = "4.0+", pluginVersion = "1.3.60+")
|
||||||
|
fun testIgnoreIncompatibleNativeTestTasks() {
|
||||||
|
configureByFiles()
|
||||||
|
importProject()
|
||||||
|
|
||||||
|
checkProjectStructure(exhaustiveSourceSourceRootList = false, exhaustiveDependencyList = false, exhaustiveTestsList = true) {
|
||||||
|
module("project")
|
||||||
|
module("project_commonMain") {
|
||||||
|
|
||||||
|
}
|
||||||
|
module("project_commonTest") {
|
||||||
|
externalSystemTestTask("jsBrowserTest", "project:jsTest", "js")
|
||||||
|
externalSystemTestTask("jsNodeTest", "project:jsTest", "js")
|
||||||
|
externalSystemTestTask("jvmTest", "project:jvmTest", "jvm")
|
||||||
|
|
||||||
|
when {
|
||||||
|
HostManager.hostIsMac -> externalSystemTestTask("macosTest", "project:macosTest", "macos")
|
||||||
|
HostManager.hostIsMingw -> externalSystemTestTask("winTest", "project:winTest", "win")
|
||||||
|
HostManager.hostIsLinux -> externalSystemTestTask("linuxTest", "project:linuxTest", "linux")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module("project_jsMain")
|
||||||
|
module("project_jsTest") {
|
||||||
|
externalSystemTestTask("jsBrowserTest", "project:jsTest", "js")
|
||||||
|
externalSystemTestTask("jsNodeTest", "project:jsTest", "js")
|
||||||
|
}
|
||||||
|
|
||||||
|
module("project_jvmMain")
|
||||||
|
module("project_jvmTest") {
|
||||||
|
externalSystemTestTask("jvmTest", "project:jvmTest", "jvm")
|
||||||
|
}
|
||||||
|
|
||||||
|
module("project_macosMain") {
|
||||||
|
}
|
||||||
|
module("project_macosTest") {
|
||||||
|
if (HostManager.hostIsMac) externalSystemTestTask("macosTest", "project:macosTest", "macos")
|
||||||
|
}
|
||||||
|
|
||||||
|
module("project_winMain") {
|
||||||
|
}
|
||||||
|
module("project_winTest") {
|
||||||
|
if (HostManager.hostIsMingw) externalSystemTestTask("winTest", "project:winTest", "win")
|
||||||
|
}
|
||||||
|
|
||||||
|
module("project_linuxMain") {
|
||||||
|
}
|
||||||
|
module("project_linuxTest") {
|
||||||
|
if (HostManager.hostIsLinux) externalSystemTestTask("linuxTest", "project:linuxTest", "linux")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun checkProjectStructure(
|
private fun checkProjectStructure(
|
||||||
exhaustiveModuleList: Boolean = true,
|
exhaustiveModuleList: Boolean = true,
|
||||||
exhaustiveSourceSourceRootList: Boolean = true,
|
exhaustiveSourceSourceRootList: Boolean = true,
|
||||||
|
|||||||
@@ -466,7 +466,7 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService {
|
|||||||
}
|
}
|
||||||
}) ?: listOf(it)
|
}) ?: listOf(it)
|
||||||
}
|
}
|
||||||
return testTasks.mapNotNull {
|
return testTasks.filter { it.enabled }.map {
|
||||||
val name = it.name
|
val name = it.name
|
||||||
val compilation = it.javaClass.getMethodOrNull("getCompilation")?.invoke(it)
|
val compilation = it.javaClass.getMethodOrNull("getCompilation")?.invoke(it)
|
||||||
val compilationName = compilation?.javaClass?.getMethodOrNull("getCompilationName")?.invoke(compilation)?.toString()
|
val compilationName = compilation?.javaClass?.getMethodOrNull("getCompilationName")?.invoke(compilation)?.toString()
|
||||||
|
|||||||
+88
@@ -0,0 +1,88 @@
|
|||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
{{kotlin_plugin_repositories}}
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}")
|
||||||
|
{{extraPluginDependencies}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
{{kotlin_plugin_repositories}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'kotlin-multiplatform'
|
||||||
|
|
||||||
|
group 'com.example'
|
||||||
|
version '0.0.1'
|
||||||
|
|
||||||
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
jvm {
|
||||||
|
}
|
||||||
|
|
||||||
|
js {
|
||||||
|
browser {
|
||||||
|
}
|
||||||
|
nodejs {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
macosX64("macos")
|
||||||
|
mingwX64("win")
|
||||||
|
linuxX64("linux")
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
commonMain {
|
||||||
|
dependencies {
|
||||||
|
implementation kotlin('stdlib-common')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
commonTest {
|
||||||
|
dependencies {
|
||||||
|
implementation kotlin('test-common')
|
||||||
|
implementation kotlin('test-annotations-common')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jvmMain {
|
||||||
|
dependencies {
|
||||||
|
implementation kotlin('stdlib-jdk8')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jvmTest {
|
||||||
|
dependencies {
|
||||||
|
implementation kotlin('test')
|
||||||
|
implementation kotlin('test-junit')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jsMain {
|
||||||
|
dependencies {
|
||||||
|
implementation kotlin('stdlib-js')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jsTest {
|
||||||
|
dependencies {
|
||||||
|
implementation kotlin('test-js')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
macosMain {
|
||||||
|
}
|
||||||
|
macosTest {
|
||||||
|
}
|
||||||
|
winMain {
|
||||||
|
}
|
||||||
|
winTest {
|
||||||
|
}
|
||||||
|
linuxMain {
|
||||||
|
}
|
||||||
|
linuxTest {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
kotlin.code.style=official
|
||||||
Vendored
+2
@@ -0,0 +1,2 @@
|
|||||||
|
rootProject.name = 'project'
|
||||||
|
enableFeaturePreview('GRADLE_METADATA')
|
||||||
Reference in New Issue
Block a user