[Gradle] Add documentation to KotlinTargetHierarchyBuilder.Root functions

^KT-58209 Verification Pending
This commit is contained in:
Sebastian Sellmair
2023-04-25 09:15:53 +02:00
committed by Space Team
parent 6029cb46ce
commit bad5c58952
@@ -9,9 +9,87 @@ import org.jetbrains.kotlin.konan.target.DEPRECATED_TARGET_MESSAGE
@ExperimentalKotlinGradlePluginApi
interface KotlinTargetHierarchyBuilder {
@KotlinTargetsDsl
@ExperimentalKotlinGradlePluginApi
interface Root : KotlinTargetHierarchyBuilder {
/**
* Defines the trees that the described hierarchy is applied to.
* ### Example 1: Only apply a hierarchy for the "main" and "test" [KotlinTargetHierarchy.SourceSetTree]
*
* ```kotlin
* targetHierarchy.custom {
* sourceSetTrees(SourceSetTree.main, SourceSetTree.test)
* common {
* withJvm()
* group("ios") {
* withIos()
* }
* }
* }
*```
*
* Will create the following trees given an iosX64(), iosArm64() and jvm() target:
* ```
* "main" "test"
* commonMain commonTest
* | |
* +----+-----+ +----+-----+
* | | | |
* iosMain jvmMain iosTest jvmTest
* | |
* +---+----+ +---+----+
* | | | |
* iosX64Main iosArm64Main iosX64Test iosArm64Test
* ```
*
* ### Example 2:
* Using a different hierarchy for "main" and "test"
*```kotlin
* targetHierarchy.custom {
* sourceSetTrees(SourceSetTree.main) // ! <- only applied to the "main" tree
* common {
* withJvm()
* group("ios") {
* withIos()
* }
* }
* }
*
* targetHierarchy.custom {
* sourceSetTrees(SourceSetTree.test) // ! <- only applied to the "test" tree
* common {
* withJvm()
* withIos()
* }
* }
* ```
*
* Will create the following trees given an iosX64(), iosArm64() and jvm() target:
* ```
* "main" "test"
* commonMain commonTest
* | |
* +----+-----+ +-----------+-----------+
* | | | | |
* iosMain jvmMain iosX64Test iosArm64Test jvmTest
* |
* +---+----+
* | |
* iosX64Main iosArm64Main
* ```
*/
fun sourceSetTrees(vararg tree: KotlinTargetHierarchy.SourceSetTree)
/**
* Will add the given [tree]s into for this descriptor.
* @see sourceSetTrees
*/
fun withSourceSetTree(vararg tree: KotlinTargetHierarchy.SourceSetTree)
/**
* Will remove the given [tree]s from this descriptor
* @see sourceSetTrees
*/
fun excludeSourceSetTree(vararg tree: KotlinTargetHierarchy.SourceSetTree)
}