[Gradle] Implement IdeSourcesAndDocumentationResolutionTest

^KT-55289 Verification Pending
This commit is contained in:
Sebastian Sellmair
2022-12-07 15:51:51 +01:00
committed by Space Team
parent 7b2c4856c4
commit 7a89f4087a
4 changed files with 181 additions and 1 deletions
@@ -0,0 +1,22 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.gradle.idea.testFixtures.tcs
import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinBinaryCoordinates
import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinBinaryDependency
import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinDependency
internal class IdeaBinaryCoordinatesInstanceMatcher(
private val coordinates: IdeaKotlinBinaryCoordinates
) : IdeaKotlinDependencyMatcher {
override val description: String
get() = "coordinates:$coordinates"
override fun matches(dependency: IdeaKotlinDependency): Boolean {
if (dependency !is IdeaKotlinBinaryDependency) return false
return coordinates == dependency.coordinates
}
}
@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.gradle.idea.testFixtures.tcs
import org.gradle.api.Project
import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinBinaryCoordinates
import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinDependency
import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinSourceDependency
@@ -13,6 +14,7 @@ fun buildIdeaKotlinDependencyMatchers(notation: Any?): List<IdeaKotlinDependency
return when (notation) {
null -> return emptyList()
is IdeaKotlinDependency -> listOf(IdeaKotlinDependencyInstanceMatcher(notation))
is IdeaKotlinBinaryCoordinates -> listOf(IdeaBinaryCoordinatesInstanceMatcher(notation))
is IdeaKotlinDependencyMatcher -> listOf(notation)
is Iterable<*> -> notation.flatMap { buildIdeaKotlinDependencyMatchers(it) }
else -> error("Can't build ${IdeaKotlinSourceDependencyMatcher::class.java.simpleName} from $notation")