[Gradle] Sources resolver test for multiple capabilities
If dependency has more than one capability sources still can be resolved. ^KT-63226 In Progress
This commit is contained in:
committed by
Space Team
parent
f266a44356
commit
7c9505d9b6
+28
-4
@@ -8,10 +8,7 @@ package org.jetbrains.kotlin.gradle
|
||||
import org.gradle.util.GradleVersion
|
||||
import org.jetbrains.kotlin.commonizer.CommonizerTarget
|
||||
import org.jetbrains.kotlin.commonizer.identityString
|
||||
import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinBinaryDependency
|
||||
import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinDependency
|
||||
import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinResolvedBinaryDependency
|
||||
import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinUnresolvedBinaryDependency
|
||||
import org.jetbrains.kotlin.gradle.idea.tcs.*
|
||||
import org.jetbrains.kotlin.gradle.idea.tcs.extras.*
|
||||
import org.jetbrains.kotlin.gradle.idea.testFixtures.tcs.*
|
||||
import org.jetbrains.kotlin.gradle.testbase.*
|
||||
@@ -395,6 +392,33 @@ class MppIdeDependencyResolutionIT : KGPBaseTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@GradleTest
|
||||
fun `test resolve sources for dependency with multiple capabilities`(gradleVersion: GradleVersion) {
|
||||
project("kt-63226-multiple-capabilities", gradleVersion) {
|
||||
build(":producer:publish")
|
||||
|
||||
resolveIdeDependencies(":consumer") { dependencies ->
|
||||
dependencies["jvmMain"].getOrFail(
|
||||
binaryCoordinates("test:producer:1.0")
|
||||
.withResolvedSourcesFile("producer-1.0-sources.jar")
|
||||
)
|
||||
|
||||
// according to build.gradle.kts of test project jvmTest should have both artifacts from :producer
|
||||
// one with regular capabilities
|
||||
dependencies["jvmTest"].getOrFail(
|
||||
binaryCoordinates("test:producer:1.0")
|
||||
.withResolvedSourcesFile("producer-1.0-sources.jar")
|
||||
)
|
||||
|
||||
// and another with foo capability
|
||||
dependencies["jvmTest"].getOrFail(
|
||||
binaryCoordinates("test:producer:1.0")
|
||||
.withResolvedSourcesFile("producer-1.0-foo-sources.jar")
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun Iterable<IdeaKotlinDependency>.cinteropDependencies() =
|
||||
this.filterIsInstance<IdeaKotlinBinaryDependency>().filter {
|
||||
it.klibExtra?.isInterop == true && !it.isNativeStdlib && !it.isNativeDistribution
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven(rootDir.resolve("repo"))
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
|
||||
sourceSets.jvmMain.dependencies {
|
||||
implementation("test:producer:1.0")
|
||||
}
|
||||
|
||||
sourceSets.jvmTest.dependencies {
|
||||
implementation("test:producer:1.0") {
|
||||
capabilities {
|
||||
requireCapability("test:foo:1.0")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
plugins {
|
||||
`java-library`
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
group = "test"
|
||||
version = "1.0"
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create("maven", MavenPublication::class.java) {
|
||||
from(components["java"])
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven(rootDir.resolve("repo"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
registerFeature("foo") {
|
||||
withSourcesJar()
|
||||
usingSourceSet(sourceSets.create("foo"))
|
||||
capability("test", "foo", "1.0")
|
||||
}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
public class Foo {
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
public class Main {
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
|
||||
include(":producer")
|
||||
include(":consumer")
|
||||
Reference in New Issue
Block a user