Improve/add initial project structure for ZomboidForge with build system, runtime, and patching logic.
Added version support for building images.
This commit is contained in:
1 parent
bf9228d2be
commit
015e9bb2c8
32 files changed
+1268
-58
No files matched your search
@@ -0,0 +1,55 @@
|
||||
// Build-time patching engine. The patches themselves are in compat/b<major>/patches.
|
||||
|
||||
plugins {
|
||||
id("zomboidforge.java-conventions")
|
||||
}
|
||||
|
||||
// Patch set of the targeted Build; only on the class path of patchServerJar.
|
||||
val serverPatches = configurations.create("serverPatches") {
|
||||
isCanBeConsumed = false
|
||||
isCanBeResolved = true
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.bundles.asm)
|
||||
serverPatches(project(projectZomboid.compatProject("patches")))
|
||||
|
||||
testImplementation(platform(libs.junit.bom))
|
||||
testImplementation(libs.junit.jupiter)
|
||||
testRuntimeOnly(libs.junit.platform.launcher)
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
// Enables GameVersionReaderTest.readsTargetedVersionFromServerJar when the jar exists.
|
||||
val serverJar = projectZomboid.serverJar
|
||||
val targetedVersion = projectZomboid.version
|
||||
inputs.property("pzVersion", targetedVersion)
|
||||
jvmArgumentProviders.add(CommandLineArgumentProvider {
|
||||
listOf(
|
||||
"-Dpz.jar=${serverJar.get().asFile.absolutePath}",
|
||||
"-Dpz.version=${targetedVersion.get()}",
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
tasks.register<JavaExec>("patchServerJar") {
|
||||
description = "Applies the targeted Build's patches to the vanilla server jar."
|
||||
group = "build"
|
||||
|
||||
val vanillaJar = projectZomboid.serverJar
|
||||
val patchedJar = layout.buildDirectory.file("server/projectzomboid.jar")
|
||||
val expectedVersion = projectZomboid.version
|
||||
inputs.file(vanillaJar).withPropertyName("vanillaJar")
|
||||
inputs.property("expectedVersion", expectedVersion)
|
||||
outputs.file(patchedJar).withPropertyName("patchedJar")
|
||||
|
||||
classpath = sourceSets.main.get().runtimeClasspath + serverPatches
|
||||
mainClass = "dev.overlord.zomboidforge.patcher.JarPatcher"
|
||||
argumentProviders.add(CommandLineArgumentProvider {
|
||||
listOf(
|
||||
vanillaJar.get().asFile.absolutePath,
|
||||
patchedJar.get().asFile.absolutePath,
|
||||
expectedVersion.get(),
|
||||
)
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user