Implement HierarchicalMppIT.testNativeLeafTestSourceSetsKt46417 to cover ^KT-46417

This commit is contained in:
sebastian.sellmair
2021-05-03 16:58:27 +02:00
committed by teamcityserver
parent c62a965180
commit e8bd8a938f
6 changed files with 70 additions and 9 deletions
@@ -19,6 +19,7 @@ import java.io.File
import java.util.zip.ZipFile
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlin.test.assertTrue
class HierarchicalMppIT : BaseGradleIT() {
@@ -505,12 +506,13 @@ class HierarchicalMppIT : BaseGradleIT() {
}
@Test
fun testCompileOnlyDependencyProcessingForMetadataCompilations() = with(transformNativeTestProjectWithPluginDsl("hierarchical-mpp-project-dependency")) {
publishThirdPartyLib(withGranularMetadata = true)
fun testCompileOnlyDependencyProcessingForMetadataCompilations() =
with(transformNativeTestProjectWithPluginDsl("hierarchical-mpp-project-dependency")) {
publishThirdPartyLib(withGranularMetadata = true)
gradleBuildScript("my-lib-foo").appendText("\ndependencies { \"jvmAndJsMainCompileOnly\"(kotlin(\"test-annotations-common\")) }")
projectDir.resolve("my-lib-foo/src/jvmAndJsMain/kotlin/UseCompileOnlyDependency.kt").writeText(
"""
gradleBuildScript("my-lib-foo").appendText("\ndependencies { \"jvmAndJsMainCompileOnly\"(kotlin(\"test-annotations-common\")) }")
projectDir.resolve("my-lib-foo/src/jvmAndJsMain/kotlin/UseCompileOnlyDependency.kt").writeText(
"""
import kotlin.test.Test
class UseCompileOnlyDependency {
@@ -518,12 +520,12 @@ class HierarchicalMppIT : BaseGradleIT() {
fun myTest() = Unit
}
""".trimIndent()
)
)
build(":my-lib-foo:compileJvmAndJsMainKotlinMetadata") {
assertSuccessful()
build(":my-lib-foo:compileJvmAndJsMainKotlinMetadata") {
assertSuccessful()
}
}
}
@Test
fun testHmppDependenciesInJsTests() {
@@ -619,6 +621,18 @@ class HierarchicalMppIT : BaseGradleIT() {
}
}
@Test
fun testNativeLeafTestSourceSetsKt46417() {
with(Project("kt-46417-ios-test-source-sets")) {
testDependencyTransformations("p2") { reports ->
val report = reports.singleOrNull { it.sourceSetName == "iosArm64Test" && it.scope == "implementation" }
assertNotNull(report, "No single report for 'iosArm64' and implementation scope")
assertEquals(setOf("commonMain", "iosMain"), report.allVisibleSourceSets)
assertTrue(report.groupAndModule.endsWith(":p1"))
}
}
}
private fun Project.testDependencyTransformations(
subproject: String? = null,
check: CompiledProject.(reports: Iterable<DependencyTransformationReport>) -> Unit
@@ -0,0 +1,11 @@
allprojects {
repositories {
mavenCentral()
google()
mavenLocal()
}
}
plugins {
kotlin("multiplatform") apply false
}
@@ -0,0 +1 @@
kotlin.mpp.enableGranularSourceSetsMetadata=true
@@ -0,0 +1,8 @@
plugins {
kotlin("multiplatform")
}
kotlin {
jvm()
ios()
}
@@ -0,0 +1,13 @@
plugins {
kotlin("multiplatform")
}
kotlin {
jvm()
ios()
val commonMain by sourceSets.getting
commonMain.dependencies {
implementation(project(":p1"))
}
}
@@ -0,0 +1,14 @@
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
}
val kotlin_version: String by settings
plugins {
kotlin("multiplatform").version(kotlin_version)
}
}
include(":p1")
include(":p2")