[Gradle] Implement KT55929MetadataConfigurationsTest to leaking stdlib-common
^KT-55929 Verification Pending
This commit is contained in:
committed by
Space Team
parent
d6a44c92b5
commit
10a1aab9bb
+1
@@ -82,6 +82,7 @@ private fun excludeStdlibAndKotlinTestCommonFromPlatformCompilations(project: Pr
|
|||||||
|
|
||||||
// there several JVM-like targets, like KotlinWithJava, or KotlinAndroid, and they don't have common supertype
|
// there several JVM-like targets, like KotlinWithJava, or KotlinAndroid, and they don't have common supertype
|
||||||
// aside from KotlinTarget
|
// aside from KotlinTarget
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
private fun KotlinTarget.excludeStdlibAndKotlinTestCommonFromPlatformCompilations() {
|
private fun KotlinTarget.excludeStdlibAndKotlinTestCommonFromPlatformCompilations() {
|
||||||
compilations.all {
|
compilations.all {
|
||||||
listOfNotNull(
|
listOfNotNull(
|
||||||
|
|||||||
+38
@@ -7,11 +7,14 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.regressionTests
|
package org.jetbrains.kotlin.gradle.regressionTests
|
||||||
|
|
||||||
|
import org.gradle.api.artifacts.component.ModuleComponentIdentifier
|
||||||
|
import org.gradle.kotlin.dsl.repositories
|
||||||
import org.jetbrains.kotlin.gradle.dsl.multiplatformExtension
|
import org.jetbrains.kotlin.gradle.dsl.multiplatformExtension
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
|
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
|
||||||
import org.jetbrains.kotlin.gradle.plugin.sources.DefaultKotlinSourceSet
|
import org.jetbrains.kotlin.gradle.plugin.sources.DefaultKotlinSourceSet
|
||||||
import org.jetbrains.kotlin.gradle.util.*
|
import org.jetbrains.kotlin.gradle.util.*
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
import kotlin.test.fail
|
||||||
|
|
||||||
@Suppress("DEPRECATION") /* Configurations are scheduled for removal */
|
@Suppress("DEPRECATION") /* Configurations are scheduled for removal */
|
||||||
class KT55929MetadataConfigurationsTest {
|
class KT55929MetadataConfigurationsTest {
|
||||||
@@ -110,4 +113,39 @@ class KT55929MetadataConfigurationsTest {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `test - deprecated metadata configurations - do not list stdlib-common - for platform source sets`() {
|
||||||
|
val project = buildProject {
|
||||||
|
enableDefaultStdlibDependency(true)
|
||||||
|
enableIntransitiveMetadataConfiguration(true)
|
||||||
|
applyMultiplatformPlugin()
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val kotlin = project.multiplatformExtension
|
||||||
|
kotlin.targetHierarchy.default()
|
||||||
|
kotlin.linuxX64()
|
||||||
|
kotlin.linuxArm64()
|
||||||
|
|
||||||
|
kotlin.sourceSets.getByName("commonMain").dependencies {
|
||||||
|
implementation(kotlin("stdlib"))
|
||||||
|
}
|
||||||
|
|
||||||
|
project.evaluate()
|
||||||
|
|
||||||
|
val stdlibCommonFound = project.configurations.getByName(
|
||||||
|
kotlin.sourceSets.getByName("linuxX64Main").implementationMetadataConfigurationName
|
||||||
|
).resolvedConfiguration.resolvedArtifacts.any { artifact ->
|
||||||
|
val id = artifact.id.componentIdentifier
|
||||||
|
id is ModuleComponentIdentifier && id.module == "kotlin-stdlib-common"
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stdlibCommonFound) {
|
||||||
|
fail("Unexpectedly resolved stdlib-common for 'linuxX64Main'")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user