Enable KlibBasedMppIT by default and on all host (using Linux targets)
This commit is contained in:
+12
-12
@@ -167,14 +167,14 @@ class HierarchicalMppIT : BaseGradleIT() {
|
|||||||
publishedMetadataJar.checkAllEntryNamesArePresent(
|
publishedMetadataJar.checkAllEntryNamesArePresent(
|
||||||
"META-INF/$MULTIPLATFORM_PROJECT_METADATA_FILE_NAME",
|
"META-INF/$MULTIPLATFORM_PROJECT_METADATA_FILE_NAME",
|
||||||
|
|
||||||
"commonMain/manifest",
|
"commonMain/default/manifest",
|
||||||
"commonMain/linkdata/package_com.example/",
|
"commonMain/default/linkdata/package_com.example/",
|
||||||
|
|
||||||
"jvmAndJsMain/manifest",
|
"jvmAndJsMain/default/manifest",
|
||||||
"jvmAndJsMain/linkdata/package_com.example/",
|
"jvmAndJsMain/default/linkdata/package_com.example/",
|
||||||
|
|
||||||
"linuxAndJsMain/manifest",
|
"linuxAndJsMain/default/manifest",
|
||||||
"linuxAndJsMain/linkdata/package_com.example/"
|
"linuxAndJsMain/default/linkdata/package_com.example/"
|
||||||
)
|
)
|
||||||
|
|
||||||
val parsedProjectStructureMetadata: KotlinProjectStructureMetadata = publishedMetadataJar.getProjectStructureMetadata()
|
val parsedProjectStructureMetadata: KotlinProjectStructureMetadata = publishedMetadataJar.getProjectStructureMetadata()
|
||||||
@@ -205,14 +205,14 @@ class HierarchicalMppIT : BaseGradleIT() {
|
|||||||
publishedMetadataJar.checkAllEntryNamesArePresent(
|
publishedMetadataJar.checkAllEntryNamesArePresent(
|
||||||
"META-INF/$MULTIPLATFORM_PROJECT_METADATA_FILE_NAME",
|
"META-INF/$MULTIPLATFORM_PROJECT_METADATA_FILE_NAME",
|
||||||
|
|
||||||
"commonMain/manifest",
|
"commonMain/default/manifest",
|
||||||
"commonMain/linkdata/package_com.example.bar/",
|
"commonMain/default/linkdata/package_com.example.bar/",
|
||||||
|
|
||||||
"jvmAndJsMain/manifest",
|
"jvmAndJsMain/default/manifest",
|
||||||
"jvmAndJsMain/linkdata/package_com.example.bar/",
|
"jvmAndJsMain/default/linkdata/package_com.example.bar/",
|
||||||
|
|
||||||
"linuxAndJsMain/manifest",
|
"linuxAndJsMain/default/manifest",
|
||||||
"linuxAndJsMain/linkdata/package_com.example.bar/"
|
"linuxAndJsMain/default/linkdata/package_com.example.bar/"
|
||||||
)
|
)
|
||||||
|
|
||||||
val parsedProjectStructureMetadata: KotlinProjectStructureMetadata = publishedMetadataJar.getProjectStructureMetadata()
|
val parsedProjectStructureMetadata: KotlinProjectStructureMetadata = publishedMetadataJar.getProjectStructureMetadata()
|
||||||
|
|||||||
+7
-12
@@ -12,10 +12,6 @@ import java.io.File
|
|||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
import kotlin.test.assertFalse
|
import kotlin.test.assertFalse
|
||||||
|
|
||||||
/** FIXME (sergey.igushkin): please enable these tests back as soon as the Kotlin/Native version that is bundled with the
|
|
||||||
* Kotlin distribution supports compilation to klib and targetless klibs.
|
|
||||||
*/
|
|
||||||
@Ignore
|
|
||||||
class KlibBasedMppIT : BaseGradleIT() {
|
class KlibBasedMppIT : BaseGradleIT() {
|
||||||
override val defaultGradleVersion = GradleVersionRequired.AtLeast("6.0")
|
override val defaultGradleVersion = GradleVersionRequired.AtLeast("6.0")
|
||||||
|
|
||||||
@@ -54,8 +50,6 @@ class KlibBasedMppIT : BaseGradleIT() {
|
|||||||
private val dependencyModuleName = "project-dep"
|
private val dependencyModuleName = "project-dep"
|
||||||
|
|
||||||
private fun testBuildWithDependency(configureDependency: Project.() -> Unit) = with(Project("common-klib-lib-and-app")) {
|
private fun testBuildWithDependency(configureDependency: Project.() -> Unit) = with(Project("common-klib-lib-and-app")) {
|
||||||
Assume.assumeTrue(HostManager.hostIsMac)
|
|
||||||
|
|
||||||
embedProject(Project("common-klib-lib-and-app"), renameTo = dependencyModuleName)
|
embedProject(Project("common-klib-lib-and-app"), renameTo = dependencyModuleName)
|
||||||
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
|
||||||
|
|
||||||
@@ -75,10 +69,10 @@ class KlibBasedMppIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
""".trimIndent())
|
""".trimIndent())
|
||||||
|
|
||||||
projectDir.resolve("src/iosMain/kotlin/LibIosMainUsage.kt").appendText("\n" + """
|
projectDir.resolve("src/linuxMain/kotlin/LibLinuxMainUsage.kt").appendText("\n" + """
|
||||||
package com.h0tk3y.hmpp.klib.demo.test
|
package com.h0tk3y.hmpp.klib.demo.test
|
||||||
|
|
||||||
import com.projectdep.libIosMainFun as libFun
|
import com.projectdep.libLinuxMainFun as libFun
|
||||||
|
|
||||||
private fun useProjectDep() {
|
private fun useProjectDep() {
|
||||||
libFun()
|
libFun()
|
||||||
@@ -87,7 +81,7 @@ class KlibBasedMppIT : BaseGradleIT() {
|
|||||||
|
|
||||||
val tasksToExecute = listOf(
|
val tasksToExecute = listOf(
|
||||||
":compileJvmAndJsMainKotlinMetadata",
|
":compileJvmAndJsMainKotlinMetadata",
|
||||||
":compileIosMainKotlinMetadata"
|
":compileLinuxMainKotlinMetadata"
|
||||||
)
|
)
|
||||||
|
|
||||||
build("assemble") {
|
build("assemble") {
|
||||||
@@ -95,8 +89,9 @@ class KlibBasedMppIT : BaseGradleIT() {
|
|||||||
|
|
||||||
assertTasksExecuted(*tasksToExecute.toTypedArray())
|
assertTasksExecuted(*tasksToExecute.toTypedArray())
|
||||||
|
|
||||||
assertFileExists("build/classes/kotlin/metadata/jvmAndJsMain/manifest")
|
assertFileExists("build/classes/kotlin/metadata/commonMain/default/manifest")
|
||||||
assertFileExists("build/classes/kotlin/metadata/iosMain/${projectName}_iosMain.klib")
|
assertFileExists("build/classes/kotlin/metadata/jvmAndJsMain/default/manifest")
|
||||||
|
assertFileExists("build/classes/kotlin/metadata/linuxMain/${projectName}_linuxMain.klib")
|
||||||
|
|
||||||
// Check that the common and JVM+JS source sets don't receive the Kotlin/Native stdlib in the classpath:
|
// Check that the common and JVM+JS source sets don't receive the Kotlin/Native stdlib in the classpath:
|
||||||
run {
|
run {
|
||||||
@@ -155,7 +150,7 @@ class KlibBasedMppIT : BaseGradleIT() {
|
|||||||
|
|
||||||
setupDependencies(this@with)
|
setupDependencies(this@with)
|
||||||
|
|
||||||
val compileNativeMetadataTaskName = "compileIosMainKotlinMetadata"
|
val compileNativeMetadataTaskName = "compileLinuxMainKotlinMetadata"
|
||||||
build(":$compileNativeMetadataTaskName") {
|
build(":$compileNativeMetadataTaskName") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-3
@@ -15,7 +15,8 @@ kotlin {
|
|||||||
jvm()
|
jvm()
|
||||||
js()
|
js()
|
||||||
|
|
||||||
ios()
|
linuxX64()
|
||||||
|
linuxArm64()
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
val commonMain by getting {
|
val commonMain by getting {
|
||||||
@@ -24,6 +25,10 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val linuxMain by creating {
|
||||||
|
dependsOn(commonMain)
|
||||||
|
}
|
||||||
|
|
||||||
val jvmAndJsMain by creating {
|
val jvmAndJsMain by creating {
|
||||||
dependsOn(commonMain)
|
dependsOn(commonMain)
|
||||||
}
|
}
|
||||||
@@ -41,6 +46,10 @@ kotlin {
|
|||||||
implementation(kotlin("stdlib-js"))
|
implementation(kotlin("stdlib-js"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configure(listOf(linuxX64(), linuxArm64())) {
|
||||||
|
compilations["main"].defaultSourceSet.dependsOn(linuxMain)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,8 +61,8 @@ publishing {
|
|||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
val skipCompilationOfTargets = setOf(
|
val skipCompilationOfTargets = setOf(
|
||||||
"iosArm64",
|
"linuxX64",
|
||||||
"iosX64"
|
"linuxArm64"
|
||||||
)
|
)
|
||||||
all {
|
all {
|
||||||
val target = name.removePrefix("compileKotlin").decapitalize()
|
val target = name.removePrefix("compileKotlin").decapitalize()
|
||||||
|
|||||||
+7
-2
@@ -1,3 +1,8 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.h0tk3y.hmpp.klib.demo
|
package com.h0tk3y.hmpp.klib.demo
|
||||||
|
|
||||||
import kotlinx.cinterop.CArrayPointer
|
import kotlinx.cinterop.CArrayPointer
|
||||||
@@ -9,9 +14,9 @@ actual class LibCommonMainExpect : LibCommonMainIface {
|
|||||||
println(CArrayPointer::class)
|
println(CArrayPointer::class)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun additionalFunInIosActual() {
|
fun additionalFunInLinuxActual() {
|
||||||
println("additional fun in lib iosMain")
|
println("additional fun in lib iosMain")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun libIosMainFun(): LibCommonMainIface = LibCommonMainExpect()
|
fun libLinuxMainFun(): LibCommonMainIface = LibCommonMainExpect()
|
||||||
Reference in New Issue
Block a user