[Gradle] Implement KT55929MetadataConfigurationsTest to cover KT-55929
^KT-55929 Verification Pending
This commit is contained in:
committed by
Space Team
parent
c0aa6cf873
commit
d6a44c92b5
+3
-1
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLI
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_ANDROID_SOURCE_SET_LAYOUT_VERSION_1_NO_WARN
|
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_ANDROID_SOURCE_SET_LAYOUT_VERSION_1_NO_WARN
|
||||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_ENABLE_CINTEROP_COMMONIZATION
|
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_ENABLE_CINTEROP_COMMONIZATION
|
||||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_ENABLE_GRANULAR_SOURCE_SETS_METADATA
|
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_ENABLE_GRANULAR_SOURCE_SETS_METADATA
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_ENABLE_INTRANSITIVE_METADATA_CONFIGURATION
|
||||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_ENABLE_OPTIMISTIC_NUMBER_COMMONIZATION
|
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_ENABLE_OPTIMISTIC_NUMBER_COMMONIZATION
|
||||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_ENABLE_PLATFORM_INTEGER_COMMONIZATION
|
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_ENABLE_PLATFORM_INTEGER_COMMONIZATION
|
||||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_HIERARCHICAL_STRUCTURE_BY_DEFAULT
|
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_HIERARCHICAL_STRUCTURE_BY_DEFAULT
|
||||||
@@ -391,7 +392,7 @@ internal class PropertiesProvider private constructor(private val project: Proje
|
|||||||
get() = booleanProperty("kotlin.mpp.enableNativeDistributionCommonizationCache") ?: true
|
get() = booleanProperty("kotlin.mpp.enableNativeDistributionCommonizationCache") ?: true
|
||||||
|
|
||||||
val enableIntransitiveMetadataConfiguration: Boolean
|
val enableIntransitiveMetadataConfiguration: Boolean
|
||||||
get() = booleanProperty("kotlin.mpp.enableIntransitiveMetadataConfiguration") ?: false
|
get() = booleanProperty(KOTLIN_MPP_ENABLE_INTRANSITIVE_METADATA_CONFIGURATION) ?: false
|
||||||
|
|
||||||
val enableSlowIdeSourcesJarResolver: Boolean
|
val enableSlowIdeSourcesJarResolver: Boolean
|
||||||
get() = booleanProperty(KOTLIN_MPP_IMPORT_ENABLE_SLOW_SOURCES_JAR_RESOLVER) ?: true
|
get() = booleanProperty(KOTLIN_MPP_IMPORT_ENABLE_SLOW_SOURCES_JAR_RESOLVER) ?: true
|
||||||
@@ -550,6 +551,7 @@ internal class PropertiesProvider private constructor(private val project: Proje
|
|||||||
const val KOTLIN_MPP_ANDROID_SOURCE_SET_LAYOUT_VERSION_1_NO_WARN = "${KOTLIN_MPP_ANDROID_SOURCE_SET_LAYOUT_VERSION}1.nowarn"
|
const val KOTLIN_MPP_ANDROID_SOURCE_SET_LAYOUT_VERSION_1_NO_WARN = "${KOTLIN_MPP_ANDROID_SOURCE_SET_LAYOUT_VERSION}1.nowarn"
|
||||||
const val KOTLIN_MPP_ANDROID_SOURCE_SET_LAYOUT_ANDROID_STYLE_NO_WARN = "kotlin.mpp.androidSourceSetLayoutV2AndroidStyleDirs.nowarn"
|
const val KOTLIN_MPP_ANDROID_SOURCE_SET_LAYOUT_ANDROID_STYLE_NO_WARN = "kotlin.mpp.androidSourceSetLayoutV2AndroidStyleDirs.nowarn"
|
||||||
const val KOTLIN_MPP_IMPORT_ENABLE_SLOW_SOURCES_JAR_RESOLVER = "kotlin.mpp.import.enableSlowSourcesJarResolver"
|
const val KOTLIN_MPP_IMPORT_ENABLE_SLOW_SOURCES_JAR_RESOLVER = "kotlin.mpp.import.enableSlowSourcesJarResolver"
|
||||||
|
const val KOTLIN_MPP_ENABLE_INTRANSITIVE_METADATA_CONFIGURATION = "kotlin.mpp.enableIntransitiveMetadataConfiguration"
|
||||||
const val KOTLIN_NATIVE_DEPENDENCY_PROPAGATION = "kotlin.native.enableDependencyPropagation"
|
const val KOTLIN_NATIVE_DEPENDENCY_PROPAGATION = "kotlin.native.enableDependencyPropagation"
|
||||||
const val KOTLIN_NATIVE_CACHE_ORCHESTRATION = "kotlin.native.cacheOrchestration"
|
const val KOTLIN_NATIVE_CACHE_ORCHESTRATION = "kotlin.native.cacheOrchestration"
|
||||||
const val KOTLIN_MPP_ENABLE_OPTIMISTIC_NUMBER_COMMONIZATION = "kotlin.mpp.enableOptimisticNumberCommonization"
|
const val KOTLIN_MPP_ENABLE_OPTIMISTIC_NUMBER_COMMONIZATION = "kotlin.mpp.enableOptimisticNumberCommonization"
|
||||||
|
|||||||
+113
@@ -0,0 +1,113 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2023 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:Suppress("FunctionName")
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.gradle.regressionTests
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.multiplatformExtension
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.sources.DefaultKotlinSourceSet
|
||||||
|
import org.jetbrains.kotlin.gradle.util.*
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION") /* Configurations are scheduled for removal */
|
||||||
|
class KT55929MetadataConfigurationsTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `test - deprecated metadata configurations - contain dependencies from common source set`() {
|
||||||
|
val project = buildProject {
|
||||||
|
enableDefaultStdlibDependency(false)
|
||||||
|
enableIntransitiveMetadataConfiguration(true)
|
||||||
|
applyMultiplatformPlugin()
|
||||||
|
}
|
||||||
|
|
||||||
|
val kotlin = project.multiplatformExtension
|
||||||
|
|
||||||
|
kotlin.jvm()
|
||||||
|
kotlin.linuxX64()
|
||||||
|
kotlin.linuxArm64()
|
||||||
|
|
||||||
|
kotlin.targetHierarchy.default {
|
||||||
|
common {
|
||||||
|
group("jvmAndLinux") {
|
||||||
|
addCompilations { it.platformType == KotlinPlatformType.jvm }
|
||||||
|
anyLinux()
|
||||||
|
group("linux")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val commonMain = kotlin.sourceSets.getByName("commonMain")
|
||||||
|
val jvmAndLinuxMain = kotlin.sourceSets.getByName("jvmAndLinuxMain")
|
||||||
|
val linuxMain = kotlin.sourceSets.getByName("linuxMain")
|
||||||
|
|
||||||
|
commonMain.dependencies {
|
||||||
|
api("org.sample:commonMainApi:1.0.0")
|
||||||
|
implementation("org.sample:commonMainImplementation:1.0.0")
|
||||||
|
}
|
||||||
|
|
||||||
|
jvmAndLinuxMain.dependencies {
|
||||||
|
implementation("org.sample:jvmAndLinuxMain:1.0.0")
|
||||||
|
}
|
||||||
|
|
||||||
|
linuxMain.dependencies {
|
||||||
|
implementation("org.sample:linuxMain:1.0.0")
|
||||||
|
}
|
||||||
|
|
||||||
|
project.evaluate()
|
||||||
|
|
||||||
|
/* Check linuxMain */
|
||||||
|
listOf(
|
||||||
|
linuxMain.apiMetadataConfigurationName,
|
||||||
|
linuxMain.implementationMetadataConfigurationName,
|
||||||
|
linuxMain.compileOnlyMetadataConfigurationName
|
||||||
|
).forEach { metadataConfigurationName ->
|
||||||
|
project.assertContainsDependencies(
|
||||||
|
metadataConfigurationName,
|
||||||
|
"org.sample:commonMainApi:1.0.0",
|
||||||
|
"org.sample:commonMainImplementation:1.0.0",
|
||||||
|
"org.sample:jvmAndLinuxMain:1.0.0",
|
||||||
|
"org.sample:linuxMain:1.0.0",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check jvmAndLinuxMain */
|
||||||
|
listOf(
|
||||||
|
jvmAndLinuxMain.apiMetadataConfigurationName,
|
||||||
|
jvmAndLinuxMain.implementationMetadataConfigurationName,
|
||||||
|
jvmAndLinuxMain.compileOnlyMetadataConfigurationName
|
||||||
|
).forEach { metadataConfigurationName ->
|
||||||
|
project.assertContainsDependencies(
|
||||||
|
metadataConfigurationName,
|
||||||
|
"org.sample:commonMainApi:1.0.0",
|
||||||
|
"org.sample:commonMainImplementation:1.0.0",
|
||||||
|
"org.sample:jvmAndLinuxMain:1.0.0",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check commonMain */
|
||||||
|
listOf(
|
||||||
|
jvmAndLinuxMain.apiMetadataConfigurationName,
|
||||||
|
jvmAndLinuxMain.implementationMetadataConfigurationName,
|
||||||
|
jvmAndLinuxMain.compileOnlyMetadataConfigurationName
|
||||||
|
).forEach { metadataConfigurationName ->
|
||||||
|
project.assertContainsDependencies(
|
||||||
|
metadataConfigurationName,
|
||||||
|
"org.sample:commonMainApi:1.0.0",
|
||||||
|
"org.sample:commonMainImplementation:1.0.0",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check intransitive configurations */
|
||||||
|
kotlin.sourceSets.forEach { sourceSet ->
|
||||||
|
sourceSet as DefaultKotlinSourceSet
|
||||||
|
project.assertNotContainsDependencies(
|
||||||
|
sourceSet.intransitiveMetadataConfigurationName,
|
||||||
|
"org.sample:commonMainApi:1.0.0"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
-1
@@ -14,11 +14,12 @@ import org.gradle.api.plugins.ExtraPropertiesExtension
|
|||||||
import org.gradle.testfixtures.ProjectBuilder
|
import org.gradle.testfixtures.ProjectBuilder
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
||||||
import org.jetbrains.kotlin.gradle.dsl.kotlinExtension
|
import org.jetbrains.kotlin.gradle.dsl.kotlinExtension
|
||||||
import org.jetbrains.kotlin.gradle.unitTests.kpm.applyKpmPlugin
|
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformAndroidPlugin
|
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformAndroidPlugin
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformJvmPlugin
|
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformJvmPlugin
|
||||||
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider
|
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider.PropertyNames.KOTLIN_MPP_ENABLE_INTRANSITIVE_METADATA_CONFIGURATION
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinPm20ProjectExtension
|
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinPm20ProjectExtension
|
||||||
|
import org.jetbrains.kotlin.gradle.unitTests.kpm.applyKpmPlugin
|
||||||
|
|
||||||
fun buildProject(
|
fun buildProject(
|
||||||
projectBuilder: ProjectBuilder.() -> Unit = { },
|
projectBuilder: ProjectBuilder.() -> Unit = { },
|
||||||
@@ -100,6 +101,10 @@ fun Project.enableHierarchicalStructureByDefault(enabled: Boolean = true) {
|
|||||||
propertiesExtension.set(PropertiesProvider.PropertyNames.KOTLIN_MPP_HIERARCHICAL_STRUCTURE_BY_DEFAULT, enabled.toString())
|
propertiesExtension.set(PropertiesProvider.PropertyNames.KOTLIN_MPP_HIERARCHICAL_STRUCTURE_BY_DEFAULT, enabled.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun Project.enableIntransitiveMetadataConfiguration(enabled: Boolean = true) {
|
||||||
|
propertiesExtension.set(KOTLIN_MPP_ENABLE_INTRANSITIVE_METADATA_CONFIGURATION, enabled.toString())
|
||||||
|
}
|
||||||
|
|
||||||
fun Project.enableDefaultStdlibDependency(enabled: Boolean = true) {
|
fun Project.enableDefaultStdlibDependency(enabled: Boolean = true) {
|
||||||
project.propertiesExtension.set(PropertiesProvider.PropertyNames.KOTLIN_STDLIB_DEFAULT_DEPENDENCY, enabled.toString())
|
project.propertiesExtension.set(PropertiesProvider.PropertyNames.KOTLIN_STDLIB_DEFAULT_DEPENDENCY, enabled.toString())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user