-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
261 lines (229 loc) · 7.59 KB
/
build.gradle.kts
File metadata and controls
261 lines (229 loc) · 7.59 KB
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
@file:OptIn(ExperimentalWasmDsl::class)
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
kotlin("multiplatform") version libs.versions.kotlin
kotlin("plugin.serialization") version libs.versions.kotlin
id("org.jetbrains.dokka") version libs.versions.dokka
id("io.kotest") version libs.versions.kotest
// id("io.github.gradle-nexus.publish-plugin") version libs.versions.gradle.publish
id("com.google.devtools.ksp") version libs.versions.ksp
`maven-publish`
signing
}
group = "io.github.devngho"
version = "0.2.12"
repositories {
mavenCentral()
}
val dokkaHtmlJar by tasks.registering(Jar::class) {
description = "A HTML Documentation JAR containing Dokka HTML"
from(tasks.dokkaGeneratePublicationHtml.flatMap { it.outputDirectory })
archiveClassifier.set("javadoc")
}
signing {
sign(publishing.publications)
}
publishing {
repositories {
val id: String =
if (project.hasProperty("repoUsername")) project.property("repoUsername") as String
else System.getenv("repoUsername")
val pw: String =
if (project.hasProperty("repoPassword")) project.property("repoPassword") as String
else System.getenv("repoPassword")
if (!version.toString().endsWith("SNAPSHOT")) {
maven("https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/") {
name = "ossrh-staging-api"
credentials {
username = id
password = pw
}
}
} else {
maven("https://central.sonatype.com/repository/maven-snapshots/") {
name = "ossrh-staging-api"
credentials {
username = id
password = pw
}
}
}
}
publications.withType(MavenPublication::class) {
groupId = project.group as String?
version = project.version as String?
artifact(dokkaHtmlJar)
pom {
name.set("kt_kisopenapi")
description.set("한국투자증권의 오픈 API 서비스를 Kotlin/Java 환경에서 사용할 수 있는 라이브러리")
url.set("https://github.com/devngho/kt_kisopenapi")
licenses {
license {
name.set("MIT License")
url.set("https://github.com/devngho/kt_kisopenapi/blob/master/LICENSE")
}
}
developers {
developer {
id.set("devngho")
name.set("devngho")
email.set("yjh135908@gmail.com")
}
}
scm {
connection.set("https://github.com/devngho/kt_kisopenapi.git")
developerConnection.set("https://github.com/devngho/kt_kisopenapi.git")
url.set("https://github.com/devngho/kt_kisopenapi")
}
}
}
}
kotlin {
// copied from ionspin/kotlin-multiplatform-bignum (at build.gradle.kts), Apache 2.0
// removed watchosDeviceArm64 and modified js
js {
nodejs()
browser()
}
linuxX64()
linuxArm64()
androidNativeX64()
androidNativeX86()
androidNativeArm32()
androidNativeArm64()
iosX64()
iosArm64()
iosSimulatorArm64()
macosX64()
macosArm64()
tvosArm64()
tvosSimulatorArm64()
tvosX64()
watchosArm32()
watchosArm64()
watchosX64()
watchosSimulatorArm64()
mingwX64()
// copy end
jvm {
compilerOptions {
jvmTarget = JvmTarget.JVM_1_8
}
}
wasmJs {
browser()
nodejs()
d8()
}
// wasmWasi() // kotlinx-datetime, ktor, kotest doesn't support wasm-wasi
sourceSets {
commonMain {
kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin")
dependencies {
implementation(project(":ksp-annotations"))
implementation(libs.ktor.client.content.negotiation)
implementation(libs.ktor.serialization.kotlinx.json)
implementation(libs.ktor.client.core)
implementation(libs.ktor.client.websockets)
implementation(libs.kotlinx.coroutines.core)
api(libs.kotlinx.datetime)
api(libs.bignum)
implementation(libs.bignum.serialization.kotlinx)
implementation(libs.ktor.client.cio)
}
}
commonTest.dependencies {
implementation(libs.kotest.framework.engine)
implementation(libs.kotest.assertions.core)
implementation(libs.kotlin.test.common)
implementation(libs.kotlin.test.annotations.common)
implementation(libs.kotlin.reflect)
implementation(libs.ktor.server.core)
implementation(libs.ktor.server.cio)
implementation(libs.ktor.server.websockets)
}
jvmTest.dependencies {
implementation(libs.kotest.runner.junit5)
implementation(libs.slf4j.simple)
implementation(libs.mockk)
}
applyDefaultHierarchyTemplate()
}
}
dependencies {
add("kspCommonMainMetadata", project(":ksp-processor"))
}
tasks {
// copied from ionspin/kotlin-multiplatform-bignum (at build.gradle.kts), Apache 2.0
// fixed for correct task dependencies in this project
all {
val targets = listOf(
"AndroidNativeArm32",
"AndroidNativeArm64",
"AndroidNativeX64",
"AndroidNativeX86",
"Js",
"Jvm",
"KotlinMultiplatform",
"LinuxArm64",
"LinuxX64",
"WasmJs",
"MingwX64",
"IosArm64",
"IosSimulatorArm64",
"IosX64",
"MacosArm64",
"MacosX64",
"TvosArm64",
"TvosSimulatorArm64",
"TvosX64",
"WatchosArm32",
"WatchosArm64",
"WatchosSimulatorArm64",
"WatchosX64"
)
targets.dropLast(1).forEachIndexed { index, target ->
if (this.name.startsWith("sign${target}Publication")) {
this.mustRunAfter("sign${targets[index + 1]}Publication")
}
}
if (this.name.startsWith("publish") || this.name.startsWith("linkDebugTest") || this.name.startsWith("compileTest")) {
targets.forEach {
this.mustRunAfter("sign${it}Publication")
}
}
targets.forEach {
if (it == "KotlinMultiplatform") return@forEach
named("compileKotlin${it}") {
dependsOn("kspCommonMainKotlinMetadata")
}
named(
"${
it.let {
it[0].lowercase() + it.substring(1)
}
}SourcesJar"
) {
dependsOn("kspCommonMainKotlinMetadata")
}
}
named("sourcesJar") {
dependsOn("kspCommonMainKotlinMetadata")
}
}
// copy end
named<Test>("jvmTest") {
useJUnitPlatform()
filter {
isFailOnNoMatchingTests = false
}
testLogging @ExperimentalStdlibApi {
showExceptions = true
showStandardStreams = true
events = TestLogEvent.entries.toSet()
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
}
}