[Gradle] Update tests after removing runtimeOnly metadata transformations
Additionally check that all metadata dependencies per scope resolve consistently. It is a side effect after creating GranularMetadata dependency for all compile scopes instead per scope style. ^KT-55230
This commit is contained in:
committed by
Space Team
parent
d28659fdbe
commit
8726360a8e
+2
-3
@@ -1193,14 +1193,13 @@ abstract class AbstractKotlin2JsGradlePluginIT(protected val irBackend: Boolean)
|
||||
| api(project(":base"))
|
||||
| implementation(project(":base"))
|
||||
| compileOnly(project(":base"))
|
||||
| runtimeOnly(project(":base"))
|
||||
| }
|
||||
| }
|
||||
| }
|
||||
|
|
||||
|task("printMetadataFiles") {
|
||||
| doFirst {
|
||||
| listOf("api", "implementation", "compileOnly", "runtimeOnly").forEach { kind ->
|
||||
| listOf("api", "implementation", "compileOnly").forEach { kind ->
|
||||
| val configuration = configurations.getByName(kind + "DependenciesMetadata")
|
||||
| configuration.files.forEach { println("$pathPrefix" + configuration.name + "->" + it.name) }
|
||||
| }
|
||||
@@ -1223,7 +1222,7 @@ abstract class AbstractKotlin2JsGradlePluginIT(protected val irBackend: Boolean)
|
||||
.toSet()
|
||||
|
||||
assertEquals(
|
||||
listOf("api", "implementation", "compileOnly", "runtimeOnly").map {
|
||||
listOf("api", "implementation", "compileOnly").map {
|
||||
"$it$METADATA_CONFIGURATION_NAME_SUFFIX" to expectedFileName
|
||||
}.toSet(),
|
||||
paths
|
||||
|
||||
+7
-9
@@ -919,14 +919,13 @@ class NewMultiplatformIT : BaseGradleIT() {
|
||||
// add these dependencies to check that they are resolved to metadata
|
||||
api 'com.example:sample-lib:1.0'
|
||||
compileOnly 'com.example:sample-lib:1.0'
|
||||
runtimeOnly 'com.example:sample-lib:1.0'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task('printMetadataFiles') {
|
||||
doFirst {
|
||||
['Api', 'Implementation', 'CompileOnly', 'RuntimeOnly'].each { kind ->
|
||||
['Api', 'Implementation', 'CompileOnly'].each { kind ->
|
||||
def configuration = configurations.getByName("commonMain${'$'}kind" + '$METADATA_CONFIGURATION_NAME_SUFFIX')
|
||||
configuration.files.each { println '$pathPrefix' + configuration.name + '->' + it.name }
|
||||
}
|
||||
@@ -947,7 +946,7 @@ class NewMultiplatformIT : BaseGradleIT() {
|
||||
.toSet()
|
||||
|
||||
Assert.assertEquals(
|
||||
listOf("Api", "Implementation", "CompileOnly", "RuntimeOnly").map {
|
||||
listOf("Api", "Implementation", "CompileOnly").map {
|
||||
"commonMain$it$METADATA_CONFIGURATION_NAME_SUFFIX" to expectedFileName
|
||||
}.toSet(),
|
||||
paths
|
||||
@@ -999,14 +998,13 @@ class NewMultiplatformIT : BaseGradleIT() {
|
||||
api 'com.example:sample-lib-nodejs:1.0'
|
||||
implementation 'com.example:sample-lib-nodejs:1.0'
|
||||
compileOnly 'com.example:sample-lib-nodejs:1.0'
|
||||
runtimeOnly 'com.example:sample-lib-nodejs:1.0'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task('printMetadataFiles') {
|
||||
doFirst {
|
||||
['Api', 'Implementation', 'CompileOnly', 'RuntimeOnly'].each { kind ->
|
||||
['Api', 'Implementation', 'CompileOnly'].each { kind ->
|
||||
def configuration = configurations.getByName("nodeJsMain${'$'}kind" + '$METADATA_CONFIGURATION_NAME_SUFFIX')
|
||||
configuration.files.each { println '$pathPrefix' + configuration.name + '->' + it.name }
|
||||
}
|
||||
@@ -1030,7 +1028,7 @@ class NewMultiplatformIT : BaseGradleIT() {
|
||||
.toSet()
|
||||
|
||||
Assert.assertEquals(
|
||||
listOf("Api", "Implementation", "CompileOnly", "RuntimeOnly").map {
|
||||
listOf("Api", "Implementation", "CompileOnly").map {
|
||||
"nodeJsMain$it$METADATA_CONFIGURATION_NAME_SUFFIX" to expectedFileName
|
||||
}.toSet(),
|
||||
paths
|
||||
@@ -1541,10 +1539,10 @@ class NewMultiplatformIT : BaseGradleIT() {
|
||||
.count()
|
||||
)
|
||||
|
||||
// All scoped DependenciesMetadata should resolve consistently into the same version
|
||||
assertContains(">> :app:testExplicitKotlinVersionApiDependenciesMetadata --> kotlin-reflect-1.3.0.jar")
|
||||
assertContains(">> :app:testExplicitKotlinVersionImplementationDependenciesMetadata --> kotlin-reflect-1.2.71.jar")
|
||||
assertContains(">> :app:testExplicitKotlinVersionCompileOnlyDependenciesMetadata --> kotlin-reflect-1.2.70.jar")
|
||||
assertContains(">> :app:testExplicitKotlinVersionRuntimeOnlyDependenciesMetadata --> kotlin-reflect-1.2.60.jar")
|
||||
assertContains(">> :app:testExplicitKotlinVersionImplementationDependenciesMetadata --> kotlin-reflect-1.3.0.jar")
|
||||
assertContains(">> :app:testExplicitKotlinVersionCompileOnlyDependenciesMetadata --> kotlin-reflect-1.3.0.jar")
|
||||
|
||||
assertContains(">> :app:testProjectWithConfigurationApiDependenciesMetadata --> output.txt")
|
||||
}
|
||||
|
||||
+1
-1
@@ -162,7 +162,7 @@ abstract class DefaultKotlinSourceSet @Inject constructor(
|
||||
|
||||
fun getAdditionalVisibleSourceSets(): List<KotlinSourceSet> = getVisibleSourceSetsFromAssociateCompilations(this)
|
||||
|
||||
private fun getDependenciesTransformation(): Iterable<MetadataDependencyTransformation> {
|
||||
internal fun getDependenciesTransformation(): Iterable<MetadataDependencyTransformation> {
|
||||
val metadataDependencyResolutionByModule =
|
||||
compileDependenciesTransformation.metadataDependencyResolutions
|
||||
.associateBy { ModuleIds.fromComponent(project, it.dependency) }
|
||||
|
||||
-3
@@ -76,12 +76,10 @@ class ConfigurationsTest : MultiplatformExtensionTest() {
|
||||
"MainApiDependenciesMetadata",
|
||||
"MainCompileOnlyDependenciesMetadata",
|
||||
"MainImplementationDependenciesMetadata",
|
||||
"MainRuntimeOnlyDependenciesMetadata",
|
||||
|
||||
"TestApiDependenciesMetadata",
|
||||
"TestCompileOnlyDependenciesMetadata",
|
||||
"TestImplementationDependenciesMetadata",
|
||||
"TestRuntimeOnlyDependenciesMetadata",
|
||||
)
|
||||
|
||||
// WASM
|
||||
@@ -99,7 +97,6 @@ class ConfigurationsTest : MultiplatformExtensionTest() {
|
||||
"ApiDependenciesMetadata",
|
||||
"CompileOnlyDependenciesMetadata",
|
||||
"ImplementationDependenciesMetadata",
|
||||
"RuntimeOnlyDependenciesMetadata",
|
||||
)
|
||||
|
||||
// allJs
|
||||
|
||||
+1
-3
@@ -41,8 +41,6 @@ class KT46273JvmTargetAndOrphanTestSourceSetTest : MultiplatformExtensionTest()
|
||||
|
||||
The dependencies' transformation will be called by the IDE during import.
|
||||
*/
|
||||
KotlinDependencyScope.values().forEach { scope ->
|
||||
orphanTestSourceSet.getDependenciesTransformation(scope)
|
||||
}
|
||||
orphanTestSourceSet.getDependenciesTransformation()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user