CommonizerIT: Implement additional test KT-46142 standalone native source set
^46142 Before this test, the behaviour was tested as integration test in the IDE. This Gradle integration test will detect issues even earlier.
This commit is contained in:
committed by
TeamCityServer
parent
ee4a1d173d
commit
13b1664edf
+9
-1
@@ -244,7 +244,15 @@ class CommonizerIT : BaseGradleIT() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `test KT-46234 intermediate source set with only one native target`() {
|
fun `test KT-46234 intermediate source set with only one native target`() {
|
||||||
|
`test single native platform`("commonize-kt-46234-singleNativeTarget")
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `test KT-46142 standalone native source set`() {
|
||||||
|
`test single native platform`("commonize-kt-46142-singleNativeTarget")
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun `test single native platform`(project: String) {
|
||||||
val posixInImplementationMetadataConfigurationRegex = Regex(""".*implementationMetadataConfiguration:.*([pP])osix""")
|
val posixInImplementationMetadataConfigurationRegex = Regex(""".*implementationMetadataConfiguration:.*([pP])osix""")
|
||||||
val posixInIntransitiveMetadataConfigurationRegex = Regex(""".*intransitiveMetadataConfiguration:.*([pP])osix""")
|
val posixInIntransitiveMetadataConfigurationRegex = Regex(""".*intransitiveMetadataConfiguration:.*([pP])osix""")
|
||||||
|
|
||||||
@@ -258,7 +266,7 @@ class CommonizerIT : BaseGradleIT() {
|
|||||||
line.matches(posixInIntransitiveMetadataConfigurationRegex)
|
line.matches(posixInIntransitiveMetadataConfigurationRegex)
|
||||||
}
|
}
|
||||||
|
|
||||||
with(Project("commonize-kt-46234-singleNativeTarget")) {
|
with(Project(project)) {
|
||||||
build(":p1:listNativePlatformMainDependencies", "-Pkotlin.mpp.enableIntransitiveMetadataConfiguration=false") {
|
build(":p1:listNativePlatformMainDependencies", "-Pkotlin.mpp.enableIntransitiveMetadataConfiguration=false") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
|
|
||||||
|
|||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
plugins {
|
||||||
|
kotlin("multiplatform") apply false
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
kotlin.mpp.enableGranularSourceSetsMetadata=true
|
||||||
|
kotlin.native.enableDependencyPropagation=false
|
||||||
|
kotlin.mpp.enableIntransitiveMetadataConfiguration=true
|
||||||
+62
@@ -0,0 +1,62 @@
|
|||||||
|
import org.jetbrains.kotlin.com.intellij.openapi.util.SystemInfo.*
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
||||||
|
|
||||||
|
operator fun KotlinSourceSet.invoke(builder: SourceSetHierarchyBuilder.() -> Unit): KotlinSourceSet {
|
||||||
|
SourceSetHierarchyBuilder(this).builder()
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
class SourceSetHierarchyBuilder(private val node: KotlinSourceSet) {
|
||||||
|
operator fun KotlinSourceSet.unaryMinus() = this.dependsOn(node)
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
kotlin("multiplatform")
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
|
||||||
|
val nativePlatform = when {
|
||||||
|
isMac -> macosX64("nativePlatform")
|
||||||
|
isLinux -> linuxX64("nativePlatform")
|
||||||
|
isWindows -> mingwX64("nativePlatform")
|
||||||
|
else -> throw IllegalStateException("Unsupported host")
|
||||||
|
}
|
||||||
|
|
||||||
|
jvm()
|
||||||
|
|
||||||
|
val commonMain by sourceSets.getting
|
||||||
|
val jvmMain by sourceSets.getting
|
||||||
|
val nativePlatformMain by sourceSets.getting
|
||||||
|
|
||||||
|
commonMain {
|
||||||
|
-jvmMain
|
||||||
|
-nativePlatformMain
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register("listNativePlatformMainDependencies") {
|
||||||
|
doLast {
|
||||||
|
|
||||||
|
val implementationMetadataConfigurationDependencies = project.configurations.getByName(
|
||||||
|
nativePlatformMain.implementationMetadataConfigurationName
|
||||||
|
).files
|
||||||
|
|
||||||
|
val intransitiveMetadataConfigurationDependencies = project.configurations.findByName(
|
||||||
|
"nativePlatformMainIntransitiveDependenciesMetadata"
|
||||||
|
)?.files.orEmpty()
|
||||||
|
|
||||||
|
val dependencies = implementationMetadataConfigurationDependencies +
|
||||||
|
intransitiveMetadataConfigurationDependencies
|
||||||
|
|
||||||
|
logger.quiet("NativePlatformMainDependency | Count: ${dependencies.size}")
|
||||||
|
|
||||||
|
implementationMetadataConfigurationDependencies.forEach { dependencyFile ->
|
||||||
|
logger.quiet("implementationMetadataConfiguration: ${dependencyFile.path}")
|
||||||
|
}
|
||||||
|
|
||||||
|
intransitiveMetadataConfigurationDependencies.forEach { dependencyFile ->
|
||||||
|
logger.quiet("intransitiveMetadataConfiguration: ${dependencyFile.path}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import platform.posix.usleep
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
usleep(100)
|
||||||
|
}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
val kotlin_version: String by settings
|
||||||
|
plugins {
|
||||||
|
kotlin("multiplatform").version(kotlin_version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
include(":p1")
|
||||||
Reference in New Issue
Block a user