sourceSetTrees

abstract fun sourceSetTrees(vararg tree: KotlinSourceSetTree)

Defines the KotlinSourceSetTrees that the described hierarchy is applied to.

Examples of DSL:

  1. Only apply a hierarchy for the "main" and "test" KotlinSourceSetTree:

applyHierarchyTemplate {
sourceSetTrees(KotlinSourceSetTree.main, KotlinSourceSetTree.test)
common {
withJvm()
group("ios") {
withIos()
}
}
}

When given the iosX64(), iosArm64(), and jvm() targets, this DSL creates the following trees:

                "main"                      "test"
commonMain commonTest
| |
+----+-----+ +----+-----+
| | | |
iosMain jvmMain iosTest jvmTest
| |
+---+----+ +---+----+
| | | |
iosX64Main iosArm64Main iosX64Test iosArm64Test
  1. Use a different hierarchy for "main" and "test" KotlinSourceSetTree:

applyHierarchyTemplate {
sourceSetTrees(SourceSetTree.main) // ! <- only applied to the "main" tree
common {
withJvm()
group("ios") {
withIos()
}
}
}

applyHierarchyTemplate {
sourceSetTrees(SourceSetTree.test) // ! <- only applied to the "test" tree
common {
withJvm()
withIos()
}
}

When given the iosX64(), iosArm64(), and jvm() targets, this DSL creates the following trees:

                "main"                            "test"
commonMain commonTest
| |
+----+-----+ +-----------+-----------+
| | | | |
iosMain jvmMain iosX64Test iosArm64Test jvmTest
|
+---+----+
| |
iosX64Main iosArm64Main