forked from saveourtool/osv4k
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
77 lines (71 loc) · 1.93 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
import com.saveourtool.osv4k.buildutils.configurePublishing
import com.saveourtool.osv4k.buildutils.createDetektTask
plugins {
id("com.saveourtool.osv4k.buildutils.kotlin-library")
}
group = "com.saveourtool.cosv4k"
repositories {
mavenCentral()
}
kotlin {
jvm {
withJava()
compilations.all {
kotlinOptions.jvmTarget = "1.8"
}
}
val nonJvmTargets = setOf(
linuxX64(),
mingwX64(),
macosX64(),
js(IR) {
browser()
nodejs()
useCommonJs()
}
)
// store yarn.lock in the root directory
rootProject.extensions.configure<org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension> {
lockFileDirectory = rootProject.projectDir
}
sourceSets {
val commonMain by getting {
dependencies {
api(libs.kotlinx.serialization.json)
api(libs.kotlinx.datetime)
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
implementation(libs.jetbrains.annotations)
}
}
val commonNonJvmMain by creating {
dependsOn(commonMain)
}
nonJvmTargets.forEach { nativeTarget ->
getByName("${nativeTarget.name}Main").dependsOn(commonNonJvmMain)
}
val jvmMain by getting {
dependencies {
api(libs.jackson.annotations)
api(libs.jackson.databind)
}
}
val jvmTest by getting {
dependsOn(commonTest)
dependencies {
implementation(kotlin("test-junit5"))
}
}
}
}
createDetektTask()
configurePublishing()
setOf("compileJava", "compileTestJava").forEach { taskName ->
tasks.named<JavaCompile>(taskName) {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
}
}