[Gradle] Ide Dependency Resolution: Provide capabilities for binary coordinates
^KT-60053 Verification Pending
This commit is contained in:
committed by
Space Team
parent
7af254fbf2
commit
041b424bab
+8
-1
@@ -8,7 +8,7 @@ package org.jetbrains.kotlin.gradle.idea.testFixtures.tcs
|
||||
import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinDependency
|
||||
import kotlin.test.fail
|
||||
|
||||
fun Iterable<IdeaKotlinDependency>.assertMatches(vararg notation: Any?): Iterable<IdeaKotlinDependency> {
|
||||
fun <T : IdeaKotlinDependency> Iterable<T>.assertMatches(vararg notation: Any?): Iterable<T> {
|
||||
val thisList = toList()
|
||||
val matchers = notation.flatMap { buildIdeaKotlinDependencyMatchers(it) }
|
||||
|
||||
@@ -51,3 +51,10 @@ fun Iterable<IdeaKotlinDependency>.assertMatches(vararg notation: Any?): Iterabl
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun <T : IdeaKotlinDependency> Iterable<T>.getOrFail(matcher: IdeaKotlinDependencyMatcher): T {
|
||||
val candidates = filter { matcher.matches(it) }
|
||||
if (candidates.isEmpty()) fail("No dependency matching '$matcher' found")
|
||||
if (candidates.size > 1) fail("Multiple dependencies matching '$matcher' found: ${candidates.map { it.coordinates }}")
|
||||
return candidates.single()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user