[Gradle] Implement test native project dependencies resolve leniently to cover KT-61466
This commit is contained in:
committed by
Space Team
parent
77feb86a85
commit
8bb64040c0
+31
-4
@@ -13,10 +13,7 @@ import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinDependency
|
|||||||
import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinResolvedBinaryDependency
|
import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinResolvedBinaryDependency
|
||||||
import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinUnresolvedBinaryDependency
|
import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinUnresolvedBinaryDependency
|
||||||
import org.jetbrains.kotlin.gradle.idea.tcs.extras.*
|
import org.jetbrains.kotlin.gradle.idea.tcs.extras.*
|
||||||
import org.jetbrains.kotlin.gradle.idea.testFixtures.tcs.IdeaKotlinDependencyMatcher
|
import org.jetbrains.kotlin.gradle.idea.testFixtures.tcs.*
|
||||||
import org.jetbrains.kotlin.gradle.idea.testFixtures.tcs.assertMatches
|
|
||||||
import org.jetbrains.kotlin.gradle.idea.testFixtures.tcs.binaryCoordinates
|
|
||||||
import org.jetbrains.kotlin.gradle.idea.testFixtures.tcs.getOrFail
|
|
||||||
import org.jetbrains.kotlin.gradle.testbase.*
|
import org.jetbrains.kotlin.gradle.testbase.*
|
||||||
import org.jetbrains.kotlin.gradle.util.*
|
import org.jetbrains.kotlin.gradle.util.*
|
||||||
import org.jetbrains.kotlin.konan.target.HostManager
|
import org.jetbrains.kotlin.konan.target.HostManager
|
||||||
@@ -354,6 +351,36 @@ class MppIdeDependencyResolutionIT : KGPBaseTest() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GradleTest
|
||||||
|
fun `test native project dependencies resolve leniently`(gradleVersion: GradleVersion) {
|
||||||
|
project("kt-61466-lenient-dependency-resolution", gradleVersion) {
|
||||||
|
resolveIdeDependencies(":consumer") { dependencies ->
|
||||||
|
dependencies["commonMain"].assertMatches(
|
||||||
|
kotlinStdlibDependencies,
|
||||||
|
kotlinNativeDistributionDependencies,
|
||||||
|
)
|
||||||
|
|
||||||
|
dependencies["linuxMain"].assertMatches(
|
||||||
|
kotlinStdlibDependencies,
|
||||||
|
kotlinNativeDistributionDependencies,
|
||||||
|
dependsOnDependency(":consumer/commonMain"),
|
||||||
|
dependsOnDependency(":consumer/nativeMain")
|
||||||
|
)
|
||||||
|
|
||||||
|
dependencies["linuxX64Main"].assertMatches(
|
||||||
|
kotlinNativeDistributionDependencies,
|
||||||
|
dependsOnDependency(":consumer/commonMain"),
|
||||||
|
dependsOnDependency(":consumer/nativeMain"),
|
||||||
|
dependsOnDependency(":consumer/linuxMain"),
|
||||||
|
binaryCoordinates("this:does:not-exist"),
|
||||||
|
IdeaKotlinDependencyMatcher("Project Dependency: producer") { dependency ->
|
||||||
|
dependency is IdeaKotlinUnresolvedBinaryDependency && ":producer" in dependency.cause.orEmpty()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun Iterable<IdeaKotlinDependency>.cinteropDependencies() =
|
private fun Iterable<IdeaKotlinDependency>.cinteropDependencies() =
|
||||||
this.filterIsInstance<IdeaKotlinBinaryDependency>().filter {
|
this.filterIsInstance<IdeaKotlinBinaryDependency>().filter {
|
||||||
it.klibExtra?.isInterop == true && !it.isNativeStdlib && !it.isNativeDistribution
|
it.klibExtra?.isInterop == true && !it.isNativeStdlib && !it.isNativeDistribution
|
||||||
|
|||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
plugins {
|
||||||
|
kotlin("multiplatform")
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
linuxX64()
|
||||||
|
linuxArm64()
|
||||||
|
|
||||||
|
sourceSets.commonMain.dependencies {
|
||||||
|
implementation(project(":producer")) // <- does not support any native target
|
||||||
|
implementation("this:does:not-exist:1.0.0") // <- Obviously, does not exist :)
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
plugins {
|
||||||
|
kotlin("multiplatform")
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
jvm()
|
||||||
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
include(":consumer")
|
||||||
|
include(":producer")
|
||||||
Reference in New Issue
Block a user