forked from Synt4xErr0r4/json5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
123 lines (101 loc) · 3.15 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
123
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.7.10"
jacoco
`java-library`
id("me.qoomon.git-versioning") version "5.1.1"
`maven-publish`
}
dependencies {
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
val kotlinxSerializationVersion = "1.3.3"
implementation(platform("org.jetbrains.kotlinx:kotlinx-serialization-bom:$kotlinxSerializationVersion"))
api("org.jetbrains.kotlinx:kotlinx-serialization-core:$kotlinxSerializationVersion")
api("org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinxSerializationVersion")
val junitVersion = "5.8.2"
testImplementation(platform("org.junit:junit-bom:$junitVersion"))
testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher") {
because("Only needed to run tests in a version of IntelliJ IDEA that bundles older versions")
}
val kotestVersion = "5.3.1"
testImplementation(platform("io.kotest:kotest-bom:$kotestVersion"))
testImplementation("io.kotest:kotest-runner-junit5:$kotestVersion")
testImplementation("io.kotest:kotest-assertions-core:$kotestVersion")
testImplementation("io.kotest:kotest-property:$kotestVersion")
testImplementation("io.kotest:kotest-assertions-json:$kotestVersion")
}
group = "at.syntaxerror"
description = "JSON5 for Kotlin"
version = "0.0.0-SNAPSHOT"
gitVersioning.apply {
refs {
branch(".+") { version = "\${ref}-SNAPSHOT" }
tag("v(?<version>.*)") { version = "\${ref.version}" }
}
// optional fallback configuration in case of no matching ref configuration
rev { version = "\${commit}" }
}
java {
withJavadocJar()
withSourcesJar()
}
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "1.8"
apiVersion = "1.7"
languageVersion = "1.7"
}
kotlinOptions.freeCompilerArgs += listOf(
"-opt-in=kotlin.RequiresOptIn",
"-opt-in=kotlin.ExperimentalStdlibApi",
"-opt-in=kotlin.time.ExperimentalTime",
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
)
}
tasks.withType<Test> {
useJUnitPlatform()
// report is always generated after tests run
finalizedBy(tasks.withType<JacocoReport>())
}
jacoco {
toolVersion = "0.8.8"
}
tasks.withType<JacocoReport> {
dependsOn(tasks.withType<Test>())
reports {
xml.required.set(true)
html.required.set(true)
csv.required.set(false)
}
doLast {
val htmlReportLocation = reports.html.outputLocation.locationOnly
.map { it.asFile.resolve("index.html").invariantSeparatorsPath }
logger.lifecycle("Jacoco report for ${project.name}: ${htmlReportLocation.get()}")
}
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
tasks.wrapper {
gradleVersion = "7.5"
distributionType = Wrapper.DistributionType.ALL
}
tasks.assemble { dependsOn(tasks.wrapper) }
tasks.javadoc {
if (JavaVersion.current().isJava9Compatible) {
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
}
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
}
}
}