56 lines
1.6 KiB
Kotlin
56 lines
1.6 KiB
Kotlin
plugins {
|
|
java
|
|
}
|
|
|
|
// Version: -Pversion if given, else the newest v* git tag, else 0.0.0-prerelease.
|
|
if (version == Project.DEFAULT_VERSION)
|
|
{
|
|
val latestTag = providers.exec {
|
|
workingDir = layout.settingsDirectory.asFile
|
|
commandLine("git", "describe", "--tags", "--abbrev=0", "--match", "v*")
|
|
isIgnoreExitValue = true
|
|
}
|
|
|
|
version = latestTag.standardOutput.asText
|
|
.map { it.trim().removePrefix("v") }
|
|
.orElse("")
|
|
.get()
|
|
.ifEmpty { "0.0.0-prerelease" }
|
|
}
|
|
|
|
val projectZomboid = extensions.create<ProjectZomboidExtension>("projectZomboid")
|
|
projectZomboid.serverJar.convention(
|
|
layout.settingsDirectory.file(
|
|
providers.gradleProperty("pz.jar").orElse("lib/server/java/projectzomboid.jar")
|
|
)
|
|
)
|
|
projectZomboid.version.convention(providers.gradleProperty("pz.version"))
|
|
|
|
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
|
|
dependencies {
|
|
"compileOnly"(libs.findLibrary("jetbrains-annotations").get())
|
|
"testCompileOnly"(libs.findLibrary("jetbrains-annotations").get())
|
|
}
|
|
|
|
java {
|
|
// Project Zomboid ships and runs on Java 25 (bundled Zulu jre64; class version 69).
|
|
toolchain.languageVersion = JavaLanguageVersion.of(25)
|
|
}
|
|
|
|
tasks.withType<JavaCompile>().configureEach {
|
|
options.release = 25
|
|
options.encoding = "UTF-8"
|
|
options.compilerArgs.addAll(listOf("-Xlint:all", "-Xlint:-options", "-Xlint:-path"))
|
|
}
|
|
|
|
tasks.withType<Jar>().configureEach {
|
|
manifest.attributes(
|
|
"Implementation-Title" to "ZomboidForge",
|
|
"Implementation-Version" to project.version,
|
|
)
|
|
}
|
|
|
|
tasks.withType<Test>().configureEach {
|
|
useJUnitPlatform()
|
|
}
|