[Gradle] Implement SourceSetTreeClassifier API
- This new API will be configurable for 'External Kotlin Targets'
- This change also moves targetHierarchy.android {} into the androidTarget
to avoid potential confusion around the KGP managed AndroidTarget vs
the Google implementation.
KT-58710
This commit is contained in:
committed by
Space Team
parent
dbfa8d4c29
commit
ff7e4f7986
@@ -142,16 +142,6 @@ public abstract interface class org/jetbrains/kotlin/gradle/dsl/KaptJavacOption
|
||||
public abstract fun option (Ljava/lang/Object;Ljava/lang/Object;)V
|
||||
}
|
||||
|
||||
public abstract interface class org/jetbrains/kotlin/gradle/dsl/KotlinAndroidTargetHierarchyDsl {
|
||||
public abstract fun getInstrumentedTest ()Lorg/jetbrains/kotlin/gradle/dsl/KotlinAndroidVariantHierarchyDsl;
|
||||
public abstract fun getMain ()Lorg/jetbrains/kotlin/gradle/dsl/KotlinAndroidVariantHierarchyDsl;
|
||||
public abstract fun getUnitTest ()Lorg/jetbrains/kotlin/gradle/dsl/KotlinAndroidVariantHierarchyDsl;
|
||||
}
|
||||
|
||||
public abstract interface class org/jetbrains/kotlin/gradle/dsl/KotlinAndroidVariantHierarchyDsl {
|
||||
public abstract fun getSourceSetTree ()Lorg/gradle/api/provider/Property;
|
||||
}
|
||||
|
||||
public abstract interface class org/jetbrains/kotlin/gradle/dsl/KotlinArtifact : org/gradle/api/Named, org/gradle/api/plugins/ExtensionAware {
|
||||
public abstract fun getArtifactName ()Ljava/lang/String;
|
||||
public abstract fun getModules ()Ljava/util/Set;
|
||||
@@ -530,11 +520,9 @@ public abstract interface class org/jetbrains/kotlin/gradle/dsl/KotlinNativeXCFr
|
||||
}
|
||||
|
||||
public abstract interface class org/jetbrains/kotlin/gradle/dsl/KotlinTargetHierarchyDsl {
|
||||
public abstract fun android (Lkotlin/jvm/functions/Function1;)V
|
||||
public abstract fun apply (Lorg/jetbrains/kotlin/gradle/plugin/KotlinTargetHierarchyDescriptor;Lkotlin/jvm/functions/Function1;)V
|
||||
public abstract fun custom (Lkotlin/jvm/functions/Function1;)V
|
||||
public abstract fun default (Lkotlin/jvm/functions/Function1;)V
|
||||
public abstract fun getAndroid ()Lorg/jetbrains/kotlin/gradle/dsl/KotlinAndroidTargetHierarchyDsl;
|
||||
}
|
||||
|
||||
public final class org/jetbrains/kotlin/gradle/dsl/KotlinTargetHierarchyDsl$DefaultImpls {
|
||||
@@ -1105,6 +1093,7 @@ public abstract interface class org/jetbrains/kotlin/gradle/plugin/KotlinTargetH
|
||||
public abstract fun withAndroidNativeArm64 ()V
|
||||
public abstract fun withAndroidNativeX64 ()V
|
||||
public abstract fun withAndroidNativeX86 ()V
|
||||
public abstract fun withAndroidTarget ()V
|
||||
public abstract fun withApple ()V
|
||||
public abstract fun withCompilations (Lkotlin/jvm/functions/Function1;)V
|
||||
public abstract fun withIos ()V
|
||||
|
||||
-68
@@ -170,72 +170,4 @@ interface KotlinTargetHierarchyDsl {
|
||||
* ```
|
||||
*/
|
||||
fun custom(describe: KotlinTargetHierarchyBuilder.Root.() -> Unit)
|
||||
|
||||
/**
|
||||
* Configure Android specific settings within the context of [KotlinTargetHierarchy].
|
||||
* The difference between Android and other targets is that the build author is free to choose
|
||||
* the names of compilations, whereas Android is using predefined SourceSet names.
|
||||
*
|
||||
* ### Default dependsOn edges
|
||||
* By default, Kotlin Multiplatform will set the following default dependsOn edges:
|
||||
* - `androidMain` -> `commonMain`
|
||||
* - `androidUnitTest` -> `commonTest`
|
||||
*
|
||||
* In this default setup, SourceSets like `androidInstrumentedTest` will *not* dependOn `commonTest`.
|
||||
* This API can be used to change the default behavior
|
||||
*
|
||||
* #### Example 1: Setting up androidInstrumentedTest -> commonTest
|
||||
* This can be done by putting the 'androidInstrumentedTest' variants into the 'test' [SourceSetTree]:
|
||||
* ```kotlin
|
||||
* targetHierarchy.android {
|
||||
* instrumentedTest.sourceSetTree.set(SourceSetTree.test)
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* #### Example 2: Setting up androidInstrumentedTest -> commonTest and removing 'unitTests' from the 'test' [SourceSetTree]
|
||||
* ```kotlin
|
||||
* targetHierarchy.android {
|
||||
* instrumentedTest.sourceSetTree.set(SourceSetTree.test)
|
||||
* unitTest.sourceSetTree.set(SourceSetTree.unitTest) // ! <- Anything *other* than 'test'
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
@ExperimentalKotlinGradlePluginApi
|
||||
fun android(configure: KotlinAndroidTargetHierarchyDsl.() -> Unit)
|
||||
|
||||
/**
|
||||
* See [android]
|
||||
*/
|
||||
@ExperimentalKotlinGradlePluginApi
|
||||
val android: KotlinAndroidTargetHierarchyDsl
|
||||
}
|
||||
|
||||
|
||||
@ExperimentalKotlinGradlePluginApi
|
||||
interface KotlinAndroidTargetHierarchyDsl {
|
||||
val main: KotlinAndroidVariantHierarchyDsl
|
||||
val unitTest: KotlinAndroidVariantHierarchyDsl
|
||||
val instrumentedTest: KotlinAndroidVariantHierarchyDsl
|
||||
}
|
||||
|
||||
@ExperimentalKotlinGradlePluginApi
|
||||
interface KotlinAndroidVariantHierarchyDsl {
|
||||
/**
|
||||
* Configures under which [SourceSetTree] the currently configured Android Variant shall be placed.
|
||||
* e.g.
|
||||
*
|
||||
* ```kotlin
|
||||
* kotlin {
|
||||
* targetHierarchy.android {
|
||||
* instrumentedTest.sourceSetTree.set(SourceSetTree.test)
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Will ensure that all android instrumented tests (androidInstrumentedTest, androidInstrumentedTestDebug, ...)
|
||||
* will be placed into the 'test' SourceSet tree (with 'commonTest' as root)
|
||||
*
|
||||
* See [KotlinTargetHierarchyDsl.android]
|
||||
*/
|
||||
val sourceSetTree: Property<SourceSetTree>
|
||||
}
|
||||
Reference in New Issue
Block a user