[Gradle][Native] Implement "kt-55071-compileSharedNative-withDefaultParameters" IT
^KT-55071 Verification Pending
This commit is contained in:
committed by
Space Team
parent
752ff04245
commit
4c62b3b46b
+18
@@ -979,6 +979,24 @@ class HierarchicalMppIT : KGPBaseTest() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GradleTest
|
||||||
|
@DisplayName("KT-55071: Shared Native Compilations: Use default parameters declared in dependsOn source set")
|
||||||
|
fun `test shared native compilation with default parameters declared in dependsOn source set`(gradleVersion: GradleVersion) {
|
||||||
|
with(project("kt-55071-compileSharedNative-withDefaultParameters", gradleVersion = gradleVersion)) {
|
||||||
|
build(":producer:publish") {
|
||||||
|
assertTasksExecuted(":producer:compileCommonMainKotlinMetadata")
|
||||||
|
assertTasksExecuted(":producer:compileSecondCommonMainKotlinMetadata")
|
||||||
|
assertTasksExecuted(":producer:compileNativeMainKotlinMetadata")
|
||||||
|
}
|
||||||
|
|
||||||
|
build(":consumer:assemble") {
|
||||||
|
assertTasksExecuted(":consumer:compileCommonMainKotlinMetadata")
|
||||||
|
assertTasksExecuted(":consumer:compileNativeMainKotlinMetadata")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun TestProject.testDependencyTransformations(
|
private fun TestProject.testDependencyTransformations(
|
||||||
subproject: String? = null,
|
subproject: String? = null,
|
||||||
check: BuildResult.(reports: Iterable<DependencyTransformationReport>) -> Unit
|
check: BuildResult.(reports: Iterable<DependencyTransformationReport>) -> Unit
|
||||||
|
|||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
+45
@@ -0,0 +1,45 @@
|
|||||||
|
@file:Suppress("OPT_IN_USAGE")
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
kotlin("multiplatform")
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
maven(project(":producer").buildDir.resolve("repository"))
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
jvm()
|
||||||
|
js().browser()
|
||||||
|
linuxX64()
|
||||||
|
linuxArm64()
|
||||||
|
|
||||||
|
val commonMain by sourceSets.getting
|
||||||
|
val nativeMain by sourceSets.creating
|
||||||
|
val jvmAndJsMain by sourceSets.creating
|
||||||
|
val jvmMain by sourceSets.getting
|
||||||
|
val jsMain by sourceSets.getting
|
||||||
|
val linuxX64Main by sourceSets.getting
|
||||||
|
val linuxArm64Main by sourceSets.getting
|
||||||
|
|
||||||
|
commonMain.let {
|
||||||
|
nativeMain.dependsOn(it)
|
||||||
|
jvmAndJsMain.dependsOn(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
nativeMain.let {
|
||||||
|
linuxArm64Main.dependsOn(it)
|
||||||
|
linuxX64Main.dependsOn(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
jvmAndJsMain.let {
|
||||||
|
jvmMain.dependsOn(it)
|
||||||
|
jsMain.dependsOn(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
commonMain.dependencies {
|
||||||
|
implementation("org.jetbrains.sample:producer:1.0.0")
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package consumer
|
||||||
|
|
||||||
|
import producer.Producer
|
||||||
|
|
||||||
|
fun consumerCommonMain() = Producer().foo("")
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package consumer
|
||||||
|
|
||||||
|
import producer.Producer
|
||||||
|
|
||||||
|
fun consumerJvmAndJsMain() = Producer().foo("")
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package consumer
|
||||||
|
|
||||||
|
import producer.Producer
|
||||||
|
|
||||||
|
fun consumerNativeMain() = Producer().foo("")
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
kotlin.code.style=official
|
||||||
|
kotlin.js.generate.executable.default=false
|
||||||
|
kotlin.js.compiler=ir
|
||||||
+59
@@ -0,0 +1,59 @@
|
|||||||
|
@file:Suppress("OPT_IN_USAGE")
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
kotlin("multiplatform")
|
||||||
|
`maven-publish`
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
jvm()
|
||||||
|
js().browser()
|
||||||
|
linuxX64()
|
||||||
|
linuxArm64()
|
||||||
|
|
||||||
|
val commonMain by sourceSets.getting
|
||||||
|
val nativeMain by sourceSets.creating
|
||||||
|
val secondCommonMain by sourceSets.creating
|
||||||
|
val jvmAndJsMain by sourceSets.creating
|
||||||
|
val jvmMain by sourceSets.getting
|
||||||
|
val jsMain by sourceSets.getting
|
||||||
|
val linuxX64Main by sourceSets.getting
|
||||||
|
val linuxArm64Main by sourceSets.getting
|
||||||
|
|
||||||
|
commonMain.let {
|
||||||
|
secondCommonMain.dependsOn(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
secondCommonMain.let {
|
||||||
|
nativeMain.dependsOn(it)
|
||||||
|
jvmAndJsMain.dependsOn(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
nativeMain.let {
|
||||||
|
linuxArm64Main.dependsOn(it)
|
||||||
|
linuxX64Main.dependsOn(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
jvmAndJsMain.let {
|
||||||
|
jvmMain.dependsOn(it)
|
||||||
|
jsMain.dependsOn(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
group = "org.jetbrains.sample"
|
||||||
|
version = "1.0.0"
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
repositories {
|
||||||
|
maven(buildDir.resolve("repository")) {
|
||||||
|
name = "build"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package producer
|
||||||
|
|
||||||
|
expect class Producer constructor() {
|
||||||
|
fun foo(value: String, optionalParameter: Boolean = false)
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package producer
|
||||||
|
|
||||||
|
actual class Producer {
|
||||||
|
actual fun foo(value: String, optionalParameter: Boolean) = Unit
|
||||||
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
package producer
|
||||||
|
|
||||||
|
actual class Producer {
|
||||||
|
actual fun foo(value: String, optionalParameter: Boolean) = Unit
|
||||||
|
}
|
||||||
|
|
||||||
|
fun inProducerNativeMain() {
|
||||||
|
producerSecondCommonMain()
|
||||||
|
Producer().foo("") // <- No value passed for parameter 'optionalParameter'
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
package producer
|
||||||
|
|
||||||
|
internal fun producerSecondCommonMain() = Unit
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
include(":producer")
|
||||||
|
include(":consumer")
|
||||||
Reference in New Issue
Block a user