KotlinSourceSetTree

class KotlinSourceSetTree(val name: String)

Represents a tree of shared KotlinSourceSets.

When applying any KotlinHierarchyTemplate, such as calling kotlin.applyDefaultHierarchyTemplate()) in multiplatform projects, the descriptor is applied to individual compilations, creating multiple trees of shared KotlinSourceSets.

The name is used as a suffix for each shared KotlinSourceSet within the target hierarchy. For example, for the common group within the main tree, the shared KotlinSourceSet name is commonMain.

The default hierarchy template will create two well-known SourceSetTrees:

For example, for the following snippet:

kotlin {
applyDefaultHierarchyTemplate()
jvm()
iosX64()
iosArm64()
}

The plugin creates two KotlinSourceSetTrees called "main" and "test":

                       "main"                               "test"

commonMain commonTest
| |
| |
+----------+----------+ +----------+----------+
| | | |
... jvmMain ... jvmTest
| |
| |
iosMain iosTest
| |
+----+-----+ +----+-----+
| | | |
iosX64Main iosArm64Main iosX64Test iosArm64Test

Typically, the name of the KotlinCompilation matches the name of the SourceSetTree. For example, the "main" tree, rooted at "commonMain", contains all "main" compilations of the project targets. Similarly, the "test" tree, rooted at "commonTest", includes all "test" compilations of the project targets.

There are some exceptions where the user can't choose the name of the compilations directly. For example, on Android. In this case, the name of the KotlinSourceSetTree can be configured outside the target hierarchy DSL.

Parameters

name

the name of this KotlinSourceSetTree

Constructors

Link copied to clipboard
constructor(name: String)

Types

Link copied to clipboard
object Companion

Constants and static properties for the KotlinSourceSetTree.

Properties

Link copied to clipboard