forked from ZacSweers/redacted-compiler-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
133 lines (122 loc) · 3.28 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
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.KotlinMultiplatform
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
plugins {
kotlin("multiplatform")
id("org.jetbrains.dokka")
id("com.vanniktech.maven.publish.base")
}
/*
* Here's the main hierarchy of variants. Any `expect` functions in one level of the tree are
* `actual` functions in a (potentially indirect) child node.
*
* ```
* common
* |-- jvm
* |-- js
* '-- native
* |- unix
* | |-- apple
* | | |-- iosArm64
* | | |-- iosX64
* | | |-- macosX64
* | | |-- tvosArm64
* | | |-- tvosX64
* | | |-- watchosArm32
* | | |-- watchosArm64
* | | '-- watchosX86
* | '-- linux
* | '-- linuxX64
* '-- mingw
* '-- mingwX64
* ```
*
* Every child of `unix` also includes a source set that depends on the pointer size:
*
* * `sizet32` for watchOS, including watchOS 64-bit architectures
* * `sizet64` for everything else
*/
kotlin {
val kmpNativeEnabled = System.getProperty("knative", "true").toBoolean()
val kmpJsEnabled = System.getProperty("kjs", "true").toBoolean()
jvm()
if (kmpJsEnabled) {
js(BOTH) {
compilations.all {
kotlinOptions {
moduleKind = "umd"
sourceMap = true
metaInfo = true
}
}
nodejs { testTask { useMocha { timeout = "30s" } } }
browser()
}
}
if (kmpNativeEnabled) {
configureOrCreateNativePlatforms()
}
}
fun KotlinMultiplatformExtension.configureOrCreateNativePlatforms() {
iosX64()
iosArm64()
iosSimulatorArm64()
tvosX64()
tvosArm64()
tvosSimulatorArm64()
watchosArm32()
watchosArm64()
watchosX86()
watchosX64()
watchosSimulatorArm64()
// Required to generate tests tasks: https://youtrack.jetbrains.com/issue/KT-26547
linuxX64()
macosX64()
macosArm64()
mingwX64()
}
val appleTargets =
listOf(
"iosArm64",
"iosX64",
"iosSimulatorArm64",
"macosX64",
"macosArm64",
"tvosArm64",
"tvosX64",
"tvosSimulatorArm64",
"watchosArm32",
"watchosArm64",
"watchosX86",
"watchosX64",
"watchosSimulatorArm64")
val mingwTargets = listOf("mingwX64", "mingwX86")
val linuxTargets = listOf("linuxX64")
val nativeTargets = appleTargets + linuxTargets + mingwTargets
/** Note that size_t is 32-bit on legacy watchOS versions (ie. pointers are always 32-bit). */
val unixSizet32Targets = listOf("watchosArm32", "watchosArm64", "watchosX86")
val unixSizet64Targets =
listOf(
"iosArm64",
"iosX64",
"iosSimulatorArm64",
"linuxX64",
"macosX64",
"macosArm64",
"tvosArm64",
"tvosX64",
"tvosSimulatorArm64",
"watchosSimulatorArm64",
"watchosX64")
configure<MavenPublishBaseExtension> {
configure(KotlinMultiplatform(javadocJar = JavadocJar.Dokka("dokkaGfm")))
}
// https://youtrack.jetbrains.com/issue/KT-46978
tasks.withType<ProcessResources>().all {
when (name) {
"jvmTestProcessResources", "jvmProcessResources" -> {
duplicatesStrategy = DuplicatesStrategy.WARN
}
}
}