[Gradle] [MPP] Implement integration test to cover ^KT-48856
This commit is contained in:
committed by
Space
parent
9799ad7bd8
commit
e7d8804bdf
+21
-1
@@ -386,6 +386,27 @@ class CommonizerIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `test KT-48856 single native target dependency propagation - test source set - cinterop`() {
|
||||||
|
fun CompiledProject.containsCinteropDependency(): Boolean {
|
||||||
|
val nativeMainContainsCInteropDependencyRegex = Regex(""".*Dependency:.*cinterop-sampleInterop.*""")
|
||||||
|
return output.lineSequence().any { line ->
|
||||||
|
line.matches(nativeMainContainsCInteropDependencyRegex)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
with(Project("commonize-kt-48856-singleNativeTargetPropagation-testSourceSet")) {
|
||||||
|
build("listNativeTestDependencies") {
|
||||||
|
assertSuccessful()
|
||||||
|
assertTrue(containsCinteropDependency(), "Expected sourceSet 'nativeTest' to list cinterop dependency")
|
||||||
|
}
|
||||||
|
|
||||||
|
build("assemble") {
|
||||||
|
assertSuccessful()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test KT-46856 filename too long - all native targets configured`() {
|
fun `test KT-46856 filename too long - all native targets configured`() {
|
||||||
with(Project("commonize-kt-46856-all-targets")) {
|
with(Project("commonize-kt-46856-all-targets")) {
|
||||||
@@ -663,4 +684,3 @@ private object CommonizableTargets {
|
|||||||
else -> fail("Unsupported os: ${os.name}")
|
else -> fail("Unsupported os: ${os.name}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+40
@@ -0,0 +1,40 @@
|
|||||||
|
import org.jetbrains.kotlin.gradle.plugin.sources.DefaultKotlinSourceSet
|
||||||
|
import org.jetbrains.kotlin.konan.target.HostManager
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
kotlin("multiplatform")
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
mavenLocal()
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
val platformTarget = when {
|
||||||
|
HostManager.hostIsMac -> macosX64("platform")
|
||||||
|
HostManager.hostIsMingw -> mingwX64("platform")
|
||||||
|
HostManager.hostIsLinux -> linuxX64("platform")
|
||||||
|
else -> error("Unexpected host: ${HostManager.host}")
|
||||||
|
}
|
||||||
|
|
||||||
|
platformTarget.compilations["main"].cinterops.create("sampleInterop") {
|
||||||
|
header(file("src/nativeInterop/cinterop/sampleInterop.h"))
|
||||||
|
}
|
||||||
|
|
||||||
|
val platformTest by sourceSets.getting
|
||||||
|
val nativeTest = sourceSets.create("nativeTest")
|
||||||
|
platformTest.dependsOn(nativeTest)
|
||||||
|
|
||||||
|
tasks.create("listNativeTestDependencies") {
|
||||||
|
nativeTest as DefaultKotlinSourceSet
|
||||||
|
val nativeTestMetadataConfiguration = configurations[nativeTest.intransitiveMetadataConfigurationName]
|
||||||
|
dependsOn(nativeTestMetadataConfiguration)
|
||||||
|
|
||||||
|
doFirst {
|
||||||
|
nativeTestMetadataConfiguration.files.forEach { dependencyFile ->
|
||||||
|
logger.quiet("Dependency: ${dependencyFile.path}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
kotlin.code.style=official
|
||||||
|
kotlin.js.generate.executable.default=false
|
||||||
|
kotlin.mpp.enableGranularSourceSetsMetadata=true
|
||||||
|
kotlin.mpp.enableCInteropCommonization=true
|
||||||
|
kotlin.native.enableDependencyPropagation=false
|
||||||
|
kotlin.mpp.enableIntransitiveMetadataConfiguration=true
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
val kotlin_version: String by settings
|
||||||
|
plugins {
|
||||||
|
kotlin("multiplatform").version(kotlin_version)
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
void sampleInterop() {
|
||||||
|
};
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import sampleInterop.sampleInterop
|
||||||
|
|
||||||
|
object NativeIntermediateTest {
|
||||||
|
fun x() = sampleInterop()
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import sampleInterop.sampleInterop
|
||||||
|
|
||||||
|
object NativeMain {
|
||||||
|
fun x() = sampleInterop()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user