Interface KotlinHierarchyBuilder.Root

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract Unit sourceSetTrees(KotlinSourceSetTree tree) Defines the trees that the described hierarchy is applied to.
      abstract Unit withSourceSetTree(KotlinSourceSetTree tree) Will add the given trees into for this descriptor.
      abstract Unit excludeSourceSetTree(KotlinSourceSetTree tree) Will remove the given trees from this descriptor
      • Methods inherited from class org.jetbrains.kotlin.gradle.plugin.KotlinHierarchyBuilder

        common, excludeCompilations, filterCompilations, group, withAndroid, withAndroidNative, withAndroidNativeArm32, withAndroidNativeArm64, withAndroidNativeX64, withAndroidNativeX86, withAndroidTarget, withApple, withCompilations, withIos, withIosArm32, withIosArm64, withIosSimulatorArm64, withIosX64, withJs, withJvm, withLinux, withLinuxArm32Hfp, withLinuxArm64, withLinuxMips32, withLinuxMipsel32, withLinuxX64, withMacos, withMacosArm64, withMacosX64, withMingw, withMingwX64, withMingwX86, withNative, withTvos, withTvosArm64, withTvosSimulatorArm64, withTvosX64, withWasm, withWasm32, withWatchos, withWatchosArm32, withWatchosArm64, withWatchosDeviceArm64, withWatchosSimulatorArm64, withWatchosX64, withWatchosX86, withoutCompilations
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • sourceSetTrees

         abstract Unit sourceSetTrees(KotlinSourceSetTree tree)

        Defines the trees that the described hierarchy is applied to.

        applyHierarchyTemplate {
            sourceSetTrees(KotlinSourceSetTree.main, KotlinSourceSetTree.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

        Using a different hierarchy for "main" and "test"

        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()
            }
        }

        Will create the following trees given an iosX64(), iosArm64() and jvm() target:

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