[Gradle] KotlinTargetHierarchy: Change naming from 'any' to 'with' prefix

^KT-56204 Verification Pending
This commit is contained in:
Sebastian Sellmair
2023-01-26 09:48:36 +01:00
committed by Space Team
parent 8aed6d3c4c
commit ca859c0132
12 changed files with 164 additions and 165 deletions
@@ -1042,50 +1042,50 @@ public abstract interface class org/jetbrains/kotlin/gradle/plugin/KotlinTargetE
} }
public abstract interface class org/jetbrains/kotlin/gradle/plugin/KotlinTargetHierarchyBuilder { public abstract interface class org/jetbrains/kotlin/gradle/plugin/KotlinTargetHierarchyBuilder {
public abstract fun addCompilations (Lkotlin/jvm/functions/Function1;)V
public abstract fun anyAndroid ()V
public abstract fun anyAndroidNative ()V
public abstract fun anyAndroidNativeArm32 ()V
public abstract fun anyAndroidNativeArm64 ()V
public abstract fun anyAndroidNativeX64 ()V
public abstract fun anyAndroidNativeX86 ()V
public abstract fun anyApple ()V
public abstract fun anyIos ()V
public abstract fun anyIosArm32 ()V
public abstract fun anyIosArm64 ()V
public abstract fun anyIosSimulatorArm64 ()V
public abstract fun anyIosX64 ()V
public abstract fun anyJs ()V
public abstract fun anyJvm ()V
public abstract fun anyLinux ()V
public abstract fun anyLinuxArm32Hfp ()V
public abstract fun anyLinuxArm64 ()V
public abstract fun anyLinuxMips32 ()V
public abstract fun anyLinuxMipsel32 ()V
public abstract fun anyLinuxX64 ()V
public abstract fun anyMacos ()V
public abstract fun anyMacosArm64 ()V
public abstract fun anyMacosX64 ()V
public abstract fun anyMingw ()V
public abstract fun anyMingwX64 ()V
public abstract fun anyMingwX86 ()V
public abstract fun anyNative ()V
public abstract fun anyTvos ()V
public abstract fun anyTvosArm64 ()V
public abstract fun anyTvosSimulatorArm64 ()V
public abstract fun anyTvosX64 ()V
public abstract fun anyWasm32 ()V
public abstract fun anyWatchos ()V
public abstract fun anyWatchosArm32 ()V
public abstract fun anyWatchosArm64 ()V
public abstract fun anyWatchosDeviceArm64 ()V
public abstract fun anyWatchosSimulatorArm64 ()V
public abstract fun anyWatchosX64 ()V
public abstract fun anyWatchosX86 ()V
public abstract fun common (Lkotlin/jvm/functions/Function1;)V public abstract fun common (Lkotlin/jvm/functions/Function1;)V
public abstract fun filterCompilations (Lkotlin/jvm/functions/Function1;)V public abstract fun filterCompilations (Lkotlin/jvm/functions/Function1;)V
public abstract fun group (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V public abstract fun group (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V
public abstract fun removeCompilations (Lkotlin/jvm/functions/Function1;)V public abstract fun withAndroid ()V
public abstract fun withAndroidNative ()V
public abstract fun withAndroidNativeArm32 ()V
public abstract fun withAndroidNativeArm64 ()V
public abstract fun withAndroidNativeX64 ()V
public abstract fun withAndroidNativeX86 ()V
public abstract fun withApple ()V
public abstract fun withCompilations (Lkotlin/jvm/functions/Function1;)V
public abstract fun withIos ()V
public abstract fun withIosArm32 ()V
public abstract fun withIosArm64 ()V
public abstract fun withIosSimulatorArm64 ()V
public abstract fun withIosX64 ()V
public abstract fun withJs ()V
public abstract fun withJvm ()V
public abstract fun withLinux ()V
public abstract fun withLinuxArm32Hfp ()V
public abstract fun withLinuxArm64 ()V
public abstract fun withLinuxMips32 ()V
public abstract fun withLinuxMipsel32 ()V
public abstract fun withLinuxX64 ()V
public abstract fun withMacos ()V
public abstract fun withMacosArm64 ()V
public abstract fun withMacosX64 ()V
public abstract fun withMingw ()V
public abstract fun withMingwX64 ()V
public abstract fun withMingwX86 ()V
public abstract fun withNative ()V
public abstract fun withTvos ()V
public abstract fun withTvosArm64 ()V
public abstract fun withTvosSimulatorArm64 ()V
public abstract fun withTvosX64 ()V
public abstract fun withWasm32 ()V
public abstract fun withWatchos ()V
public abstract fun withWatchosArm32 ()V
public abstract fun withWatchosArm64 ()V
public abstract fun withWatchosDeviceArm64 ()V
public abstract fun withWatchosSimulatorArm64 ()V
public abstract fun withWatchosX64 ()V
public abstract fun withWatchosX86 ()V
public abstract fun withoutCompilations (Lkotlin/jvm/functions/Function1;)V
} }
public final class org/jetbrains/kotlin/gradle/plugin/KotlinTargetHierarchyBuilder$DefaultImpls { public final class org/jetbrains/kotlin/gradle/plugin/KotlinTargetHierarchyBuilder$DefaultImpls {
@@ -69,8 +69,8 @@ interface KotlinTargetHierarchyDsl {
* targets.hierarchy.default { target -> * targets.hierarchy.default { target ->
* group("native") { // <- we can re-declare already existing groups and connect children to it! * group("native") { // <- we can re-declare already existing groups and connect children to it!
* group("unixLike") { * group("unixLike") {
* anyLinux() * withLinux()
* anyApple() * withApple()
* } * }
* } * }
* } * }
@@ -13,63 +13,63 @@ interface KotlinTargetHierarchyBuilder {
fun group(name: String, build: KotlinTargetHierarchyBuilder.() -> Unit = {}) fun group(name: String, build: KotlinTargetHierarchyBuilder.() -> Unit = {})
/* low-level APIs */ /* low-level APIs */
fun addCompilations(predicate: (KotlinCompilation<*>) -> Boolean) fun withCompilations(predicate: (KotlinCompilation<*>) -> Boolean)
fun removeCompilations(predicate: (KotlinCompilation<*>) -> Boolean) fun withoutCompilations(predicate: (KotlinCompilation<*>) -> Boolean)
fun filterCompilations(predicate: (KotlinCompilation<*>) -> Boolean) = fun filterCompilations(predicate: (KotlinCompilation<*>) -> Boolean) =
removeCompilations { !predicate(it) } withoutCompilations { !predicate(it) }
/* Convenient groups */ /* Convenient groups */
fun anyNative() fun withNative()
fun anyApple() fun withApple()
fun anyIos() fun withIos()
fun anyWatchos() fun withWatchos()
fun anyMacos() fun withMacos()
fun anyTvos() fun withTvos()
fun anyMingw() fun withMingw()
fun anyLinux() fun withLinux()
fun anyAndroidNative() fun withAndroidNative()
fun anyJs() fun withJs()
/* Actual targets */ /* Actual targets */
fun anyJvm() fun withJvm()
fun anyAndroid() fun withAndroid()
fun anyAndroidNativeX64() fun withAndroidNativeX64()
fun anyAndroidNativeX86() fun withAndroidNativeX86()
fun anyAndroidNativeArm32() fun withAndroidNativeArm32()
fun anyAndroidNativeArm64() fun withAndroidNativeArm64()
fun anyIosArm32() fun withIosArm32()
fun anyIosArm64() fun withIosArm64()
fun anyIosX64() fun withIosX64()
fun anyIosSimulatorArm64() fun withIosSimulatorArm64()
fun anyWatchosArm32() fun withWatchosArm32()
fun anyWatchosArm64() fun withWatchosArm64()
fun anyWatchosX64() fun withWatchosX64()
fun anyWatchosSimulatorArm64() fun withWatchosSimulatorArm64()
fun anyWatchosDeviceArm64() fun withWatchosDeviceArm64()
fun anyTvosArm64() fun withTvosArm64()
fun anyTvosX64() fun withTvosX64()
fun anyTvosSimulatorArm64() fun withTvosSimulatorArm64()
fun anyLinuxX64() fun withLinuxX64()
fun anyMingwX64() fun withMingwX64()
fun anyMacosX64() fun withMacosX64()
fun anyMacosArm64() fun withMacosArm64()
fun anyLinuxArm64() fun withLinuxArm64()
@Deprecated(DEPRECATED_TARGET_MESSAGE) @Deprecated(DEPRECATED_TARGET_MESSAGE)
fun anyWatchosX86() fun withWatchosX86()
@Deprecated(DEPRECATED_TARGET_MESSAGE) @Deprecated(DEPRECATED_TARGET_MESSAGE)
fun anyMingwX86() fun withMingwX86()
@Deprecated(DEPRECATED_TARGET_MESSAGE) @Deprecated(DEPRECATED_TARGET_MESSAGE)
fun anyLinuxArm32Hfp() fun withLinuxArm32Hfp()
@Deprecated(DEPRECATED_TARGET_MESSAGE) @Deprecated(DEPRECATED_TARGET_MESSAGE)
fun anyLinuxMips32() fun withLinuxMips32()
@Deprecated(DEPRECATED_TARGET_MESSAGE) @Deprecated(DEPRECATED_TARGET_MESSAGE)
fun anyLinuxMipsel32() fun withLinuxMipsel32()
@Deprecated(DEPRECATED_TARGET_MESSAGE) @Deprecated(DEPRECATED_TARGET_MESSAGE)
fun anyWasm32() fun withWasm32()
} }
@@ -11,12 +11,12 @@ kotlin {
targetHierarchy.default { targetHierarchy.default {
common { common {
group("concurrent") { group("concurrent") {
anyJvm() withJvm()
group("native") { group("native") {
group("appleAndLinux") { group("appleAndLinux") {
anyApple() withApple()
anyLinux() withLinux()
} }
} }
} }
@@ -65,14 +65,14 @@ private class KotlinTargetHierarchyBuilderImpl(
private var includePredicate: ((KotlinCompilation<*>) -> Boolean) = { false } private var includePredicate: ((KotlinCompilation<*>) -> Boolean) = { false }
private var excludePredicate: ((KotlinCompilation<*>) -> Boolean) = { false } private var excludePredicate: ((KotlinCompilation<*>) -> Boolean) = { false }
override fun addCompilations(predicate: (KotlinCompilation<*>) -> Boolean) { override fun withCompilations(predicate: (KotlinCompilation<*>) -> Boolean) {
val previousIncludePredicate = this.includePredicate val previousIncludePredicate = this.includePredicate
val previousExcludePredicate = this.excludePredicate val previousExcludePredicate = this.excludePredicate
this.includePredicate = { previousIncludePredicate(it) || predicate(it) } this.includePredicate = { previousIncludePredicate(it) || predicate(it) }
this.excludePredicate = { previousExcludePredicate(it) && !predicate(it) } this.excludePredicate = { previousExcludePredicate(it) && !predicate(it) }
} }
override fun removeCompilations(predicate: (KotlinCompilation<*>) -> Boolean) { override fun withoutCompilations(predicate: (KotlinCompilation<*>) -> Boolean) {
val previousIncludePredicate = this.includePredicate val previousIncludePredicate = this.includePredicate
val previousExcludePredicate = this.excludePredicate val previousExcludePredicate = this.excludePredicate
this.includePredicate = { previousIncludePredicate(it) && !predicate(it) } this.includePredicate = { previousIncludePredicate(it) && !predicate(it) }
@@ -90,7 +90,7 @@ private class KotlinTargetHierarchyBuilderImpl(
return childrenClosure.any { child -> compilation in child } return childrenClosure.any { child -> compilation in child }
} }
private inline fun addTargets(crossinline predicate: (KotlinTarget) -> Boolean) = addCompilations { predicate(it.target) } private inline fun addTargets(crossinline predicate: (KotlinTarget) -> Boolean) = withCompilations { predicate(it.target) }
override fun group(name: String, build: KotlinTargetHierarchyBuilder.() -> Unit) { override fun group(name: String, build: KotlinTargetHierarchyBuilder.() -> Unit) {
val node = KotlinTargetHierarchy.Node.Group(name) val node = KotlinTargetHierarchy.Node.Group(name)
@@ -99,27 +99,27 @@ private class KotlinTargetHierarchyBuilderImpl(
checkCyclicHierarchy() checkCyclicHierarchy()
} }
override fun anyNative() = addTargets { it is KotlinNativeTarget } override fun withNative() = addTargets { it is KotlinNativeTarget }
override fun anyApple() = addTargets { it is KotlinNativeTarget && it.konanTarget.family.isAppleFamily } override fun withApple() = addTargets { it is KotlinNativeTarget && it.konanTarget.family.isAppleFamily }
override fun anyIos() = addTargets { it is KotlinNativeTarget && it.konanTarget.family == Family.IOS } override fun withIos() = addTargets { it is KotlinNativeTarget && it.konanTarget.family == Family.IOS }
override fun anyWatchos() = addTargets { it is KotlinNativeTarget && it.konanTarget.family == Family.WATCHOS } override fun withWatchos() = addTargets { it is KotlinNativeTarget && it.konanTarget.family == Family.WATCHOS }
override fun anyMacos() = addTargets { it is KotlinNativeTarget && it.konanTarget.family == Family.OSX } override fun withMacos() = addTargets { it is KotlinNativeTarget && it.konanTarget.family == Family.OSX }
override fun anyTvos() = addTargets { it is KotlinNativeTarget && it.konanTarget.family == Family.TVOS } override fun withTvos() = addTargets { it is KotlinNativeTarget && it.konanTarget.family == Family.TVOS }
override fun anyMingw() = addTargets { it is KotlinNativeTarget && it.konanTarget.family == Family.MINGW } override fun withMingw() = addTargets { it is KotlinNativeTarget && it.konanTarget.family == Family.MINGW }
override fun anyLinux() = addTargets { it is KotlinNativeTarget && it.konanTarget.family == Family.LINUX } override fun withLinux() = addTargets { it is KotlinNativeTarget && it.konanTarget.family == Family.LINUX }
override fun anyAndroidNative() = addTargets { it is KotlinNativeTarget && it.konanTarget.family == Family.ANDROID } override fun withAndroidNative() = addTargets { it is KotlinNativeTarget && it.konanTarget.family == Family.ANDROID }
override fun anyJs() = addTargets { it is KotlinJsTargetDsl } override fun withJs() = addTargets { it is KotlinJsTargetDsl }
override fun anyJvm() = addTargets { override fun withJvm() = addTargets {
it is KotlinJvmTarget || it is KotlinJvmTarget ||
/* /*
Handle older KotlinWithJavaTarget correctly: Handle older KotlinWithJavaTarget correctly:
@@ -129,119 +129,119 @@ private class KotlinTargetHierarchyBuilderImpl(
(it is KotlinWithJavaTarget<*, *> && it.platformType == KotlinPlatformType.jvm) (it is KotlinWithJavaTarget<*, *> && it.platformType == KotlinPlatformType.jvm)
} }
override fun anyAndroid() = addTargets { it is KotlinAndroidTarget } override fun withAndroid() = addTargets { it is KotlinAndroidTarget }
override fun anyAndroidNativeX64() = addTargets { override fun withAndroidNativeX64() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.ANDROID_X64 it is KotlinNativeTarget && it.konanTarget == KonanTarget.ANDROID_X64
} }
override fun anyAndroidNativeX86() = addTargets { override fun withAndroidNativeX86() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.ANDROID_X86 it is KotlinNativeTarget && it.konanTarget == KonanTarget.ANDROID_X86
} }
override fun anyAndroidNativeArm32() = addTargets { override fun withAndroidNativeArm32() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.ANDROID_X86 it is KotlinNativeTarget && it.konanTarget == KonanTarget.ANDROID_X86
} }
override fun anyAndroidNativeArm64() = addTargets { override fun withAndroidNativeArm64() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.ANDROID_ARM64 it is KotlinNativeTarget && it.konanTarget == KonanTarget.ANDROID_ARM64
} }
override fun anyIosArm32() = addTargets { override fun withIosArm32() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.IOS_ARM32 it is KotlinNativeTarget && it.konanTarget == KonanTarget.IOS_ARM32
} }
override fun anyIosArm64() = addTargets { override fun withIosArm64() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.IOS_ARM64 it is KotlinNativeTarget && it.konanTarget == KonanTarget.IOS_ARM64
} }
override fun anyIosX64() = addTargets { override fun withIosX64() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.IOS_X64 it is KotlinNativeTarget && it.konanTarget == KonanTarget.IOS_X64
} }
override fun anyIosSimulatorArm64() = addTargets { override fun withIosSimulatorArm64() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.IOS_SIMULATOR_ARM64 it is KotlinNativeTarget && it.konanTarget == KonanTarget.IOS_SIMULATOR_ARM64
} }
override fun anyWatchosArm32() = addTargets { override fun withWatchosArm32() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.WATCHOS_ARM32 it is KotlinNativeTarget && it.konanTarget == KonanTarget.WATCHOS_ARM32
} }
override fun anyWatchosArm64() = addTargets { override fun withWatchosArm64() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.WATCHOS_ARM64 it is KotlinNativeTarget && it.konanTarget == KonanTarget.WATCHOS_ARM64
} }
override fun anyWatchosX64() = addTargets { override fun withWatchosX64() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.WATCHOS_X64 it is KotlinNativeTarget && it.konanTarget == KonanTarget.WATCHOS_X64
} }
override fun anyWatchosSimulatorArm64() = addTargets { override fun withWatchosSimulatorArm64() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.WATCHOS_SIMULATOR_ARM64 it is KotlinNativeTarget && it.konanTarget == KonanTarget.WATCHOS_SIMULATOR_ARM64
} }
override fun anyWatchosDeviceArm64() = addTargets { override fun withWatchosDeviceArm64() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.WATCHOS_DEVICE_ARM64 it is KotlinNativeTarget && it.konanTarget == KonanTarget.WATCHOS_DEVICE_ARM64
} }
override fun anyTvosArm64() = addTargets { override fun withTvosArm64() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.TVOS_ARM64 it is KotlinNativeTarget && it.konanTarget == KonanTarget.TVOS_ARM64
} }
override fun anyTvosX64() = addTargets { override fun withTvosX64() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.TVOS_X64 it is KotlinNativeTarget && it.konanTarget == KonanTarget.TVOS_X64
} }
override fun anyTvosSimulatorArm64() = addTargets { override fun withTvosSimulatorArm64() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.TVOS_SIMULATOR_ARM64 it is KotlinNativeTarget && it.konanTarget == KonanTarget.TVOS_SIMULATOR_ARM64
} }
override fun anyLinuxX64() = addTargets { override fun withLinuxX64() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.LINUX_X64 it is KotlinNativeTarget && it.konanTarget == KonanTarget.LINUX_X64
} }
override fun anyMingwX64() = addTargets { override fun withMingwX64() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.MINGW_X64 it is KotlinNativeTarget && it.konanTarget == KonanTarget.MINGW_X64
} }
override fun anyMacosX64() = addTargets { override fun withMacosX64() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.MACOS_X64 it is KotlinNativeTarget && it.konanTarget == KonanTarget.MACOS_X64
} }
override fun anyMacosArm64() = addTargets { override fun withMacosArm64() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.MACOS_ARM64 it is KotlinNativeTarget && it.konanTarget == KonanTarget.MACOS_ARM64
} }
override fun anyLinuxArm64() = addTargets { override fun withLinuxArm64() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.LINUX_ARM64 it is KotlinNativeTarget && it.konanTarget == KonanTarget.LINUX_ARM64
} }
@Deprecated(DEPRECATED_TARGET_MESSAGE) @Deprecated(DEPRECATED_TARGET_MESSAGE)
override fun anyWatchosX86() = addTargets { override fun withWatchosX86() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.WATCHOS_X86 it is KotlinNativeTarget && it.konanTarget == KonanTarget.WATCHOS_X86
} }
@Deprecated(DEPRECATED_TARGET_MESSAGE) @Deprecated(DEPRECATED_TARGET_MESSAGE)
override fun anyMingwX86() = addTargets { override fun withMingwX86() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.MINGW_X86 it is KotlinNativeTarget && it.konanTarget == KonanTarget.MINGW_X86
} }
@Deprecated(DEPRECATED_TARGET_MESSAGE) @Deprecated(DEPRECATED_TARGET_MESSAGE)
override fun anyLinuxArm32Hfp() = addTargets { override fun withLinuxArm32Hfp() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.LINUX_ARM32_HFP it is KotlinNativeTarget && it.konanTarget == KonanTarget.LINUX_ARM32_HFP
} }
@Deprecated(DEPRECATED_TARGET_MESSAGE) @Deprecated(DEPRECATED_TARGET_MESSAGE)
override fun anyLinuxMips32() = addTargets { override fun withLinuxMips32() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.LINUX_MIPS32 it is KotlinNativeTarget && it.konanTarget == KonanTarget.LINUX_MIPS32
} }
@Deprecated(DEPRECATED_TARGET_MESSAGE) @Deprecated(DEPRECATED_TARGET_MESSAGE)
override fun anyLinuxMipsel32() = addTargets { override fun withLinuxMipsel32() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.LINUX_MIPSEL32 it is KotlinNativeTarget && it.konanTarget == KonanTarget.LINUX_MIPSEL32
} }
@Deprecated(DEPRECATED_TARGET_MESSAGE) @Deprecated(DEPRECATED_TARGET_MESSAGE)
override fun anyWasm32() = addTargets { override fun withWasm32() = addTargets {
it is KotlinNativeTarget && it.konanTarget == KonanTarget.WASM32 it is KotlinNativeTarget && it.konanTarget == KonanTarget.WASM32
} }
@@ -21,38 +21,38 @@ internal val naturalKotlinTargetHierarchy = KotlinTargetHierarchyDescriptor {
common { common {
group("native") { group("native") {
anyNative() withNative()
group("apple") { group("apple") {
anyApple() withApple()
group("ios") { group("ios") {
anyIos() withIos()
} }
group("tvos") { group("tvos") {
anyTvos() withTvos()
} }
group("watchos") { group("watchos") {
anyWatchos() withWatchos()
} }
group("macos") { group("macos") {
anyMacos() withMacos()
} }
} }
group("linux") { group("linux") {
anyLinux() withLinux()
} }
group("mingw") { group("mingw") {
anyMingw() withMingw()
} }
group("androidNative") { group("androidNative") {
anyAndroidNative() withAndroidNative()
} }
} }
} }
@@ -8,7 +8,6 @@
package org.jetbrains.kotlin.gradle.dependencyResolutionTests.tcs package org.jetbrains.kotlin.gradle.dependencyResolutionTests.tcs
import org.gradle.api.Project import org.gradle.api.Project
import org.jetbrains.kotlin.gradle.*
import org.jetbrains.kotlin.gradle.dependencyResolutionTests.mavenCentralCacheRedirector import org.jetbrains.kotlin.gradle.dependencyResolutionTests.mavenCentralCacheRedirector
import org.jetbrains.kotlin.gradle.dsl.multiplatformExtension import org.jetbrains.kotlin.gradle.dsl.multiplatformExtension
import org.jetbrains.kotlin.gradle.idea.testFixtures.tcs.* import org.jetbrains.kotlin.gradle.idea.testFixtures.tcs.*
@@ -38,8 +37,8 @@ class IdeJvmAndAndroidDependencyResolutionTest {
project.multiplatformExtension.targetHierarchy.custom { project.multiplatformExtension.targetHierarchy.custom {
common { common {
group("jvmAndAndroid") { group("jvmAndAndroid") {
anyJvm() withJvm()
anyAndroid() withAndroid()
} }
} }
} }
@@ -36,8 +36,8 @@ class KT55929MetadataConfigurationsTest {
kotlin.targetHierarchy.default { kotlin.targetHierarchy.default {
common { common {
group("jvmAndLinux") { group("jvmAndLinux") {
addCompilations { it.platformType == KotlinPlatformType.jvm } withCompilations { it.platformType == KotlinPlatformType.jvm }
anyLinux() withLinux()
group("linux") group("linux")
} }
} }
@@ -66,8 +66,8 @@ class KotlinCompileTaskSourcesTest {
kotlin.targetHierarchy.default { kotlin.targetHierarchy.default {
common { common {
group("jvmAndLinux") { group("jvmAndLinux") {
anyLinux() withLinux()
anyJvm() withJvm()
} }
} }
} }
@@ -26,15 +26,15 @@ class KotlinTargetHierarchyBuilderTest {
buildProjectWithMPP().multiplatformExtension.presets buildProjectWithMPP().multiplatformExtension.presets
// JS targets are special and therefore are only handled manually using `anyJs()` // JS targets are special and therefore are only handled manually using `withJs()`
.filter { it !is KotlinJsTargetPreset } .filter { it !is KotlinJsTargetPreset }
.filter { it !is KotlinJsIrTargetPreset } .filter { it !is KotlinJsIrTargetPreset }
.filter { it !is KotlinWasmTargetPreset } .filter { it !is KotlinWasmTargetPreset }
// jvmWithJava is covered by the jvm() call // jvmWithJava is covered by the withJvm() call
.filter { it !is KotlinJvmWithJavaTargetPreset } .filter { it !is KotlinJvmWithJavaTargetPreset }
.forEach { preset -> .forEach { preset ->
val expectedFunctionName = "any${preset.name.capitalizeAsciiOnly()}" val expectedFunctionName = "with${preset.name.capitalizeAsciiOnly()}"
if (kotlinTargetHierarchyBuilderInterface.declaredMethods.none { it.name == expectedFunctionName }) if (kotlinTargetHierarchyBuilderInterface.declaredMethods.none { it.name == expectedFunctionName })
fail("${kotlinTargetHierarchyBuilderInterface.name}: Missing ${expectedFunctionName}() function") fail("${kotlinTargetHierarchyBuilderInterface.name}: Missing ${expectedFunctionName}() function")
} }
@@ -27,8 +27,8 @@ class KotlinTargetHierarchyDescriptorTest {
fun `test - simple descriptor`() { fun `test - simple descriptor`() {
val descriptor = KotlinTargetHierarchyDescriptor { val descriptor = KotlinTargetHierarchyDescriptor {
common { common {
group("groupA") { addCompilations { it.target.name == "a" } } group("groupA") { withCompilations { it.target.name == "a" } }
group("groupB") { addCompilations { it.target.name == "b" } } group("groupB") { withCompilations { it.target.name == "b" } }
} }
} }
@@ -65,7 +65,7 @@ class KotlinTargetHierarchyDescriptorTest {
val descriptor = KotlinTargetHierarchyDescriptor { group("base") }.extend { val descriptor = KotlinTargetHierarchyDescriptor { group("base") }.extend {
group("base") { group("base") {
group("extension") { group("extension") {
addCompilations { true } withCompilations { true }
} }
} }
} }
@@ -87,7 +87,7 @@ class KotlinTargetHierarchyDescriptorTest {
group("newRoot") { group("newRoot") {
group("base") { group("base") {
group("extension") { group("extension") {
addCompilations { true } withCompilations { true }
} }
} }
} }
@@ -113,7 +113,7 @@ class KotlinTargetHierarchyDescriptorTest {
group("newRoot1") { group("newRoot1") {
group("base") { group("base") {
group("extension1") { group("extension1") {
addCompilations { true } withCompilations { true }
} }
} }
} }
@@ -122,7 +122,7 @@ class KotlinTargetHierarchyDescriptorTest {
group("newRoot2") { group("newRoot2") {
group("base") { group("base") {
group("extension2") { group("extension2") {
addCompilations { true } withCompilations { true }
} }
} }
} }
@@ -198,7 +198,7 @@ class KotlinTargetHierarchyDescriptorTest {
filterCompilations { it.name in setOf("a", "b") } filterCompilations { it.name in setOf("a", "b") }
common { common {
group("x") { group("x") {
addCompilations { true } withCompilations { true }
} }
} }
} }
@@ -225,7 +225,7 @@ class KotlinTargetHierarchyDescriptorTest {
@Test @Test
fun `test - filterCompilations - include them again`() { fun `test - filterCompilations - include them again`() {
val descriptor = KotlinTargetHierarchyDescriptor { val descriptor = KotlinTargetHierarchyDescriptor {
addCompilations { true } withCompilations { true }
filterCompilations { it.name == "a" } filterCompilations { it.name == "a" }
} }
@@ -233,7 +233,7 @@ class KotlinTargetHierarchyDescriptorTest {
assertNull(descriptor.buildKotlinTargetHierarchy(kotlin.linuxX64().compilations.maybeCreate("b"))) assertNull(descriptor.buildKotlinTargetHierarchy(kotlin.linuxX64().compilations.maybeCreate("b")))
val extended = descriptor.extend { val extended = descriptor.extend {
addCompilations { true } // <- adds all compilations back again! withCompilations { true } // <- adds all compilations back again!
} }
assertNull(descriptor.buildKotlinTargetHierarchy(kotlin.linuxX64().compilations.maybeCreate("b"))) assertNull(descriptor.buildKotlinTargetHierarchy(kotlin.linuxX64().compilations.maybeCreate("b")))
@@ -208,8 +208,8 @@ class KotlinTargetHierarchyDslTest {
kotlin.targetHierarchy.default { kotlin.targetHierarchy.default {
common { common {
group("jvmAndAndroid") { group("jvmAndAndroid") {
anyJvm() withJvm()
anyAndroid() withAndroid()
} }
} }
} }
@@ -260,7 +260,7 @@ class KotlinTargetHierarchyDslTest {
targetHierarchy.apply(descriptor) { targetHierarchy.apply(descriptor) {
group("base") { group("base") {
group("extension") { group("extension") {
anyLinuxX64() withLinuxX64()
} }
} }
} }
@@ -289,12 +289,12 @@ class KotlinTargetHierarchyDslTest {
kotlin.targetHierarchy.custom { kotlin.targetHierarchy.custom {
common { common {
group("native") { group("native") {
anyNative() withNative()
} }
group("nix") { group("nix") {
anyLinux() withLinux()
anyMacos() withMacos()
} }
} }
} }
@@ -332,7 +332,7 @@ class KotlinTargetHierarchyDslTest {
group("newRoot") { group("newRoot") {
group("base") { group("base") {
group("extension") { group("extension") {
anyLinuxX64() withLinuxX64()
} }
} }
} }