[Gradle] Create commonize-kt-57796-twoCInteropCommonizerGroups to cover KT-57796
This commit is contained in:
committed by
Space Team
parent
1e6626338d
commit
59d78b4d96
+14
@@ -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")) {
|
||||
|
||||
+24
@@ -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"))
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
void libapp();
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
plugins {
|
||||
kotlin("multiplatform").apply(false)
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
kotlin.mpp.enableCInteropCommonization=true
|
||||
+27
@@ -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"))
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
void liblinux();
|
||||
+1
@@ -0,0 +1 @@
|
||||
void libmacos();
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
include(":app")
|
||||
include(":lib")
|
||||
Reference in New Issue
Block a user