[mpp, tests] Modernize and simplify new-mpp-lib-with-tests
- Don't use presets (they are deprecated and provoke ERROR, causing build to fail) - Drop two JVM targets (cause issues because ambiguous consumable configuration will be created; proper setup needs disambiguation attribute, but that's too much for this test) - Drop jvmWithJava-target (this test case is used in several places as "just some MPP project", so specific advanced features like jvmWithJava shouldn't be covered here) Refer to KT-60745 for proper jvmWithJava support
This commit is contained in:
committed by
Space Team
parent
a9a6441d2d
commit
34f4e3cbf6
+2
-2
@@ -101,8 +101,8 @@ class BuildCacheRelocationIT : KGPBaseTest() {
|
|||||||
listOf("build"),
|
listOf("build"),
|
||||||
listOf(
|
listOf(
|
||||||
":compileCommonMainKotlinMetadata",
|
":compileCommonMainKotlinMetadata",
|
||||||
":compileKotlinJvmWithJava",
|
":compileKotlinJvmWithoutJava",
|
||||||
":compileTestKotlinJvmWithJava",
|
":compileTestKotlinJvmWithoutJava",
|
||||||
":compileKotlinJs",
|
":compileKotlinJs",
|
||||||
":compileTestKotlinJs"
|
":compileTestKotlinJs"
|
||||||
)
|
)
|
||||||
|
|||||||
+1
-2
@@ -136,7 +136,6 @@ internal class CompilerOptionsIT : KGPBaseTest() {
|
|||||||
|
|
||||||
val compileTasks = listOf(
|
val compileTasks = listOf(
|
||||||
"compileKotlinMetadata",
|
"compileKotlinMetadata",
|
||||||
"compileKotlinJvmWithJava",
|
|
||||||
"compileKotlinJvmWithoutJava",
|
"compileKotlinJvmWithoutJava",
|
||||||
"compileKotlinJs",
|
"compileKotlinJs",
|
||||||
// we do not allow modifying free args for K/N at execution time
|
// we do not allow modifying free args for K/N at execution time
|
||||||
@@ -621,4 +620,4 @@ internal class CompilerOptionsIT : KGPBaseTest() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-20
@@ -421,6 +421,7 @@ open class NewMultiplatformIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Ignore // KT-60745
|
||||||
fun testJvmWithJavaEquivalence() = doTestJvmWithJava(testJavaSupportInJvmTargets = false)
|
fun testJvmWithJavaEquivalence() = doTestJvmWithJava(testJavaSupportInJvmTargets = false)
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -627,31 +628,12 @@ open class NewMultiplatformIT : BaseGradleIT() {
|
|||||||
":compileTestKotlinJs",
|
":compileTestKotlinJs",
|
||||||
":compileKotlinJvmWithoutJava",
|
":compileKotlinJvmWithoutJava",
|
||||||
":compileTestKotlinJvmWithoutJava",
|
":compileTestKotlinJvmWithoutJava",
|
||||||
":compileKotlinJvmWithJava",
|
|
||||||
":compileJava",
|
|
||||||
":compileTestKotlinJvmWithJava",
|
|
||||||
":compileTestJava",
|
|
||||||
// test tasks:
|
// test tasks:
|
||||||
":jsTest", // does not run any actual tests for now
|
":jsTest", // does not run any actual tests for now
|
||||||
":jvmWithoutJavaTest",
|
":jvmWithoutJavaTest",
|
||||||
":test"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
val expectedKotlinOutputFiles = listOf(
|
val expectedKotlinOutputFiles = listOf(
|
||||||
*kotlinClassesDir(sourceSet = "jvmWithJava/main").let {
|
|
||||||
arrayOf(
|
|
||||||
it + "com/example/lib/JavaClassUsageKt.class",
|
|
||||||
it + "com/example/lib/CommonKt.class",
|
|
||||||
it + "META-INF/new-mpp-lib-with-tests.kotlin_module"
|
|
||||||
)
|
|
||||||
},
|
|
||||||
*kotlinClassesDir(sourceSet = "jvmWithJava/test").let {
|
|
||||||
arrayOf(
|
|
||||||
it + "com/example/lib/TestCommonCode.class",
|
|
||||||
it + "com/example/lib/TestWithJava.class",
|
|
||||||
it + "META-INF/new-mpp-lib-with-tests_test.kotlin_module"
|
|
||||||
)
|
|
||||||
},
|
|
||||||
*kotlinClassesDir(sourceSet = "jvmWithoutJava/main").let {
|
*kotlinClassesDir(sourceSet = "jvmWithoutJava/main").let {
|
||||||
arrayOf(
|
arrayOf(
|
||||||
it + "com/example/lib/CommonKt.class",
|
it + "com/example/lib/CommonKt.class",
|
||||||
@@ -676,7 +658,6 @@ open class NewMultiplatformIT : BaseGradleIT() {
|
|||||||
assertTestResults(
|
assertTestResults(
|
||||||
expectedTestResults,
|
expectedTestResults,
|
||||||
"jsNodeTest",
|
"jsNodeTest",
|
||||||
"test", // jvmTest
|
|
||||||
"${targetName}Test"
|
"${targetName}Test"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -161,4 +161,4 @@ private fun BuildResult.assertNoTestsStateFileException() {
|
|||||||
// KT-55134
|
// KT-55134
|
||||||
assertOutputDoesNotContain("Cannot read test tasks state from")
|
assertOutputDoesNotContain("Cannot read test tasks state from")
|
||||||
assertOutputDoesNotContain("Cannot store test tasks state into")
|
assertOutputDoesNotContain("Cannot store test tasks state into")
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-10
@@ -19,15 +19,11 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
jvm("jvmWithoutJava")
|
||||||
fromPreset(presets.jvm, 'jvmWithoutJava')
|
macosX64("macos64")
|
||||||
fromPreset(presets.jvmWithJava, 'jvmWithJava')
|
macosArm64()
|
||||||
fromPreset(presets.macosX64, 'macos64')
|
linuxX64("linux64")
|
||||||
fromPreset(presets.macosArm64, 'macosArm64')
|
mingwX64("mingw64")
|
||||||
fromPreset(presets.linuxX64, 'linux64')
|
|
||||||
fromPreset(presets.mingwX64, 'mingw64')
|
|
||||||
}
|
|
||||||
|
|
||||||
js {
|
js {
|
||||||
nodejs()
|
nodejs()
|
||||||
}
|
}
|
||||||
@@ -61,4 +57,4 @@ kotlin {
|
|||||||
dependsOn nativeMain
|
dependsOn nativeMain
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-8
@@ -9,7 +9,6 @@ repositories {
|
|||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
val jvmWithoutJava = jvm("jvmWithoutJava")
|
val jvmWithoutJava = jvm("jvmWithoutJava")
|
||||||
val jvmWithJava = targetFromPreset(presets["jvmWithJava"])
|
|
||||||
val js = js {
|
val js = js {
|
||||||
nodejs()
|
nodejs()
|
||||||
}
|
}
|
||||||
@@ -26,18 +25,14 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val main by getting
|
jvmWithoutJava.compilations["main"].defaultSourceSet {
|
||||||
val jvmWithoutJavaMain = jvmWithoutJava.compilations["main"].defaultSourceSet
|
|
||||||
configure(listOf(main, jvmWithoutJavaMain)) {
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("stdlib"))
|
implementation(kotlin("stdlib"))
|
||||||
implementation(kotlin("script-runtime"))
|
implementation(kotlin("script-runtime"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val test by getting
|
jvmWithoutJava.compilations["test"].defaultSourceSet {
|
||||||
val jvmWithoutJavaTest = jvmWithoutJava.compilations["test"].defaultSourceSet
|
|
||||||
configure(listOf(test, jvmWithoutJavaTest)) {
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("test-junit"))
|
implementation(kotlin("test-junit"))
|
||||||
}
|
}
|
||||||
@@ -54,4 +49,4 @@ kotlin {
|
|||||||
compilations["main"].defaultSourceSet.dependsOn(nativeMain)
|
compilations["main"].defaultSourceSet.dependsOn(nativeMain)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
package com.example.lib;
|
|
||||||
|
|
||||||
public class JavaClass {
|
|
||||||
|
|
||||||
}
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
package com.example.lib
|
|
||||||
|
|
||||||
actual fun expectedFun() { println(id(1)) }
|
|
||||||
|
|
||||||
fun f() = JavaClass()
|
|
||||||
-11
@@ -1,11 +0,0 @@
|
|||||||
package com.example.lib;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
public class TestJava {
|
|
||||||
@Test
|
|
||||||
public void testJava() {
|
|
||||||
new JavaClass();
|
|
||||||
JavaClassUsageKt.f();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-15
@@ -1,15 +0,0 @@
|
|||||||
package com.example.lib
|
|
||||||
|
|
||||||
import org.junit.Test
|
|
||||||
|
|
||||||
class TestWithJava {
|
|
||||||
@Test
|
|
||||||
fun testJavaClass() {
|
|
||||||
JavaClass()
|
|
||||||
f()
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
val seesJavaTestClass = TestJava::class
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user