-
- All Implemented Interfaces:
public interface KotlinTargetHierarchyDsl
-
-
Method Summary
Modifier and Type Method Description abstract Unit
apply(KotlinTargetHierarchyDescriptor hierarchyDescriptor, Function1<KotlinTargetHierarchyBuilder, Unit> describeExtension)
abstract Unit
default(Function1<KotlinTargetHierarchyBuilder, Unit> describeExtension)
Set's up a 'natural'/'default' hierarchy withing KotlinTarget's in the project. abstract Unit
custom(Function1<KotlinTargetHierarchyBuilder, Unit> describe)
-
-
Method Detail
-
apply
abstract Unit apply(KotlinTargetHierarchyDescriptor hierarchyDescriptor, Function1<KotlinTargetHierarchyBuilder, Unit> describeExtension)
-
default
abstract Unit default(Function1<KotlinTargetHierarchyBuilder, Unit> describeExtension)
Set's up a 'natural'/'default' hierarchy withing KotlinTarget's in the project.
kotlin { targetHierarchy.default() // <- position of this call is not relevant! iosX64() iosArm64() linuxX64() linuxArm64() }
Will create the following SourceSets: `iosMain, iosTest, appleMain, appleTest, linuxMain, linuxTest, nativeMain, nativeTest
Hierarchy:
common | +-----------------+-------------------+ | | native ... | | | +----------------------+--------------------+-----------------------+ | | | | apple linux mingw androidNative | +-----------+------------+------------+ | | | | macos ios tvos watchos
Let's imagine we would additionally like to share code between linux and apple (unixLike)
kotlin { targetHierarchy.default { target -> group("native") { // <- we can re-declare already existing groups and connect children to it! group("unixLike") { withLinux() withApple() } } } }
- Parameters:
describeExtension
- : Additional groups can be described to extend the 'default'/'natural' hierarchy:
-
custom
abstract Unit custom(Function1<KotlinTargetHierarchyBuilder, Unit> describe)
-
-
-
-