Files
ZomboidForge/gradle-plugin/build.gradle.kts
T

65 lines
2.4 KiB
Kotlin

// Gradle plugins for mod authors (ids dev.overlord.zomboidforge for settings.gradle.kts and
// dev.overlord.zomboidforge.mod): dependencies, mod.toml, build-time checks, packaging, and a
// local test server. Runs inside the mod's Gradle JVM, so it targets Java 17; the checks run in
// a separate Java 25 process (mod-tools).
plugins {
id("zomboidforge.java-conventions")
id("zomboidforge.publishing")
`java-gradle-plugin`
}
tasks.withType<JavaCompile>().configureEach {
options.release = 17
}
gradlePlugin {
plugins {
create("mod") {
id = "dev.overlord.zomboidforge.mod"
implementationClass = "dev.overlord.zomboidforge.gradle.ZomboidForgeModPlugin"
displayName = "ZomboidForge mod"
description = "Builds, checks, and packages server-side Java mods for ZomboidForge."
}
create("settings") {
id = "dev.overlord.zomboidforge"
implementationClass = "dev.overlord.zomboidforge.gradle.ZomboidForgeSettingsPlugin"
displayName = "ZomboidForge mod project"
description = "Makes a ZomboidForge mod project a single settings.gradle.kts."
}
}
}
tasks.processResources {
// The plugin resolves api and mod-tools in its own version.
val pluginVersion = project.version.toString()
inputs.property("version", pluginVersion)
filesMatching("**/plugin.properties") { expand("version" to pluginVersion) }
}
dependencies {
testImplementation(libs.bundles.asm)
testImplementation(platform(libs.junit.bom))
testImplementation(libs.junit.jupiter)
testRuntimeOnly(libs.junit.platform.launcher)
}
tasks.test {
// The functional tests resolve api and mod-tools from the repository in build/repo, the
// updater tests the plugin as well.
dependsOn(
":api:publishAllPublicationsToBuildRepository",
":mod-tools:publishAllPublicationsToBuildRepository",
"publishAllPublicationsToBuildRepository",
)
val repository = layout.settingsDirectory.dir("build/repo").asFile.absolutePath
systemProperty("zomboidforge.testRepository", repository)
// The updater tests run zomboidforge.jsh with the wrapper of the repository root.
val root = layout.settingsDirectory.asFile.absolutePath
inputs.file(layout.settingsDirectory.file("zomboidforge.jsh"))
systemProperty("zomboidforge.root", root)
}