1/*
2 * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3 */
4
5project.ext.nativeMainSets = []
6project.ext.nativeTestSets = []
7
8kotlin {
9    targets.metaClass.addTarget = { preset ->
10        def target = delegate.fromPreset(preset, preset.name)
11        project.ext.nativeMainSets.add(target.compilations['main'].kotlinSourceSets.first())
12        project.ext.nativeTestSets.add(target.compilations['test'].kotlinSourceSets.first())
13    }
14
15    targets {
16        addTarget(presets.linuxX64)
17        addTarget(presets.iosArm64)
18        addTarget(presets.iosArm32)
19        addTarget(presets.iosX64)
20        addTarget(presets.macosX64)
21        addTarget(presets.mingwX64)
22        addTarget(presets.tvosArm64)
23        addTarget(presets.tvosX64)
24        addTarget(presets.watchosArm32)
25        addTarget(presets.watchosArm64)
26        addTarget(presets.watchosX86)
27    }
28
29    sourceSets {
30        nativeMain { dependsOn commonMain }
31        nativeTest { dependsOn commonTest }
32
33        configure(nativeMainSets) { dependsOn nativeMain }
34        configure(nativeTestSets) { dependsOn nativeTest }
35    }
36}
37