[MPP] Remove obsolete targets from NewMultiplatformIT and ConfigurationCacheIT

^KT-58822
This commit is contained in:
Timofey Solonin
2023-06-15 14:26:04 +02:00
committed by Space Team
parent 078356164b
commit 19c6622ff6
11 changed files with 18 additions and 52 deletions
@@ -70,7 +70,7 @@ class ConfigurationCacheIT : AbstractConfigurationCacheIT() {
@GradleTest @GradleTest
fun testMppWithMavenPublish(gradleVersion: GradleVersion) { fun testMppWithMavenPublish(gradleVersion: GradleVersion) {
project("new-mpp-lib-and-app/sample-lib", gradleVersion) { project("new-mpp-lib-and-app/sample-lib", gradleVersion) {
val publishedTargets = listOf("kotlinMultiplatform", "jvm6", "nodeJs", "linux64", "mingw64", "mingw86") val publishedTargets = listOf("kotlinMultiplatform", "jvm6", "nodeJs", "linux64", "mingw64")
testConfigurationCacheOf( testConfigurationCacheOf(
*(publishedTargets.map { ":publish${it.replaceFirstChar { it.uppercaseChar() }}PublicationToMavenRepository" }.toTypedArray()), *(publishedTargets.map { ":publish${it.replaceFirstChar { it.uppercaseChar() }}PublicationToMavenRepository" }.toTypedArray()),
checkUpToDateOnRebuild = false checkUpToDateOnRebuild = false
@@ -40,7 +40,6 @@ open class NewMultiplatformIT : BaseGradleIT() {
private val gradleVersion = GradleVersionRequired.FOR_MPP_SUPPORT private val gradleVersion = GradleVersionRequired.FOR_MPP_SUPPORT
private val nativeHostTargetName = MPPNativeTargets.current private val nativeHostTargetName = MPPNativeTargets.current
private val unsupportedNativeTargets = MPPNativeTargets.unsupported
private fun Project.targetClassesDir(targetName: String, sourceSetName: String = "main") = private fun Project.targetClassesDir(targetName: String, sourceSetName: String = "main") =
classesDir(sourceSet = "$targetName/$sourceSetName") classesDir(sourceSet = "$targetName/$sourceSetName")
@@ -48,7 +47,7 @@ open class NewMultiplatformIT : BaseGradleIT() {
private data class HmppFlags( private data class HmppFlags(
val hmppSupport: Boolean, val hmppSupport: Boolean,
val enableCompatibilityMetadataArtifact: Boolean, val enableCompatibilityMetadataArtifact: Boolean,
val name: String val name: String,
) { ) {
override fun toString() = name override fun toString() = name
} }
@@ -308,7 +307,7 @@ open class NewMultiplatformIT : BaseGradleIT() {
private fun doTestLibAndAppJsBothCompilers( private fun doTestLibAndAppJsBothCompilers(
libProjectName: String, libProjectName: String,
appProjectName: String, appProjectName: String,
jsCompilerType: KotlinJsCompilerType jsCompilerType: KotlinJsCompilerType,
) { ) {
val libProject = transformProjectWithPluginsDsl(libProjectName, directoryPrefix = "both-js-lib-and-app") val libProject = transformProjectWithPluginsDsl(libProjectName, directoryPrefix = "both-js-lib-and-app")
val appProject = transformProjectWithPluginsDsl(appProjectName, directoryPrefix = "both-js-lib-and-app") val appProject = transformProjectWithPluginsDsl(appProjectName, directoryPrefix = "both-js-lib-and-app")
@@ -883,7 +882,7 @@ open class NewMultiplatformIT : BaseGradleIT() {
fun testMonotonousCheck( fun testMonotonousCheck(
initialSetupForSourceSets: String?, initialSetupForSourceSets: String?,
sourceSetConfigurationChange: String, sourceSetConfigurationChange: String,
expectedErrorHint: String expectedErrorHint: String,
) { ) {
if (initialSetupForSourceSets != null) { if (initialSetupForSourceSets != null) {
gradleBuildScript().appendText( gradleBuildScript().appendText(
@@ -1119,14 +1118,19 @@ open class NewMultiplatformIT : BaseGradleIT() {
@Test @Test
fun testPublishingOnlySupportedNativeTargets() = with(transformNativeTestProject("sample-lib", gradleVersion, "new-mpp-lib-and-app")) { fun testPublishingOnlySupportedNativeTargets() = with(transformNativeTestProject("sample-lib", gradleVersion, "new-mpp-lib-and-app")) {
val publishedVariant = nativeHostTargetName val publishedVariants = MPPNativeTargets.supported
val nonPublishedVariant = unsupportedNativeTargets[0] val nonPublishedVariants = MPPNativeTargets.unsupported
build("publish") { build("publish") {
assertSuccessful() assertSuccessful()
assertFileExists("repo/com/example/sample-lib-$publishedVariant/1.0/sample-lib-$publishedVariant-1.0.klib") assertTrue(publishedVariants.isNotEmpty())
assertNoSuchFile("repo/com/example/sample-lib-$nonPublishedVariant") // check that no artifacts are published for that variant publishedVariants.forEach {
assertFileExists("repo/com/example/sample-lib-$it/1.0/sample-lib-$it-1.0.klib")
}
nonPublishedVariants.forEach {
assertNoSuchFile("repo/com/example/sample-lib-$it") // check that no artifacts are published for that variant
}
// but check that the module metadata contains all variants: // but check that the module metadata contains all variants:
val gradleModuleMetadata = projectDir.resolve("repo/com/example/sample-lib/1.0/sample-lib-1.0.module").readText() val gradleModuleMetadata = projectDir.resolve("repo/com/example/sample-lib/1.0/sample-lib-1.0.module").readText()
@@ -1566,7 +1570,7 @@ open class NewMultiplatformIT : BaseGradleIT() {
} }
val expectedDefaultSourceSets = listOf( val expectedDefaultSourceSets = listOf(
"jvm6", "nodeJs", "mingw64", "mingw86", "linux64", "macos64", "linuxMipsel32", "wasm" "jvm6", "nodeJs", "mingw64", "linux64", "macos64", "wasm"
).flatMapTo(mutableSetOf()) { target -> ).flatMapTo(mutableSetOf()) { target ->
listOf("main", "test").map { compilation -> listOf("main", "test").map { compilation ->
Triple( Triple(
@@ -43,9 +43,9 @@ internal object MPPNativeTargets {
} }
val unsupported = when { val unsupported = when {
HostManager.hostIsMingw -> listOf("macos64") HostManager.hostIsMingw -> setOf("macos64")
HostManager.hostIsLinux -> listOf("macos64", "mingw64") HostManager.hostIsLinux -> setOf("macos64")
HostManager.hostIsMac -> listOf("linuxMipsel32") HostManager.hostIsMac -> emptySet()
else -> error("Unknown host") else -> error("Unknown host")
} }
@@ -23,7 +23,7 @@ kotlin {
} }
} }
// This is for iPhone emulator // This is for iPhone emulator
// Switch here to iosArm64 (or iosArm32) to build library for iPhone device // Switch here to iosArm64 to build library for iPhone device
iosX64("iosSimLib") { iosX64("iosSimLib") {
binaries { binaries {
// framework() // framework()
@@ -39,11 +39,6 @@ kotlin {
fromPreset(presets.mingwX64, 'mingw64') fromPreset(presets.mingwX64, 'mingw64')
fromPreset(presets.macosX64, 'macos64') fromPreset(presets.macosX64, 'macos64')
// We use this library in the cinterop test which includes a Windows x86 target.
fromPreset(presets.mingwX86, 'mingw86')
fromPreset(presets.linuxMipsel32, 'linuxMipsel32')
// Check the DSL constructs in the Groovy DSL: // Check the DSL constructs in the Groovy DSL:
fromPreset(presets.jvm, 'jvm6') { fromPreset(presets.jvm, 'jvm6') {
println "Configuring $targetName" println "Configuring $targetName"
@@ -1,10 +0,0 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package com.example.lib
actual fun expectedFun(): Unit {
id(123)
}
@@ -1,10 +0,0 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package com.example.lib
actual fun expectedFun(): Unit {
id(123)
}
@@ -1,10 +0,0 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package com.example.lib
actual fun expectedFun(): Unit {
id(123)
}