-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
83 lines (71 loc) · 2 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
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
plugins {
`java-library`
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlinx.serialization)
alias(libs.plugins.ktlint)
alias(libs.plugins.versions)
`maven-publish`
}
println("Kotlin v${KotlinVersion.CURRENT}")
println("Java v${System.getProperty("java.version")}")
println("Arch: ${System.getProperty("os.arch")}")
group = "github.buriedincode"
version = "0.2.3"
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
implementation(libs.bundles.kotlinx.serialization)
implementation(libs.kotlin.logging)
runtimeOnly(libs.sqlite.jdbc)
testImplementation(libs.junit.jupiter.api)
testRuntimeOnly(libs.junit.jupiter.engine)
testRuntimeOnly(libs.kotlin.reflect)
testRuntimeOnly(libs.log4j2.slf4j2.impl)
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
kotlin {
jvmToolchain(17)
}
configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
version = "1.5.0"
}
tasks.test {
environment("METRON__USERNAME", System.getenv("METRON__USERNAME"))
environment("METRON__PASSWORD", System.getenv("METRON__PASSWORD"))
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}
tasks.withType<DependencyUpdatesTask> {
gradleReleaseChannel = "current"
resolutionStrategy {
componentSelection {
all {
if (isNonStable(candidate.version) && !isNonStable(currentVersion)) {
reject("Release candidate")
}
}
}
}
}
publishing {
publications {
create<MavenPublication>("kalibak") {
from(components["java"])
}
}
}