[Gradle] Implement MppIdeDependencyResolutionIT.testCommonizedPlatformDependencyResolution

^KT-55238 Verification Pending
This commit is contained in:
Sebastian Sellmair
2022-12-02 16:04:41 +01:00
committed by Space Team
parent ee07fcc00b
commit 1ec7e404fd
4 changed files with 162 additions and 0 deletions
@@ -0,0 +1,17 @@
/*
* 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.IdeaKotlinDependency
internal class IdeaKotlinDependencyInstanceMatcher(private val instance: IdeaKotlinDependency) : IdeaKotlinDependencyMatcher {
override val description: String
get() = instance.toString()
override fun matches(dependency: IdeaKotlinDependency): Boolean {
return instance == dependency
}
}
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.gradle.idea.tcs.IdeaKotlinSourceDependency
fun buildIdeaKotlinDependencyMatchers(notation: Any?): List<IdeaKotlinDependencyMatcher> {
return when (notation) {
null -> return emptyList()
is IdeaKotlinDependency -> listOf(IdeaKotlinDependencyInstanceMatcher(notation))
is IdeaKotlinDependencyMatcher -> listOf(notation)
is Iterable<*> -> notation.flatMap { buildIdeaKotlinDependencyMatchers(it) }
else -> error("Can't build ${IdeaKotlinSourceDependencyMatcher::class.java.simpleName} from $notation")