113 lines
3.7 KiB
Kotlin
113 lines
3.7 KiB
Kotlin
plugins {
|
|
id("org.springframework.boot") version "4.0.6"
|
|
id("io.spring.dependency-management") version "1.1.7"
|
|
id("org.jlleitschuh.gradle.ktlint") version "14.2.0"
|
|
kotlin("jvm") version "2.4.21"
|
|
kotlin("plugin.spring") version "2.4.21"
|
|
}
|
|
|
|
group = "de.javagil.werkrevisor"
|
|
// Follows werkrevisor/__init__.py: the usage record and the service that stores it change together.
|
|
version = "0.65.0"
|
|
|
|
java {
|
|
toolchain {
|
|
languageVersion = JavaLanguageVersion.of(25)
|
|
// Temurin for all werk repositories (werkregie ADR 0001):
|
|
// a runtime jlinked from Debian's OpenJDK needs a newer glibc than Hostsharing hosts have, see Werkator PR#62.
|
|
vendor = JvmVendorSpec.ADOPTIUM
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
implementation("org.springframework.boot:spring-boot-starter-web")
|
|
implementation("org.springframework.boot:spring-boot-starter-jdbc")
|
|
implementation("org.jetbrains.kotlin:kotlin-reflect")
|
|
implementation("tools.jackson.module:jackson-module-kotlin")
|
|
implementation("org.xerial:sqlite-jdbc:3.50.3.0")
|
|
|
|
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
|
testImplementation("org.springframework.boot:spring-boot-starter-webmvc-test")
|
|
testImplementation("io.kotest:kotest-runner-junit5:6.1.5")
|
|
testImplementation("io.kotest:kotest-assertions-core:6.1.5")
|
|
testImplementation("io.kotest:kotest-extensions-spring:6.1.5")
|
|
}
|
|
|
|
springBoot {
|
|
// The dashboard's footer shows the version of the running service.
|
|
buildInfo()
|
|
}
|
|
|
|
kotlin {
|
|
compilerOptions {
|
|
freeCompilerArgs.addAll("-Xjsr305=strict")
|
|
}
|
|
}
|
|
|
|
tasks.withType<Test> {
|
|
useJUnitPlatform()
|
|
}
|
|
|
|
// The runtime of the service on mih09, jlinked from the Temurin toolchain (werkregie ADR 0001), as Werkator's.
|
|
// The modules come from
|
|
// jdeps -q --ignore-missing-deps --multi-release 25 --print-module-deps --class-path "BOOT-INF/lib/*" \
|
|
// BOOT-INF/classes BOOT-INF/lib/*.jar
|
|
// over the unpacked boot jar, plus those that jdeps cannot see: java.logging (Tomcat JULI),
|
|
// java.naming (Spring's JNDI lookup), jdk.crypto.ec (TLS), jdk.management (OS metrics), jdk.zipfs (nested jars).
|
|
val runtimeModules =
|
|
listOf(
|
|
"java.base",
|
|
"java.compiler",
|
|
"java.desktop",
|
|
"java.instrument",
|
|
"java.logging",
|
|
"java.management",
|
|
"java.naming",
|
|
"java.net.http",
|
|
"java.prefs",
|
|
"java.scripting",
|
|
"java.security.jgss",
|
|
"java.sql.rowset",
|
|
"jdk.crypto.ec",
|
|
"jdk.jfr",
|
|
"jdk.management",
|
|
"jdk.unsupported",
|
|
"jdk.zipfs",
|
|
)
|
|
|
|
tasks.register<Exec>("runtime") {
|
|
description = "Cuts the runtime of the service with jlink into build/runtime."
|
|
val output = layout.buildDirectory.dir("runtime")
|
|
val jdk = javaToolchains.launcherFor(java.toolchain).map { it.metadata.installationPath }
|
|
outputs.dir(output)
|
|
doFirst {
|
|
delete(output)
|
|
val jlink = jdk.get().file("bin/jlink")
|
|
executable = jlink.asFile.absolutePath
|
|
}
|
|
args(
|
|
"--add-modules",
|
|
runtimeModules.joinToString(","),
|
|
"--strip-debug",
|
|
"--no-header-files",
|
|
"--no-man-pages",
|
|
"--compress=zip-6",
|
|
"--output",
|
|
output.get().asFile.absolutePath,
|
|
)
|
|
}
|
|
|
|
// The dependency management of Spring Boot aligns every Kotlin artifact with the Kotlin plugin, but ktlint
|
|
// parses only with the compiler it was built against: 2.1.0 for ktlint 1.5.0, the default of the ktlint plugin.
|
|
configurations
|
|
.matching { it.name.startsWith("ktlint") }
|
|
.configureEach {
|
|
resolutionStrategy.eachDependency {
|
|
if (requested.group == "org.jetbrains.kotlin") useVersion("2.1.0")
|
|
}
|
|
}
|