[Gradle] Test type safe project accessors with KotlinDependencyHandler

KT-58759 Verification Pending
This commit is contained in:
Anton Lakotka
2023-05-18 16:50:34 +02:00
committed by Space Team
parent b3b0f23a50
commit c49f08f427
5 changed files with 65 additions and 0 deletions
@@ -1191,6 +1191,25 @@ open class HierarchicalMppIT : KGPBaseTest() {
}
}
@GradleTest
@GradleTestVersions(minVersion = TestVersions.Gradle.G_7_0)
fun `test type safe project accessors with KotlinDependencyHandler`(gradleVersion: GradleVersion) {
project("mpp-project-with-type-safe-accessors", gradleVersion) {
build("help") {
println(output)
val actualDependencies = output.lineSequence()
.filter { it.startsWith("PROJECT_DEPENDENCY: ") }
.map { it.removePrefix("PROJECT_DEPENDENCY: ") }
.toList()
assertEquals(
listOf(":foo", ":bar"),
actualDependencies
)
}
}
}
private fun TestProject.testDependencyTransformations(
subproject: String? = null,
@@ -0,0 +1,8 @@
plugins {
kotlin("multiplatform")
}
kotlin {
jvm()
linuxX64()
}
@@ -0,0 +1,25 @@
plugins {
kotlin("multiplatform")
}
kotlin {
jvm()
linuxX64()
sourceSets {
commonMain {
dependencies {
api(projects.foo)
api(projects.bar) { }
}
}
}
}
afterEvaluate {
configurations
.getByName("commonMainApi")
.dependencies
.filterIsInstance<ProjectDependency>()
.forEach { println("PROJECT_DEPENDENCY: ${it.dependencyProject.path}") }
}
@@ -0,0 +1,8 @@
plugins {
kotlin("multiplatform")
}
kotlin {
jvm()
linuxX64()
}
@@ -0,0 +1,5 @@
include(":foo")
include(":bar")
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")