-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
129 lines (122 loc) · 3.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
plugins {
kotlin("multiplatform")
id("sunnychung.publication")
}
version = "1.1.0"
repositories {
mavenCentral()
}
kotlin {
jvm {
jvmToolchain(8)
withJava()
testRuns.named("test") {
executionTask.configure {
useJUnitPlatform()
}
}
}
js {
browser {
commonWebpackConfig {
cssSupport {
enabled.set(true)
}
}
testTask {
useMocha {
timeout = "11s"
}
}
}
nodejs {
testTask {
useMocha {
timeout = "11s"
}
}
}
}
// val hostOs = System.getProperty("os.name")
// val isArm64 = System.getProperty("os.arch") == "aarch64"
// val isMingwX64 = hostOs.startsWith("Windows")
// val nativeTarget = when {
// hostOs == "Mac OS X" && isArm64 -> macosArm64("native")
// hostOs == "Mac OS X" && !isArm64 -> macosX64("native")
// hostOs == "Linux" && isArm64 -> linuxArm64("native")
// hostOs == "Linux" && !isArm64 -> linuxX64("native")
// isMingwX64 -> mingwX64("native")
// else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
// }
val darwinTargets = listOf(
iosArm64(),
iosSimulatorArm64(),
iosX64(),
watchosArm64(),
watchosSimulatorArm64(),
watchosX64(),
tvosArm64(),
tvosSimulatorArm64(),
tvosX64(),
macosArm64(),
macosX64()
)
sourceSets {
val commonMain by getting {
dependencies {
implementation("co.touchlab:kermit:1.0.0")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val nonJsMain by creating {
dependsOn(commonMain)
}
val nonJsTest by creating {
dependsOn(commonTest)
}
val jvmMain by getting {
dependsOn(nonJsMain)
}
val jvmTest by getting
val jsMain by getting
val jsTest by getting
// val nativeMain by getting
// val nativeTest by getting
val darwinMain by creating {
// bug: Compilation failed: IrPropertyPublicSymbolImpl ...
// dependsOn(commonMain)
dependsOn(nonJsMain)
}
val darwinTest by creating {
// dependsOn(commonTest)
dependsOn(nonJsTest)
}
val iosMain by creating {
dependsOn(darwinMain)
}
val watchosMain by creating {
dependsOn(darwinMain)
}
val tvosMain by creating {
dependsOn(darwinMain)
}
val macosMain by creating {
dependsOn(darwinMain)
}
configure(darwinTargets) {
val (mainSourceSet, testSourceSet) = when {
name.startsWith("ios") -> Pair(iosMain, darwinTest)
name.startsWith("watchos") -> Pair(watchosMain, darwinTest)
name.startsWith("tvos") -> Pair(tvosMain, darwinTest)
name.startsWith("macos") -> Pair(macosMain, darwinTest)
else -> throw UnsupportedOperationException("Target $name is not supported")
}
compilations["main"].defaultSourceSet.dependsOn(mainSourceSet)
compilations["test"].defaultSourceSet.dependsOn(testSourceSet)
}
}
}