[Gradle] Create commonize-kt-57796-twoCInteropCommonizerGroups to cover KT-57796

This commit is contained in:
Sebastian Sellmair
2023-04-06 11:27:19 +02:00
committed by Space Team
parent 1e6626338d
commit 59d78b4d96
12 changed files with 81 additions and 0 deletions
@@ -700,6 +700,20 @@ open class CommonizerIT : BaseGradleIT() {
}
}
@Test
fun `test KT-57796 commonization with two cinterop commonizer groups`() {
with(Project("commonize-kt-57796-twoCInteropCommonizerGroups")) {
build(":app:commonizeCIntero") {
assertSuccessful()
assertTasksExecuted(":lib:transformCommonMainCInteropDependenciesMetadata")
assertTasksExecuted(":lib:commonizeCInterop")
assertTasksExecuted(":app:transformCommonMainCInteropDependenciesMetadata")
assertTasksExecuted(":app:commonizeCInterop")
}
}
}
@Test
fun `test KT-56729 commonization with library containing two roots`() {
with(Project("commonize-kt-56729-consume-library-with-two-roots")) {
@@ -0,0 +1,24 @@
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
plugins {
kotlin("multiplatform")
}
kotlin {
linuxX64()
linuxArm64()
macosX64()
macosArm64()
targetHierarchy.default()
targets.withType<KotlinNativeTarget>().all {
compilations.getByName("main").cinterops.create("libapp") {
headers(file("libapp.h"))
}
}
sourceSets.commonMain.get().dependencies {
implementation(project(":lib"))
}
}
@@ -0,0 +1,10 @@
plugins {
kotlin("multiplatform").apply(false)
}
allprojects {
repositories {
mavenLocal()
mavenCentral()
}
}
@@ -0,0 +1,27 @@
plugins {
kotlin("multiplatform")
}
kotlin {
linuxX64()
linuxArm64()
macosX64()
macosArm64()
targetHierarchy.default()
/* first cinterop commonizer group */
listOf(macosX64(), macosArm64()).forEach { target ->
target.compilations.getByName("main").cinterops.create("libmacos") {
headers(file("libmacos.h"))
}
}
/* Second cinterop commonizer group */
listOf(linuxX64(), linuxArm64()).forEach { target ->
target.compilations.getByName("main").cinterops.create("liblinux") {
headers(file("liblinux.h"))
}
}
}