-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.gradle.kts
80 lines (71 loc) · 2.12 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
import io.github.petertrr.configurePublishing
import io.github.petertrr.configureVersioning
import org.jetbrains.kotlin.gradle.targets.jvm.tasks.KotlinJvmTest
plugins {
kotlin("multiplatform") version "1.5.0"
jacoco
id("com.github.ben-manes.versions") version "0.38.0"
}
configureVersioning()
group = "io.github.petertrr"
description = "A multiplatform Kotlin library for calculating text differences"
repositories {
mavenCentral()
}
kotlin {
explicitApi()
jvm()
js(BOTH) {
browser()
nodejs()
}
// setup native compilation
linuxX64()
mingwX64()
macosX64()
sourceSets {
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
// platform-specific dependencies are needed to use actual test runners
val jvmTest by getting {
dependencies {
implementation(kotlin("test-junit5"))
implementation("org.junit.jupiter:junit-jupiter-engine:5.7.1")
}
}
val jsTest by getting {
dependencies {
implementation(kotlin("test-js"))
}
}
}
}
configurePublishing()
tasks.withType<KotlinJvmTest> {
useJUnitPlatform()
}
// configure Jacoco-based code coverage reports for JVM tests executions
jacoco {
toolVersion = "0.8.7"
}
val jvmTestTask by tasks.named<KotlinJvmTest>("jvmTest") {
configure<JacocoTaskExtension> {
// this is needed to generate jacoco/jvmTest.exec
isEnabled = true
}
}
val jacocoTestReportTask by tasks.register<JacocoReport>("jacocoTestReport") {
executionData(jvmTestTask.extensions.getByType(JacocoTaskExtension::class.java).destinationFile)
additionalSourceDirs(kotlin.sourceSets["commonMain"].kotlin.sourceDirectories)
classDirectories.setFrom(file("$buildDir/classes/kotlin/jvm"))
reports {
xml.isEnabled = true
html.isEnabled = true
}
}
jvmTestTask.finalizedBy(jacocoTestReportTask)
jacocoTestReportTask.dependsOn(jvmTestTask)