-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.gradle.kts
113 lines (94 loc) · 2.59 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
@file:OptIn(ExperimentalKotlinGradlePluginApi::class)
import io.github.petertrr.configurePublishing
import io.github.petertrr.ext.booleanProperty
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest
plugins {
kotlin("multiplatform")
alias(libs.plugins.detekt)
id("jacoco-convention")
}
group = "io.github.petertrr"
description = "A multiplatform Kotlin library for calculating text differences"
dependencies {
detektPlugins(libs.detekt.formatting)
}
kotlin {
explicitApi()
compilerOptions {
apiVersion = KotlinVersion.KOTLIN_1_9
languageVersion = KotlinVersion.KOTLIN_1_9
}
jvm {
compilations.configureEach {
compileTaskProvider.configure {
compilerOptions {
// Minimum bytecode level is 52
jvmTarget = JvmTarget.JVM_1_8
// Output interfaces with default methods
freeCompilerArgs.addAll(
"-Xjvm-default=all", // Output interfaces with default methods
"-Xno-param-assertions", // Remove Intrinsics.checkNotNullParameter
)
}
}
}
testRuns.configureEach {
executionTask.configure {
useJUnitPlatform()
}
}
}
js {
val testConfig: (KotlinJsTest).() -> Unit = {
useMocha {
// Override default 2s timeout
timeout = "120s"
}
}
browser {
testTask(testConfig)
}
nodejs {
testTask(testConfig)
}
}
@OptIn(ExperimentalWasmDsl::class)
wasmJs {
browser()
nodejs()
}
@OptIn(ExperimentalWasmDsl::class)
wasmWasi {
nodejs()
}
linuxX64()
linuxArm64()
mingwX64()
macosX64()
macosArm64()
sourceSets {
commonTest {
dependencies {
implementation(kotlin("test"))
}
}
}
}
configurePublishing()
detekt {
buildUponDefaultConfig = true
config.setFrom(files("detekt.yml"))
autoCorrect = booleanProperty("detektAutoCorrect", default = true)
}
tasks {
withType<Detekt> {
named("check") {
dependsOn(this@withType)
}
}
}