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,20 @@
|
||||
// Java agent for runtime work (mod loading, live patches). Build-time patches are in :patcher.
|
||||
|
||||
plugins {
|
||||
id("zomboidforge.java-conventions")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":api"))
|
||||
implementation(project(":core"))
|
||||
implementation(project(projectZomboid.compatProject("runtime")))
|
||||
compileOnly(files(projectZomboid.serverJar))
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
archiveBaseName = "zomboidforge-agent"
|
||||
manifest.attributes("Premain-Class" to "dev.overlord.zomboidforge.agent.ForgeAgent")
|
||||
// The agent jar is appended to the system class path and includes api, core and compat runtime.
|
||||
from(configurations.runtimeClasspath.map { classpath -> classpath.map { zipTree(it) } })
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package dev.overlord.zomboidforge.agent;
|
||||
|
||||
import dev.overlord.zomboidforge.api.ZomboidForge;
|
||||
|
||||
import java.lang.instrument.Instrumentation;
|
||||
|
||||
public final class ForgeAgent
|
||||
{
|
||||
private static Instrumentation instrumentation;
|
||||
|
||||
private ForgeAgent() {}
|
||||
|
||||
/** Runs before {@code zombie.network.GameServer.main}; Project Zomboid's logging is not initialized yet. */
|
||||
public static void premain(String args, Instrumentation inst) {
|
||||
instrumentation = inst;
|
||||
System.out.println("[ZomboidForge] Agent " + ZomboidForge.VERSION + " loaded.");
|
||||
}
|
||||
|
||||
public static Instrumentation instrumentation() {
|
||||
if (instrumentation == null) throw new IllegalStateException("ZomboidForge agent was not loaded via -javaagent");
|
||||
|
||||
return instrumentation;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user