[Gradle] Fixup 'kotlinTestSingleDependencyMppCommon' to support new behaviour...
... of deprecated scoped DependenciesMetadata configurations. ^KT-55929 Verification Pending
This commit is contained in:
committed by
Space Team
parent
10a1aab9bb
commit
0ddefa1c02
+13
-5
@@ -13,7 +13,7 @@ import org.junit.jupiter.api.extension.ExtensionContext
|
|||||||
import org.junit.jupiter.params.ParameterizedTest
|
import org.junit.jupiter.params.ParameterizedTest
|
||||||
import org.junit.jupiter.params.provider.*
|
import org.junit.jupiter.params.provider.*
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import java.util.UUID
|
import java.util.*
|
||||||
import java.util.stream.Stream
|
import java.util.stream.Stream
|
||||||
import kotlin.io.path.appendText
|
import kotlin.io.path.appendText
|
||||||
import kotlin.streams.asStream
|
import kotlin.streams.asStream
|
||||||
@@ -372,7 +372,13 @@ class KotlinSpecificDependenciesIT : KGPBaseTest() {
|
|||||||
),
|
),
|
||||||
mapOf(
|
mapOf(
|
||||||
"commonTestImplementationDependenciesMetadata" to listOf("kotlin-test-common", "kotlin-test-annotations-common"),
|
"commonTestImplementationDependenciesMetadata" to listOf("kotlin-test-common", "kotlin-test-annotations-common"),
|
||||||
"commonTestApiDependenciesMetadata" to listOf("!kotlin-test-common", "!kotlin-test-annotations-common"),
|
|
||||||
|
/*
|
||||||
|
implementation, api and compileOnly scoped metadata configurations are deprecated and report the same dependencies.
|
||||||
|
The IDE does not rely on which exact configuration returned the dependencies.
|
||||||
|
*/
|
||||||
|
"commonTestApiDependenciesMetadata" to listOf("kotlin-test-common", "kotlin-test-annotations-common"),
|
||||||
|
"commonTestCompileOnlyDependenciesMetadata" to listOf("kotlin-test-common", "kotlin-test-annotations-common"),
|
||||||
),
|
),
|
||||||
isBuildGradleKts = true
|
isBuildGradleKts = true
|
||||||
)
|
)
|
||||||
@@ -614,6 +620,7 @@ class KotlinSpecificDependenciesIT : KGPBaseTest() {
|
|||||||
val expression = """configurations["$configurationName"].toList()"""
|
val expression = """configurations["$configurationName"].toList()"""
|
||||||
checkPrintedItems(
|
checkPrintedItems(
|
||||||
null,
|
null,
|
||||||
|
configurationName,
|
||||||
expression,
|
expression,
|
||||||
checkModulesInResolutionResult,
|
checkModulesInResolutionResult,
|
||||||
checkModulesNotInResolutionResult,
|
checkModulesNotInResolutionResult,
|
||||||
@@ -635,11 +642,12 @@ class KotlinSpecificDependenciesIT : KGPBaseTest() {
|
|||||||
"org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompileTool<?>"
|
"org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompileTool<?>"
|
||||||
}
|
}
|
||||||
val expression = """(tasks.getByName("$taskName") as $taskClass).libraries.toList()"""
|
val expression = """(tasks.getByName("$taskName") as $taskClass).libraries.toList()"""
|
||||||
checkPrintedItems(subproject, expression, checkModulesInClasspath, checkModulesNotInClasspath, isBuildGradleKts)
|
checkPrintedItems(subproject, taskPath, expression, checkModulesInClasspath, checkModulesNotInClasspath, isBuildGradleKts)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun TestProject.checkPrintedItems(
|
private fun TestProject.checkPrintedItems(
|
||||||
subproject: String?,
|
subproject: String?,
|
||||||
|
dependencyOwner: String,
|
||||||
itemsExpression: String,
|
itemsExpression: String,
|
||||||
checkAnyItemsContains: List<String>,
|
checkAnyItemsContains: List<String>,
|
||||||
checkNoItemContains: List<String>,
|
checkNoItemContains: List<String>,
|
||||||
@@ -666,10 +674,10 @@ class KotlinSpecificDependenciesIT : KGPBaseTest() {
|
|||||||
val itemsLine = output.lines().single { "###$printingTaskName" in it }.substringAfter(printingTaskName)
|
val itemsLine = output.lines().single { "###$printingTaskName" in it }.substringAfter(printingTaskName)
|
||||||
val items = itemsLine.removeSurrounding("[", "]").split(", ").toSet()
|
val items = itemsLine.removeSurrounding("[", "]").split(", ").toSet()
|
||||||
checkAnyItemsContains.forEach { pattern ->
|
checkAnyItemsContains.forEach { pattern ->
|
||||||
assertTrue("Dependencies does not contain $pattern") { items.any { pattern in it } }
|
assertTrue("Dependencies($dependencyOwner) does not contain $pattern") { items.any { pattern in it } }
|
||||||
}
|
}
|
||||||
checkNoItemContains.forEach { pattern ->
|
checkNoItemContains.forEach { pattern ->
|
||||||
assertFalse("Dependencies contain $pattern") { items.any { pattern in it } }
|
assertFalse("Dependencies($dependencyOwner) unexpectedly contains $pattern") { items.any { pattern in it } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user