1
+ import org.jetbrains.kotlin.konan.target.HostManager
2
+
1
3
plugins {
2
4
id ' org.jetbrains.kotlin.multiplatform'
3
5
id ' org.jetbrains.kotlin.plugin.allopen' version " 1.3.20"
@@ -24,6 +26,9 @@ repositories.all {
24
26
}
25
27
}
26
28
29
+ project. ext. hostManager = new HostManager ()
30
+ apply from : rootProject. file(" gradle/utility.gradle" )
31
+
27
32
// how to apply plugin to a specific source set?
28
33
allOpen {
29
34
annotation(" org.openjdk.jmh.annotations.State" )
@@ -53,11 +58,24 @@ kotlin {
53
58
}
54
59
}
55
60
}
56
-
57
- // For ARM, preset should be changed to presets.iosArm32 or presets.iosArm64
58
- // For Linux, preset should be changed to e.g. presets.linuxX64
59
- // For MacOS, preset should be changed to e.g. presets.macosX64
60
- macosX64(' native' )
61
+
62
+ if (project. ext. ideaActive) {
63
+ targets {
64
+ project. ext. nativeTarget = fromPreset(project. ext. ideaPreset, ' native' )
65
+ }
66
+ } else {
67
+ macosX64(' macosX64' )
68
+ linuxX64(' linuxX64' )
69
+ mingwX64(' windowsX64' )
70
+ }
71
+
72
+ sourceSets. all {
73
+ languageSettings {
74
+ progressiveMode = true
75
+ useExperimentalAnnotation(" kotlin.Experimental" )
76
+ useExperimentalAnnotation(' kotlin.ExperimentalUnsignedTypes' )
77
+ }
78
+ }
61
79
62
80
sourceSets {
63
81
commonMain {
@@ -93,14 +111,27 @@ kotlin {
93
111
implementation ' org.jetbrains.kotlin:kotlin-test-js'
94
112
}
95
113
}
96
- nativeMain {
97
- }
98
- nativeTest {
114
+
115
+ if (ideaActive) {
116
+ nativeMain {
117
+ kotlin. srcDir(" src/${ project.ext.nativeTarget.preset.name} Main" )
118
+ }
119
+ } else {
120
+ nativeMain {}
121
+ nativeTest {}
122
+
123
+ configure([linuxX64Main, macosX64Main, windowsX64Main]) {
124
+ dependsOn nativeMain
125
+ }
126
+
127
+ configure([linuxX64Test, macosX64Test, windowsX64Test]) {
128
+ dependsOn nativeTest
129
+ }
99
130
}
100
- }
101
131
102
- sourceSets. all {
103
- languageSettings. progressiveMode = true
132
+ nativeMain. dependencies {
133
+
134
+ }
104
135
}
105
136
}
106
137
0 commit comments