-
Notifications
You must be signed in to change notification settings - Fork 50
/
build.gradle.kts
122 lines (102 loc) · 3.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
/*
Copyright 2018-2023 Charles Korn.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import com.charleskorn.kaml.build.configureAssemble
import com.charleskorn.kaml.build.configurePublishing
import com.charleskorn.kaml.build.configureSpotless
import com.charleskorn.kaml.build.configureTesting
import com.charleskorn.kaml.build.configureVersioning
import com.charleskorn.kaml.build.configureWrapper
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrLink
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("multiplatform")
kotlin("plugin.serialization")
id("io.kotest.multiplatform") version "5.9.1"
}
group = "com.charleskorn.kaml"
repositories {
mavenCentral()
}
kotlin {
explicitApi()
jvm {
withJava()
}
js(IR) {
browser {
testTask {
// TODO: enable once the tests work with Kotlin/JS.
enabled = false
}
}
nodejs {
testTask {
// TODO: enable once the tests work with Kotlin/JS.
enabled = false
}
}
binaries.executable()
}
wasmJs {
binaries.library()
browser()
nodejs()
}
sourceSets {
commonMain {
dependencies {
api("org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.0")
implementation("it.krzeminski:snakeyaml-engine-kmp:3.0.0")
implementation("com.squareup.okio:okio:3.9.0")
}
}
commonTest {
dependencies {
implementation("io.kotest:kotest-assertions-core:5.9.1")
implementation("io.kotest:kotest-framework-api:5.9.1")
implementation("io.kotest:kotest-framework-engine:5.9.1")
implementation("io.kotest:kotest-framework-datatest:5.9.1")
}
}
jvmTest {
dependencies {
implementation("io.kotest:kotest-runner-junit5:5.9.1")
}
}
}
}
tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
}
}
tasks.withType<KotlinJsIrLink>().configureEach {
compilerOptions {
// Catching IndexOutOfBoundsException in Kotlin/Wasm is impossible by default,
// unless we enable "-Xwasm-enable-array-range-checks" compiler flag.
// We rely on it in the tests, see https://github.com/charleskorn/kaml/blob/108b48fb560559f0d0724559bb8c7fff631503f9/src/commonTest/kotlin/com/charleskorn/kaml/YamlListTest.kt#L79
// See https://youtrack.jetbrains.com/issue/KT-59081/
freeCompilerArgs.add("-Xwasm-enable-array-range-checks")
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
configureAssemble()
configurePublishing()
configureSpotless()
configureTesting()
configureVersioning()
configureWrapper()