-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle.kts
185 lines (163 loc) · 4.45 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
import java.util.Properties
plugins {
kotlin("multiplatform") version "1.9.25"
id("com.vanniktech.maven.publish") version "0.30.0"
id("com.android.library") version "8.7.3"
}
group = "ca.gosyer"
version = "1.1.0"
kotlin {
jvm {
compilations.all {
kotlinOptions.jvmTarget = "1.8"
}
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
macosX64()
macosArm64()
linuxX64()
linuxArm64()
mingwX64()
androidTarget {
publishLibraryVariants("release")
compilations.all {
kotlinOptions.jvmTarget = "1.8"
}
}
@OptIn(org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi::class)
applyHierarchyTemplate {
common {
group("macosNative") {
withMacosX64()
withMacosArm64()
}
group("mingwNative") {
withMingwX64()
}
group("linuxNative") {
withLinuxX64()
withLinuxArm64()
}
}
}
sourceSets {
val commonMain by getting
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
// Mac OS
val macosMain by creating {
dependsOn(commonMain)
}
val macosTest by creating {
dependsOn(commonTest)
}
// Unix
val unixMain by creating {
dependsOn(commonMain)
}
val unixTest by creating {
dependsOn(commonTest)
}
// Windows
val windowsMain by creating {
dependsOn(commonMain)
}
val windowsTest by creating {
dependsOn(commonTest)
}
// Native
val nativeMain by creating {
dependsOn(commonMain)
}
val nativeTest by creating {
dependsOn(commonTest)
}
// JVM
val jvmMain by getting {
dependsOn(macosMain)
dependsOn(unixMain)
dependsOn(windowsMain)
dependencies {
implementation("net.java.dev.jna:jna-platform:5.16.0")
}
}
val jvmTest by getting {
dependsOn(macosTest)
dependsOn(unixTest)
dependsOn(windowsTest)
}
// Mac OS Native
getByName("macosNativeMain") {
dependsOn(nativeMain)
dependsOn(macosMain)
}
getByName("macosNativeTest") {
dependsOn(nativeTest)
dependsOn(macosTest)
}
// Linux
getByName("linuxNativeMain") {
dependsOn(nativeMain)
dependsOn(unixMain)
}
getByName("linuxNativeTest") {
dependsOn(nativeTest)
dependsOn(unixTest)
}
// Mingw
getByName("mingwNativeMain") {
dependsOn(nativeMain)
dependsOn(windowsMain)
}
getByName("mingwNativeTest") {
dependsOn(nativeTest)
dependsOn(windowsTest)
}
// android
val androidMain by getting {
dependsOn(commonMain)
}
val androidInstrumentedTest by getting {
dependencies {
implementation("androidx.test.ext:junit-ktx:1.2.1")
implementation("androidx.test.espresso:espresso-core:3.6.1")
implementation("androidx.test:runner:1.6.2")
}
}
}
}
// Read in the signing.properties file if it exists
val signingPropsFile: File = rootProject.file("release/signing.properties")
if (signingPropsFile.exists()) {
Properties().apply {
signingPropsFile.inputStream().use {
load(it)
}
}.forEach { key1, value1 ->
val key = key1.toString()
val value = value1.toString()
if (key == "signing.secretKeyRingFile") {
// If this is the key ring, treat it as a relative path
project.ext.set(key, rootProject.file(value).absolutePath)
} else {
project.ext.set(key, value)
}
}
}
android {
namespace = "ca.gosyer"
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
compileSdk = 34
minSdk = 21
}
compileOptions {
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
}
}