-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
285 lines (219 loc) · 7.54 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
import com.company.team.project.dsl.model.enum_.*
import com.company.team.project.dsl.model.extension.*
import com.github.salomonbrys.gradle.kotlin.js.jstests.node.Engine.Companion.mocha
plugins {
kotlin("multiplatform")
id("maven-publish")
id("com.github.salomonbrys.gradle.kotlin.js.mpp-tests.node")
}
kotlin {
configureTargetAttributes(ModuleEnum.`common-multiple_sources`)
// targets.all {
// compilations.all {
// tasks[compileKotlinTaskName].kotlinOptions {
// allWarningsAsErrors = true
// }
// }
// }
androidNativeArm32(TargetEnum.`library-single_source@android_native_arm32`) {
}
androidNativeArm64(TargetEnum.`library-single_source@android_native_arm64`) {
}
iosArm32(TargetEnum.`library-single_source@ios_arm32`) {
binaries {
framework {}
}
}
iosArm64(TargetEnum.`library-single_source@ios_arm64`) {
binaries {
framework {}
}
}
iosX64(TargetEnum.`library-single_source@ios_x64`) {
binaries {
framework {}
}
}
js(TargetEnum.`library-single_source@js`) {
kotlinJsNodeTests {
thisTarget {
engine = mocha
}
}
configure(listOf(compilations[CompilationEnum.main.id!!], compilations[CompilationEnum.test.id!!])) {
tasks.getByName(compileKotlinTaskName) {
kotlinOptions {
// languageVersion = "1.3"
metaInfo = true
sourceMap = true
sourceMapEmbedSources = "always"
moduleKind = "umd"
}
}
}
configure(listOf(compilations[CompilationEnum.main.id!!])) {
tasks.getByName(compileKotlinTaskName) {
kotlinOptions {
// outputFile = "${project.buildDir.path}/js/${project.name}.js"
main = "call"
}
}
}
}
jvm(TargetEnum.`library-single_source@jvm`) {
}
linuxArm32Hfp(TargetEnum.`library-single_source@linux_arm32_hfp`) {
}
linuxMips32(TargetEnum.`library-single_source@linux_mips32`) {
}
linuxMipsel32(TargetEnum.`library-single_source@linux_mipsel32`) {
}
linuxX64(TargetEnum.`library-single_source@linux_x64`) {
}
macosX64(TargetEnum.`library-single_source@macos_x64`) {
}
mingwX64(TargetEnum.`library-single_source@mingw_x64`) {
}
wasm32(TargetEnum.`library-single_source@wasm32`) {
}
sourceSets {
all {
val sourceSetEnum =
when (name) {
SourceSetEnum.`common-single_source@common@main`.kotlinId -> SourceSetEnum.`common-single_source@common@main`
SourceSetEnum.`common-single_source@common@test`.kotlinId -> SourceSetEnum.`common-single_source@common@test`
else -> SourceSetEnum.getByKotlinIdAndModule(name, ModuleEnum.`library-single_source`)!!
}
if (CompilationEnum.main == sourceSetEnum.compilation) {
kotlin.srcDir(getMainSourcesPath(sourceSetEnum))
resources.srcDir(getMainResourcesPath(sourceSetEnum))
} else if (CompilationEnum.test == sourceSetEnum.compilation) {
kotlin.srcDir(getTestSourcesPath(sourceSetEnum))
resources.srcDir(getTestResourcesPath(sourceSetEnum))
}
// languageSettings {
// progressiveMode = true
// }
}
configureSourceSet(SourceSetEnum.`library-single_source@common@main`) {
dependencies {
implementation(kotlin("stdlib-common"))
}
// languageSettings {
// languageVersion = "1.3" // possible values: "1.0", "1.1", "1.2", "1.3"
// apiVersion = "1.3" // possible values: "1.0", "1.1", "1.2", "1.3"
// enableLanguageFeature("InlineClasses") // language feature name
// useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes") // annotation FQ-name
// progressiveMode = true // false by default
// }
}
configureSourceSet(SourceSetEnum.`library-single_source@common@test`) {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
configureSourceSet(SourceSetEnum.`library-single_source@android_native_arm32@main`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@android_native_arm32@test`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@android_native_arm64@main`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@android_native_arm64@test`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@ios_arm32@main`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@ios_arm32@test`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@ios_arm64@main`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@ios_arm64@test`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@ios_x64@main`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@ios_x64@test`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@js@main`) {
dependencies {
implementation(kotlin("stdlib-js"))
}
}
configureSourceSet(SourceSetEnum.`library-single_source@js@test`) {
dependencies {
implementation(kotlin("test-js"))
}
}
configureSourceSet(SourceSetEnum.`library-single_source@jvm@main`) {
dependencies {
implementation(kotlin("stdlib-jdk8"))
}
}
configureSourceSet(SourceSetEnum.`library-single_source@jvm@test`) {
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
}
}
configureSourceSet(SourceSetEnum.`library-single_source@linux_arm32_hfp@main`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@linux_arm32_hfp@test`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@linux_mips32@main`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@linux_mips32@test`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@linux_mipsel32@main`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@linux_mipsel32@test`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@linux_x64@main`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@linux_x64@test`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@macos_x64@main`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@macos_x64@test`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@mingw_x64@main`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@mingw_x64@test`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@wasm32@main`) {
}
configureSourceSet(SourceSetEnum.`library-single_source@wasm32@test`) {
}
}
}
//// Used in android-ios library
//configurations {
// compileClasspath
//}
fun getPath(sourceTypeEnum: SourceTypeEnum, compilationEnum: CompilationEnum, sourceSetEnum: SourceSetEnum): String {
var output = "src/${compilationEnum.id!!}/${sourceTypeEnum.id!!}"
if (SourceTypeEnum.kotlin == sourceTypeEnum) {
output += "/${project.module.group!!.replace(".", "/")}/${project.module.path}"
}
if (sourceSetEnum.target?.preset?.name != null) {
output += "/" + sourceSetEnum.target?.preset?.name
}
output += "/common"
return output
}
fun getSourcesPath(compilationEnum: CompilationEnum, sourceSetEnum: SourceSetEnum): String {
return getPath(SourceTypeEnum.kotlin, compilationEnum, sourceSetEnum)
}
fun getResourcesPath(compilationEnum: CompilationEnum, sourceSetEnum: SourceSetEnum): String {
return getPath(SourceTypeEnum.resources, compilationEnum, sourceSetEnum)
}
fun getMainSourcesPath(sourceSetEnum: SourceSetEnum): String {
return getSourcesPath(CompilationEnum.main, sourceSetEnum)
}
fun getTestSourcesPath(sourceSetEnum: SourceSetEnum): String {
return getSourcesPath(CompilationEnum.test, sourceSetEnum)
}
fun getMainResourcesPath(sourceSetEnum: SourceSetEnum): String {
return getResourcesPath(CompilationEnum.main, sourceSetEnum)
}
fun getTestResourcesPath(sourceSetEnum: SourceSetEnum): String {
return getResourcesPath(CompilationEnum.test, sourceSetEnum)
}