-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
195 lines (161 loc) · 4.57 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
@file:OptIn(ExperimentalWasmDsl::class, ExperimentalKotlinGradlePluginApi::class)
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.licenser)
alias(libs.plugins.kotlinSerialization)
id("maven-publish")
}
group = "dev.nikdekur"
version = "1.4.5"
val authorId: String by project
val authorName: String by project
repositories {
mavenCentral().apply {
content {
excludeGroup("Kotlin/Native")
}
}
mavenLocal().apply {
content {
excludeGroup("Kotlin/Native")
}
}
google().apply {
content {
excludeGroup("Kotlin/Native")
}
}
maven {
name = "Sonatype Snapshots (Legacy)"
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
}.apply {
content {
excludeGroup("Kotlin/Native")
}
}
maven {
name = "Sonatype Snapshots"
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots")
}.apply {
content {
excludeGroup("Kotlin/Native")
}
}
}
kotlin {
explicitApi()
val javaVersion = JavaVersion.VERSION_1_8
jvm {
compilations.all {
kotlinOptions.jvmTarget = javaVersion.toString()
}
compilerOptions {
freeCompilerArgs.addAll("-Xno-param-assertions", "-Xno-call-assertions")
}
}
// iOS
// iosX64()
// iosArm64()
// iosSimulatorArm64()
// Desktop
// mingwX64()
// linuxX64()
// linuxArm64()
// macosX64()
// macosArm64()
// Web
js {
moduleName = project.name
browser()
nodejs()
}
wasmJs {
moduleName = project.name + "Wasm"
browser()
nodejs()
}
sourceSets {
commonMain.dependencies {
// Kotlin require both api and compileOnly for some targets
val dependencies = listOf(
libs.kotlinx.coroutines.core,
libs.kotlinx.serialization.core,
libs.kotlinx.serialization.json,
libs.kotlinx.serialization.properties,
libs.kotlinx.datetime,
libs.kotlinx.io.core,
libs.kotlin.logging,
libs.stately.concurrency,
libs.bignum,
libs.kaml,
libs.koin,
kotlin("test")
).forEach {
compileOnly(it)
api(it)
}
}
jvmMain.dependencies {
compileOnly(libs.slf4j.api)
compileOnly(libs.google.guava)
}
commonTest.dependencies {
implementation(libs.slf4j.api)
implementation(libs.kotlin.logging)
implementation(libs.bignum)
implementation(libs.kotlinx.coroutines.test)
implementation(kotlin("test"))
// Logback is not supported on jdk-8
implementation(libs.slf4j.simple)
implementation(libs.koin)
implementation(libs.google.guava)
implementation(libs.kotlinx.serialization.core)
implementation(libs.kotlinx.serialization.properties)
}
}
}
license {
header(project.file("HEADER"))
properties {
set("year", "2024-present")
set("name", authorName)
}
}
val repoUsernameProp = "NDK_REPO_USERNAME"
val repoPasswordProp = "NDK_REPO_PASSWORD"
val repoUsername: String? = System.getenv(repoUsernameProp)
val repoPassword: String? = System.getenv(repoPasswordProp)
if (repoUsername.isNullOrBlank() || repoPassword.isNullOrBlank()) {
throw GradleException("Environment variables $repoUsernameProp and $repoPasswordProp must be set.")
}
publishing {
repositories {
maven {
name = "ndk-repo"
url = uri("https://repo.nikdekur.tech/releases")
credentials {
username = repoUsername
password = repoPassword
}
}
mavenLocal()
}
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
pom {
developers {
developer {
id.set(authorId)
name.set(authorName)
}
}
}
from(components["kotlin"])
}
}
}