Compare commits
6
Commits
v0.3.0
..
22077514fe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22077514fe | ||
|
|
6761f2d9ea | ||
|
|
18ff32b5ce | ||
|
|
67530d35e9 | ||
|
|
26ca1b90a2 | ||
|
|
c529b04ff0 |
No files matched your search
@@ -15,12 +15,12 @@ jobs:
|
||||
include:
|
||||
# One entry per supported version; add older Steam version branches
|
||||
# (e.g. pz_version 42.19, steam_branch 42.19) to keep them building.
|
||||
- pz_version: "42.21"
|
||||
- pz_version: "42"
|
||||
steam_branch: public
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
with:
|
||||
# release.sh derives the version from the newest v* tag
|
||||
# release.sh derives the version from the v* tags
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Build and verify
|
||||
|
||||
@@ -9,25 +9,27 @@ on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
maven:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
with:
|
||||
# publish.sh derives the version from the newest v* tag
|
||||
# publish.sh derives the version from the v* tag on HEAD
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-java@v4
|
||||
- uses: actions/setup-java@cf277c60eb25467037889841efdb72551f06f6c3 # v4.9.1
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: "25"
|
||||
|
||||
- name: Test and publish
|
||||
# The tests run without the registry credentials; only the publish step gets them.
|
||||
- name: Test
|
||||
run: ci/publish.sh test
|
||||
|
||||
- name: Publish
|
||||
env:
|
||||
ORG_GRADLE_PROJECT_giteaUsername: ${{ secrets.REGISTRY_USER }}
|
||||
ORG_GRADLE_PROJECT_giteaPassword: ${{ secrets.REGISTRY_TOKEN }}
|
||||
PUBLISH: "true"
|
||||
run: ci/publish.sh
|
||||
run: ci/publish.sh publish
|
||||
@@ -1,12 +1,16 @@
|
||||
# Publishes an image for every new Steam build of each supported Project Zomboid
|
||||
# version. Immutable tags are never overwritten (see ci/release.sh).
|
||||
# Publishes an image for every new Project Zomboid version (hotfixes included) of each
|
||||
# matrix entry and every new ZomboidForge release; full version tags are never overwritten
|
||||
# (see ci/release.sh).
|
||||
# Requires the repository secrets REGISTRY_USER and REGISTRY_TOKEN (a token with
|
||||
# package write access) and a runner with a Docker (or Podman) CLI.
|
||||
name: release
|
||||
|
||||
on:
|
||||
# Every 2.5 hours; cron cannot divide a day into 2.5-hour steps, so the gap
|
||||
# from 22:30 to 00:00 is 1.5 hours.
|
||||
schedule:
|
||||
- cron: "0 */6 * * *"
|
||||
- cron: "0 0,5,10,15,20 * * *"
|
||||
- cron: "30 2,7,12,17,22 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
@@ -16,13 +20,13 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- pz_version: "42.21"
|
||||
- pz_version: "42"
|
||||
steam_branch: public
|
||||
latest: "true"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
with:
|
||||
# release.sh derives the version from the newest v* tag
|
||||
# release.sh derives the version from the v* tags
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Log in to the registry
|
||||
@@ -39,3 +43,8 @@ jobs:
|
||||
PUBLISH: "true"
|
||||
LATEST: ${{ matrix.latest }}
|
||||
run: ci/release.sh
|
||||
|
||||
# Removes the stored registry token, also when a step failed, in case the runner is reused.
|
||||
- name: Log out of the registry
|
||||
if: always()
|
||||
run: docker logout git.security-command.org
|
||||
+43
-6
@@ -6,6 +6,10 @@
|
||||
# podman build --platform linux/amd64 -t zomboidforge .
|
||||
# podman build --build-arg PZ_BRANCH=42.19 --build-arg PZ_VERSION=42.19 ...
|
||||
#
|
||||
# The stage game-version (--target game-version) downloads only the server jar of
|
||||
# PZ_BRANCH and writes its game version to /game-version; ci/release.sh uses it to
|
||||
# name the image before the full build.
|
||||
#
|
||||
# Build arguments:
|
||||
# PZ_BRANCH Steam branch of app 380870: public, unstable, or a version branch (42.19, ...)
|
||||
# PZ_VERSION Expected Project Zomboid version; the build fails when the downloaded
|
||||
@@ -14,7 +18,8 @@
|
||||
# files with steamcmd's newer copies
|
||||
# FORGE_VERSION ZomboidForge version (jar manifest, image label); set by ci/release.sh.
|
||||
# Default: 0.0.0-prerelease
|
||||
# STEAM_BUILDID Image label only; set by ci/release.sh
|
||||
# STEAM_BUILDID Image label; in the stage game-version it keeps the cached result until
|
||||
# Steam publishes a new build. Set by ci/release.sh
|
||||
# DISABLED_PATCHES Comma-separated simple class names of build-time patches to skip
|
||||
# (debug builds only; ci/release.sh never sets it)
|
||||
|
||||
@@ -24,8 +29,11 @@ ARG STEAMCLIENT=bundled
|
||||
ARG FORGE_VERSION="0.0.0-prerelease"
|
||||
ARG STEAM_BUILDID=""
|
||||
|
||||
# Base images are pinned by digest; the tag in front of the digest is for readers only.
|
||||
# The same steamcmd image is in ci/steam-buildid.sh and the Gradle plugin's DownloadGame.
|
||||
|
||||
# --- Stage 1: vanilla dedicated server -----------------------------------------
|
||||
FROM docker.io/steamcmd/steamcmd:debian-13 AS server
|
||||
FROM docker.io/steamcmd/steamcmd:debian-13@sha256:b0b49ef3101c304ed6e3fbc3ea930b2940d7c489563a1ebac524ad5bb46d336d AS server
|
||||
|
||||
# steamcmd updates itself on its first run. This runs in its own layer so the
|
||||
# update is cached and separate from the app installation.
|
||||
@@ -36,8 +44,8 @@ ARG STEAMCLIENT
|
||||
COPY docker/install-server.sh /usr/local/bin/install-server
|
||||
RUN install-server /server "${PZ_BRANCH}" "${STEAMCLIENT}"
|
||||
|
||||
# --- Stage 2: ZomboidForge build and server jar patching -----------------------
|
||||
FROM docker.io/library/eclipse-temurin:25-jdk AS build
|
||||
# --- Stage 2: ZomboidForge sources and Gradle -----------------------------------
|
||||
FROM docker.io/library/eclipse-temurin:25-jdk@sha256:8c0a84ea11c8f6ed52600fc19f1040121f2a162998e9f50a5faebbbad9172dcc AS sources
|
||||
WORKDIR /src
|
||||
|
||||
# Gradle distribution download, cached independently of the sources.
|
||||
@@ -53,6 +61,35 @@ COPY agent agent
|
||||
COPY patcher patcher
|
||||
COPY mod-tools mod-tools
|
||||
COPY gradle-plugin gradle-plugin
|
||||
|
||||
# --- Game version of a Steam branch, from its server jar alone ------------------
|
||||
# Not part of the image; built on its own by ci/release.sh.
|
||||
FROM sources AS game-version
|
||||
|
||||
# DepotDownloader downloads single files of a depot; steamcmd only whole apps.
|
||||
ADD --checksum=sha256:a999dec66b4850fc961bd50366696d23c2d0fad7b18790e6a5647b2f19097a53 \
|
||||
https://github.com/SteamRE/DepotDownloader/releases/download/DepotDownloader_3.4.0/DepotDownloader-linux-x64.zip \
|
||||
/opt/depotdownloader/depotdownloader.zip
|
||||
RUN cd /opt/depotdownloader \
|
||||
&& jar xf depotdownloader.zip \
|
||||
&& chmod +x DepotDownloader \
|
||||
&& rm depotdownloader.zip
|
||||
|
||||
# FORGE_VERSION only keeps Gradle from asking git (not in this stage) for the version.
|
||||
ARG PZ_BRANCH
|
||||
ARG STEAM_BUILDID
|
||||
ARG FORGE_VERSION
|
||||
RUN echo java/projectzomboid.jar > /tmp/files \
|
||||
&& /opt/depotdownloader/DepotDownloader \
|
||||
-app 380870 -depot 380871 -branch "${PZ_BRANCH}" -filelist /tmp/files -dir /pz \
|
||||
&& ./gradlew --no-daemon --quiet \
|
||||
-Ppz.jar=/pz/java/projectzomboid.jar \
|
||||
-Pversion=${FORGE_VERSION} \
|
||||
:patcher:printGameVersion > /game-version
|
||||
|
||||
# --- Stage 3: ZomboidForge build and server jar patching -----------------------
|
||||
FROM sources AS build
|
||||
|
||||
COPY --from=server /server/java/projectzomboid.jar /pz/projectzomboid.jar
|
||||
|
||||
# An empty PZ_VERSION keeps pz.version from gradle.properties. FORGE_VERSION always has a
|
||||
@@ -67,8 +104,8 @@ RUN ./gradlew --no-daemon \
|
||||
${DISABLED_PATCHES:+-Pzf.disabledPatches=${DISABLED_PATCHES}} \
|
||||
build -x :gradle-plugin:test :patcher:patchServerJar
|
||||
|
||||
# --- Stage 3: runtime ------------------------------------------------------------
|
||||
FROM docker.io/library/debian:trixie-slim
|
||||
# --- Stage 4: runtime ------------------------------------------------------------
|
||||
FROM docker.io/library/debian:trixie-slim@sha256:a99cfc517144bc59b1978475ec53b46ecabec7e43635402ee5b77cc54cd1b20a
|
||||
|
||||
# ca-certificates: required by steamclient.so to connect to Steam.
|
||||
# sqlite3: the entrypoint checks the admin account in the server database.
|
||||
|
||||
+26
-6
@@ -40,7 +40,7 @@ version = "1.2.0"
|
||||
zomboidForge {
|
||||
id = "shop"
|
||||
entrypoint = "com.example.shop.ShopMod"
|
||||
game("42.21") // only when the mod uses game classes
|
||||
game("42") // only when the mod uses game classes
|
||||
dependsOn("economy", "2.1") // other mods: id and minimum version
|
||||
}
|
||||
|
||||
@@ -69,7 +69,8 @@ game jar for mods that declare `game` versions. Default settings go into
|
||||
| `gameJar` | see below | the `projectzomboid.jar` to compile and check against |
|
||||
| `steamBranch` | `public` | Steam branch for the download: `public`, `unstable`, or a version such as `42.19` |
|
||||
| `serverImage` | the ZomboidForge image, `latest` | image for `runServer` |
|
||||
| `adminPassword` | `admin` | admin password of the `runServer` server |
|
||||
| `adminPassword` | random, generated once per volume | admin password of the `runServer` server (see below) |
|
||||
| `serverAddress` | `127.0.0.1` | host address `runServer` publishes the game ports on; `0.0.0.0` for the network |
|
||||
| `dataVolume` | `zomboidforge-<id>` | volume for the `runServer` world and server config |
|
||||
| `containerEngine` | podman or docker, whichever is installed | for `runServer` and the download |
|
||||
| `deployDirectory` | none | a server's mods directory for `deployMod` |
|
||||
@@ -77,6 +78,10 @@ game jar for mods that declare `game` versions. Default settings go into
|
||||
The plugin generates `META-INF/zomboidforge/mod.toml` from these settings; a hand-written one
|
||||
fails the build.
|
||||
|
||||
Declare a minor version in `game(...)` only when the mod needs it. A mod declaring `"42.21"`
|
||||
stops the server after an update to 42.22, while the server checks every game member a mod uses
|
||||
against the running jar anyway.
|
||||
|
||||
### The game jar
|
||||
|
||||
Mods that declare `game` versions compile against `projectzomboid.jar`, which cannot be
|
||||
@@ -100,9 +105,15 @@ The game jar has to be one of the declared `game` versions; the check below fail
|
||||
| `modFolder` | `build/mod/<id>/` with `<id>.jar` and `lib/`, as a server expects it in `<forge>/mods` |
|
||||
| `modZip` | the same as `build/distributions/<id>-<version>.zip` |
|
||||
| `runServer` | a ZomboidForge server in a container with the mod; Ctrl+C stops it after it saved the world |
|
||||
| `deployMod` | copies the mod folder into `deployDirectory` |
|
||||
| `deployMod` | copies the mod folder into `deployDirectory`; keeps the server's `config.toml` of the mod |
|
||||
| `downloadGame` | installs the dedicated server for its game jar; runs only when needed |
|
||||
|
||||
`runServer` is reachable from this machine only, unless `serverAddress` says otherwise. Without
|
||||
`adminPassword`, the first run generates a random admin password for the volume, prints it, and
|
||||
keeps it in `<Gradle user home>/zomboidforge/admin-passwords/<volume>`. The server uses the
|
||||
password only when it creates the admin account, on the volume's first start; a later change
|
||||
needs a new volume (`dataVolume`, or remove the old one).
|
||||
|
||||
### Working on ZomboidForge itself
|
||||
|
||||
To build a mod against a local ZomboidForge checkout instead of a published version, include it
|
||||
@@ -202,8 +213,8 @@ it earlier.
|
||||
## Storage
|
||||
|
||||
Mod data belongs in `storage()`: tables in `zomboidforge.db`, a SQLite database in the world's
|
||||
save folder. Vanilla backups include it, and deleting the world deletes it. Each mod only
|
||||
reaches its own tables.
|
||||
save folder. Vanilla backups include it, and deleting the world deletes it. Through the API,
|
||||
each mod only reaches its own tables.
|
||||
|
||||
A record declares a table's columns; each row has a `String` key:
|
||||
|
||||
@@ -216,7 +227,7 @@ balances.set("player1", new Balance(250, Instant.now()));
|
||||
Optional<Balance> balance = balances.get("player1");
|
||||
balances.update("player1", old -> new Balance(old.coins() + 10, Instant.now()), () -> new Balance(0, null));
|
||||
|
||||
this.storage().transaction(() -> { // all or nothing
|
||||
this.storage().transaction(() -> { // all or nothing, also when nested
|
||||
balances.update("player1", old -> new Balance(old.coins() - 5, old.lastPaid()), () -> new Balance(0, null));
|
||||
balances.update("player2", old -> new Balance(old.coins() + 5, old.lastPaid()), () -> new Balance(0, null));
|
||||
});
|
||||
@@ -257,6 +268,10 @@ Things to know:
|
||||
world goes back to its last save, but the mod data keeps later writes.
|
||||
3. When a mod's id changes, list the old ids in `mod.toml` as `previous_ids`; their tables
|
||||
move to the new id once.
|
||||
4. While a `transaction`, `update`, or `forEach` callback runs, the storage of every mod waits.
|
||||
These callbacks must not wait for other threads, for example with
|
||||
`main().submit(...).join()`. A backup waits at most 10 seconds for them and then runs
|
||||
without pausing storage, so its copy of `zomboidforge.db` may be incomplete.
|
||||
|
||||
## Checks at startup
|
||||
|
||||
@@ -282,6 +297,11 @@ Every problem of every mod is listed in the log.
|
||||
| game jar (game code and its bundled libraries) | only with `game` declared |
|
||||
| ZomboidForge internals | no |
|
||||
|
||||
These rules keep mods from linking against the wrong classes by accident. They are not a
|
||||
sandbox: a mod runs with the full privileges of the server process. Through reflection or the
|
||||
file system it can reach anything the server can, including other mods' data in
|
||||
`zomboidforge.db`.
|
||||
|
||||
## Profiling
|
||||
|
||||
Main-thread tasks and event listener calls appear in JFR recordings as the event
|
||||
|
||||
@@ -22,8 +22,10 @@ podman build --platform linux/amd64 -t zomboidforge . # or: docker build ...
|
||||
| `FORGE_VERSION` | `0.0.0-prerelease` | ZomboidForge version (jar manifest, image label). The build stage has no `git`, so the version is never read from a tag there; `ci/release.sh` passes it |
|
||||
| `DISABLED_PATCHES` | | Comma-separated simple class names of build-time patches to skip (debug builds only), e.g. `IsoZombieVehiclePerformancePatch` |
|
||||
|
||||
Published images are tagged `<forge>-pz<pz>-build<steam buildid>` (immutable),
|
||||
`<forge>-pz<pz>`, and `latest`.
|
||||
Published images are tagged `<forge>-pz<major.minor.build>` (never overwritten),
|
||||
`<forge>-pz<major.minor>` (the newest hotfix of that minor version), and `latest`. A new image
|
||||
is built for every ZomboidForge release and every Project Zomboid version, hotfixes included:
|
||||
the server only admits clients with the same version.
|
||||
|
||||
## Running
|
||||
|
||||
@@ -93,6 +95,11 @@ forge/
|
||||
podman run ... -v ./forge:/forge zomboidforge
|
||||
```
|
||||
|
||||
Mods are trusted code. They run inside the server process with its full privileges: they can
|
||||
read and write any file the server can, open network connections, and stop the server. The
|
||||
class loader isolation and the startup checks catch mistakes; they do not contain a malicious
|
||||
mod. Install only mods whose authors you trust.
|
||||
|
||||
A mod's settings live in its `config.toml`. When the file is missing, it is created from the
|
||||
mod's defaults if the folder is writable by UID 1000; otherwise the defaults are used without a
|
||||
file. Keys missing from `config.toml` take the default. `enabled = false` in its `[forge]`
|
||||
|
||||
+14
-6
@@ -2,6 +2,7 @@
|
||||
|
||||
plugins {
|
||||
id("zomboidforge.java-conventions")
|
||||
alias(libs.plugins.shadow)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -11,12 +12,19 @@ dependencies {
|
||||
compileOnly(files(projectZomboid.serverJar))
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
// The agent jar is appended to the system class path behind the game jar and includes api,
|
||||
// core, compat runtime, and their libraries. The libraries are relocated, so a copy of the same
|
||||
// library in the game jar cannot replace them.
|
||||
tasks.shadowJar {
|
||||
archiveBaseName = "zomboidforge-agent"
|
||||
archiveClassifier = ""
|
||||
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.
|
||||
// Mapping the classpath to zip trees loses its task dependencies; the input restores them.
|
||||
inputs.files(configurations.runtimeClasspath)
|
||||
from(configurations.runtimeClasspath.map { classpath -> classpath.map { zipTree(it) } })
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
|
||||
relocate("org.objectweb.asm", "dev.overlord.zomboidforge.shaded.asm")
|
||||
relocate("com.electronwill.nightconfig", "dev.overlord.zomboidforge.shaded.nightconfig")
|
||||
}
|
||||
|
||||
// Only the shadow jar is used; the plain jar would match the same file name pattern.
|
||||
tasks.jar {
|
||||
enabled = false
|
||||
}
|
||||
@@ -9,8 +9,9 @@ import java.util.regex.Pattern;
|
||||
/** Project Zomboid version, e.g. 42.21.0 ({@code Core.getGameAndBuildVersion()}). */
|
||||
public record GameVersion(int major, int minor, int build) implements Comparable<GameVersion>
|
||||
{
|
||||
private static final Pattern VERSION = Pattern.compile("(\\d+)\\.(\\d+)(?:\\.(\\d+))?");
|
||||
private static final Pattern PREFIX = Pattern.compile("(\\d+)(?:\\.(\\d+)(?:\\.(\\d+))?)?");
|
||||
// At most 9 digits per number, so every number fits an int.
|
||||
private static final Pattern VERSION = Pattern.compile("(\\d{1,9})\\.(\\d{1,9})(?:\\.(\\d{1,9}))?");
|
||||
private static final Pattern PREFIX = Pattern.compile("(\\d{1,9})(?:\\.(\\d{1,9})(?:\\.(\\d{1,9}))?)?");
|
||||
|
||||
private static final Comparator<GameVersion> ORDER = Comparator
|
||||
.comparingInt(GameVersion::major)
|
||||
|
||||
@@ -4,7 +4,8 @@ import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* The mod's tables in {@code zomboidforge.db}, next to the world's save. Every table belongs to
|
||||
* the mod; other mods cannot reach it.
|
||||
* the mod; this interface gives no access to the tables of other mods. It is not a security
|
||||
* boundary: mod code runs with the server's privileges and can open the file directly.
|
||||
*
|
||||
* <p>A record declares a table's columns: {@code String}, {@code long}/{@code int},
|
||||
* {@code double}/{@code float}, {@code boolean}, {@code byte[]}, {@code UUID}, {@code Instant},
|
||||
@@ -26,6 +27,10 @@ public interface ModStorage
|
||||
/**
|
||||
* Runs {@code work} in one transaction: writes of this thread inside it are committed
|
||||
* together, or not at all when {@code work} throws.
|
||||
*
|
||||
* <p>Storage of every mod waits while {@code work} runs, so {@code work} must not wait for
|
||||
* other threads, for example with {@code main().submit(...).join()}. A backup waits at most
|
||||
* 10 seconds for it and then runs without pausing storage.
|
||||
*/
|
||||
void transaction(Runnable work);
|
||||
|
||||
|
||||
@@ -37,7 +37,11 @@ public interface Table<R extends Record>
|
||||
/** Every key, sorted. */
|
||||
List<String> keys();
|
||||
|
||||
/** Calls {@code action} for every row, sorted by key, without loading all rows at once. */
|
||||
/**
|
||||
* Calls {@code action} for every row, sorted by key, without loading all rows at once.
|
||||
* Storage of every mod waits until it returns, so {@code action} must not wait for other
|
||||
* threads.
|
||||
*/
|
||||
void forEach(BiConsumer<String, R> action);
|
||||
|
||||
long count();
|
||||
@@ -45,6 +49,8 @@ public interface Table<R extends Record>
|
||||
/**
|
||||
* Replaces the row under {@code key} with {@code change} applied to it, or to
|
||||
* {@code initial} when there is none, in one transaction: no other write comes in between.
|
||||
* As in {@link ModStorage#transaction}, {@code change} and {@code initial} must not wait for
|
||||
* other threads.
|
||||
*
|
||||
* @return the stored value
|
||||
*/
|
||||
|
||||
@@ -42,6 +42,16 @@ class GameVersionTest
|
||||
assertThrows(IllegalArgumentException.class, () -> version.matches("42.21.3.1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void rejectsNumbersOutsideTheIntRange()
|
||||
{
|
||||
GameVersion version = new GameVersion(42, 21, 3);
|
||||
|
||||
assertThrows(IllegalArgumentException.class, () -> GameVersion.parse("42.99999999999"));
|
||||
assertThrows(IllegalArgumentException.class, () -> version.matches("99999999999"));
|
||||
assertFalse(GameVersion.isPrefix("42.99999999999"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void comparesNumerically()
|
||||
{
|
||||
|
||||
+44
-25
@@ -2,15 +2,18 @@
|
||||
#
|
||||
# Publishes the mod API (dev.overlord.zomboidforge:api), the mod tools (mod-tools), and the
|
||||
# Gradle plugin (dev.overlord.zomboidforge.mod) to the Maven registry of the ZomboidForge Gitea,
|
||||
# in the version of the newest v* git tag reachable from HEAD, without the "v".
|
||||
# in the version of the v* git tag on HEAD, without the "v".
|
||||
#
|
||||
# A pre-release version (containing "-", e.g. 0.3.0-rc.1) is built and tested but never
|
||||
# published. Without any v* tag nothing is published.
|
||||
# published. Without a v* tag on HEAD nothing is published.
|
||||
#
|
||||
# Environment:
|
||||
# Usage:
|
||||
# ci/publish.sh test runs the checks of the published modules; needs no credentials
|
||||
# ci/publish.sh publish publishes them without running the checks again
|
||||
#
|
||||
# Environment (publish only):
|
||||
# ORG_GRADLE_PROJECT_giteaUsername Gitea user with package write access
|
||||
# ORG_GRADLE_PROJECT_giteaPassword Token of that user
|
||||
# PUBLISH true: publish after the tests. Default: false (test only)
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
@@ -19,8 +22,6 @@ set -o pipefail
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
readonly REPO_ROOT
|
||||
|
||||
readonly REQUESTED_PUBLISH="${PUBLISH:-false}"
|
||||
|
||||
readonly MODULES=(
|
||||
api
|
||||
mod-tools
|
||||
@@ -31,11 +32,11 @@ log() {
|
||||
echo "[publish] $*" >&2
|
||||
}
|
||||
|
||||
# Prints the newest v* tag reachable from HEAD without its "v", or nothing.
|
||||
# Prints the v* tag on HEAD without its "v", or nothing.
|
||||
release_tag_version() {
|
||||
local tag
|
||||
|
||||
if tag="$(git -C "${REPO_ROOT}" describe --tags --abbrev=0 --match 'v*' 2> /dev/null)"; then
|
||||
if tag="$(git -C "${REPO_ROOT}" describe --tags --exact-match --match 'v*' 2> /dev/null)"; then
|
||||
echo "${tag#v}"
|
||||
fi
|
||||
}
|
||||
@@ -61,36 +62,54 @@ run_gradle() {
|
||||
"$@"
|
||||
}
|
||||
|
||||
main() {
|
||||
local version
|
||||
local publish="${REQUESTED_PUBLISH}"
|
||||
run_tests() {
|
||||
local version="$1"
|
||||
local check_tasks
|
||||
local publish_tasks
|
||||
|
||||
version="$(release_tag_version)"
|
||||
if [[ -z "${version}" ]]; then
|
||||
log "No v* git tag found (shallow clone without tags?); nothing to publish."
|
||||
exit 1
|
||||
fi
|
||||
if [[ "${version}" == *-* ]]; then
|
||||
publish=false
|
||||
log "${version} is a pre-release version; nothing will be published."
|
||||
fi
|
||||
|
||||
mapfile -t check_tasks < <(module_tasks check)
|
||||
mapfile -t publish_tasks < <(module_tasks publishAllPublicationsToGiteaRepository)
|
||||
|
||||
log "Testing ZomboidForge ${version}: ${MODULES[*]}"
|
||||
run_gradle "${version}" :core:check "${check_tasks[@]}"
|
||||
}
|
||||
|
||||
if [[ "${publish}" != "true" ]]; then
|
||||
log "Not publishing (PUBLISH=${REQUESTED_PUBLISH})."
|
||||
publish() {
|
||||
local version="$1"
|
||||
local publish_tasks
|
||||
|
||||
if [[ "${version}" == *-* ]]; then
|
||||
log "${version} is a pre-release version; nothing is published."
|
||||
return
|
||||
fi
|
||||
|
||||
mapfile -t publish_tasks < <(module_tasks publishAllPublicationsToGiteaRepository)
|
||||
|
||||
log "Publishing ZomboidForge ${version}"
|
||||
run_gradle "${version}" "${publish_tasks[@]}"
|
||||
log "Published ${MODULES[*]} ${version}"
|
||||
}
|
||||
|
||||
main() {
|
||||
local step="${1:-}"
|
||||
local version
|
||||
|
||||
version="$(release_tag_version)"
|
||||
if [[ -z "${version}" ]]; then
|
||||
log "HEAD has no v* git tag (not a release commit, or a shallow clone without tags?); nothing to publish."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "${step}" in
|
||||
test)
|
||||
run_tests "${version}"
|
||||
;;
|
||||
publish)
|
||||
publish "${version}"
|
||||
;;
|
||||
*)
|
||||
log "Usage: ci/publish.sh test|publish"
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
main "$@"
|
||||
+60
-25
@@ -1,22 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Builds the ZomboidForge image for one Project Zomboid version and optionally
|
||||
# Builds the ZomboidForge image for the current build of a Steam branch and optionally
|
||||
# publishes it. Published tags:
|
||||
#
|
||||
# <forge>-pz<pz>-build<steam_buildid> immutable; never overwritten
|
||||
# <forge>-pz<pz> moves to the newest Steam build of that version
|
||||
# <forge>-pz<major.minor.build> written once per ZomboidForge and Project Zomboid version
|
||||
# <forge>-pz<major.minor> moves to the newest hotfix of that minor version
|
||||
# latest only with LATEST=true
|
||||
#
|
||||
# <forge> is the newest v* git tag reachable from HEAD, without the "v" (v0.2.0 -> 0.2.0).
|
||||
# A pre-release version (containing "-", e.g. 0.2.0-rc.1) is built and verified but never
|
||||
# published. Without any v* tag the version is "0.0.0-prerelease".
|
||||
# <major.minor.build> is the version the branch's server jar reports, read before the full
|
||||
# build (Dockerfile stage game-version, which downloads only the jar).
|
||||
#
|
||||
# Nothing is built when the immutable tag already exists in the registry.
|
||||
# <forge> is the v* git tag on HEAD, without the "v" (v0.2.0 -> 0.2.0). When HEAD has no such
|
||||
# tag, it is the git describe version of HEAD (0.2.0-3-g1a2b3c4: 3 commits after v0.2.0).
|
||||
# A pre-release version (containing "-", e.g. 0.2.0-rc.1 or 0.2.0-3-g1a2b3c4) is built and
|
||||
# verified but never published. Without any v* tag the version is "0.0.0-prerelease".
|
||||
#
|
||||
# Nothing is built when <forge>-pz<major.minor.build> already exists in the registry. The
|
||||
# server only admits clients with the same major.minor.build, so every hotfix (42.21.1 ->
|
||||
# 42.21.2) gets an image; a new Steam build with an unchanged version does not.
|
||||
#
|
||||
# Environment:
|
||||
# IMAGE Image name without tag, e.g. git.security-command.org/overlord/zomboidforge
|
||||
# PZ_BRANCH Steam branch. Default: public
|
||||
# PZ_VERSION Expected Project Zomboid version. Default: pz.version in gradle.properties
|
||||
# PZ_VERSION Accepted Project Zomboid versions ("42": every Build 42 version).
|
||||
# Default: pz.version in gradle.properties
|
||||
# PUBLISH true: push the tags (not for pre-release versions). Default: false (build and verify only)
|
||||
# LATEST true: also push "latest". Default: false
|
||||
# CONTAINER_ENGINE docker or podman. Default: docker if installed, else podman
|
||||
@@ -63,12 +70,15 @@ gradle_property() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Prints the forge version: the newest v* tag reachable from HEAD without its "v",
|
||||
# or nothing when the repository has no such tag.
|
||||
# Prints the forge version without the "v": the v* tag on HEAD, else the git describe version
|
||||
# of HEAD relative to the newest reachable v* tag (v0.2.0-3-g1a2b3c4), or nothing when the
|
||||
# repository has no such tag.
|
||||
release_tag_version() {
|
||||
local tag
|
||||
|
||||
if tag="$(git -C "${REPO_ROOT}" describe --tags --abbrev=0 --match 'v*' 2> /dev/null)"; then
|
||||
if tag="$(git -C "${REPO_ROOT}" describe --tags --exact-match --match 'v*' 2> /dev/null)"; then
|
||||
echo "${tag#v}"
|
||||
elif tag="$(git -C "${REPO_ROOT}" describe --tags --match 'v*' 2> /dev/null)"; then
|
||||
echo "${tag#v}"
|
||||
fi
|
||||
}
|
||||
@@ -78,6 +88,22 @@ image_exists() {
|
||||
"$(container_engine)" manifest inspect "${reference}" > /dev/null 2>&1
|
||||
}
|
||||
|
||||
# Prints the game version of the branch's current server jar, e.g. 42.21.0. Downloads only
|
||||
# the jar; the result stays cached until the build ID changes.
|
||||
read_game_version() {
|
||||
local build_id="$1"
|
||||
local image
|
||||
|
||||
image="$("$(container_engine)" build --quiet \
|
||||
--platform linux/amd64 \
|
||||
--target game-version \
|
||||
--build-arg "PZ_BRANCH=${PZ_BRANCH}" \
|
||||
--build-arg "STEAM_BUILDID=${build_id}" \
|
||||
"${REPO_ROOT}")"
|
||||
|
||||
"$(container_engine)" run --rm --entrypoint cat "${image}" /game-version
|
||||
}
|
||||
|
||||
build_image() {
|
||||
local reference="$1"
|
||||
local forge_version="$2"
|
||||
@@ -119,8 +145,9 @@ push_as() {
|
||||
main() {
|
||||
local forge_version
|
||||
local publish="${REQUESTED_PUBLISH}"
|
||||
local pz_version
|
||||
local pz_prefix
|
||||
local build_id
|
||||
local game_version
|
||||
|
||||
forge_version="$(release_tag_version)"
|
||||
if [[ -z "${forge_version}" ]]; then
|
||||
@@ -132,31 +159,39 @@ main() {
|
||||
log "${forge_version} is a pre-release version; nothing will be published."
|
||||
fi
|
||||
|
||||
pz_version="${PZ_VERSION:-$(gradle_property pz.version)}"
|
||||
pz_prefix="${PZ_VERSION:-$(gradle_property pz.version)}"
|
||||
build_id="$("${REPO_ROOT}/ci/steam-buildid.sh" "${PZ_BRANCH}")"
|
||||
game_version="$(read_game_version "${build_id}")"
|
||||
log "ZomboidForge ${forge_version}, Project Zomboid ${game_version}, Steam branch ${PZ_BRANCH} build ${build_id}"
|
||||
|
||||
local immutable_tag="${IMAGE}:${forge_version}-pz${pz_version}-build${build_id}"
|
||||
local version_tag="${IMAGE}:${forge_version}-pz${pz_version}"
|
||||
log "ZomboidForge ${forge_version}, Project Zomboid ${pz_version}, Steam branch ${PZ_BRANCH} build ${build_id}"
|
||||
# Checked here as well as by the patcher, to fail before the full download.
|
||||
if [[ "${game_version}" != "${pz_prefix}" && "${game_version}" != "${pz_prefix}."* ]]; then
|
||||
log "Steam branch ${PZ_BRANCH} has Project Zomboid ${game_version}; the build accepts ${pz_prefix}."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${publish}" == true ]] && image_exists "${immutable_tag}"; then
|
||||
log "${immutable_tag} is already published; nothing to do."
|
||||
local version_tag="${IMAGE}:${forge_version}-pz${game_version}"
|
||||
# 42.21.2 -> 42.21
|
||||
local minor_tag="${IMAGE}:${forge_version}-pz${game_version%.*}"
|
||||
|
||||
if [[ "${publish}" == true ]] && image_exists "${version_tag}"; then
|
||||
log "${version_tag} is already published; nothing to do."
|
||||
return
|
||||
fi
|
||||
|
||||
build_image "${immutable_tag}" "${forge_version}" "${pz_version}" "${build_id}"
|
||||
verify_build_id "${immutable_tag}" "${build_id}"
|
||||
build_image "${version_tag}" "${forge_version}" "${game_version}" "${build_id}"
|
||||
verify_build_id "${version_tag}" "${build_id}"
|
||||
|
||||
if [[ "${publish}" != true ]]; then
|
||||
log "Built ${immutable_tag} (not published)"
|
||||
log "Built ${version_tag} (not published)"
|
||||
return
|
||||
fi
|
||||
|
||||
"$(container_engine)" push "${immutable_tag}"
|
||||
log "Pushed ${immutable_tag}"
|
||||
push_as "${immutable_tag}" "${version_tag}"
|
||||
"$(container_engine)" push "${version_tag}"
|
||||
log "Pushed ${version_tag}"
|
||||
push_as "${version_tag}" "${minor_tag}"
|
||||
if [[ "${LATEST}" == true ]]; then
|
||||
push_as "${immutable_tag}" "${IMAGE}:latest"
|
||||
push_as "${version_tag}" "${IMAGE}:latest"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
readonly APP_ID="380870"
|
||||
readonly STEAMCMD_IMAGE="docker.io/steamcmd/steamcmd:debian-13"
|
||||
readonly STEAMCMD_IMAGE="docker.io/steamcmd/steamcmd:debian-13@sha256:b0b49ef3101c304ed6e3fbc3ea930b2940d7c489563a1ebac524ad5bb46d336d"
|
||||
|
||||
readonly BRANCH="$1"
|
||||
|
||||
|
||||
+3
-3
@@ -75,7 +75,7 @@ public final class ServerHooks
|
||||
ForgeInstance.FORGE.started();
|
||||
System.out.println("[ZomboidForge] Server started (ZomboidForge " + ZomboidForge.VERSION + ").");
|
||||
}
|
||||
catch (RuntimeException e) { e.printStackTrace(); }
|
||||
catch (Throwable t) { t.printStackTrace(); }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,7 +87,7 @@ public final class ServerHooks
|
||||
public static void onTick()
|
||||
{
|
||||
try { ForgeInstance.FORGE.tick(); }
|
||||
catch (RuntimeException e) { e.printStackTrace(); }
|
||||
catch (Throwable t) { t.printStackTrace(); }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,6 +105,6 @@ public final class ServerHooks
|
||||
System.out.println("[ZomboidForge] Server stopping.");
|
||||
ForgeInstance.FORGE.stopping();
|
||||
}
|
||||
catch (RuntimeException e) { e.printStackTrace(); }
|
||||
catch (Throwable t) { t.printStackTrace(); }
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -20,6 +20,6 @@ public final class StorageHooks
|
||||
if (running) ForgeInstance.FORGE.backupStarted();
|
||||
else ForgeInstance.FORGE.backupFinished();
|
||||
}
|
||||
catch (RuntimeException e) { e.printStackTrace(); }
|
||||
catch (Throwable t) { t.printStackTrace(); }
|
||||
}
|
||||
}
|
||||
@@ -154,14 +154,17 @@ public final class Forge
|
||||
);
|
||||
}
|
||||
|
||||
/** Calls {@link Mod#onServerStarted()} of every mod in load order. Main thread. */
|
||||
/**
|
||||
* Calls {@link Mod#onServerStarted()} of every mod in load order. Main thread. Anything a
|
||||
* mod throws is logged, and the next mod is called.
|
||||
*/
|
||||
public void started()
|
||||
{
|
||||
this.lifecycle.started();
|
||||
|
||||
for (ModLoader.LoadedMod mod : this.mods) {
|
||||
try { mod.mod().onServerStarted(); }
|
||||
catch (RuntimeException e) { this.logger.log(System.Logger.Level.ERROR, "'" + mod.descriptor().id() + "': onServerStarted() threw.", e); }
|
||||
catch (Throwable t) { this.logger.log(System.Logger.Level.ERROR, "'" + mod.descriptor().id() + "': onServerStarted() threw.", t); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,19 +208,25 @@ public final class Forge
|
||||
|
||||
/**
|
||||
* Once: calls {@link Mod#onStopping()} of every mod in reverse load order, then stops the
|
||||
* mods' threads, events, and storage (see {@link #stopMods}). Called on the shutdown thread.
|
||||
* mods' threads, events, and storage (see {@link #stopMods}). Called on the shutdown thread,
|
||||
* before the world is saved, so nothing a mod throws leaves this method.
|
||||
*/
|
||||
public void stopping()
|
||||
{
|
||||
if (!this.lifecycle.stopping()) return;
|
||||
|
||||
try
|
||||
{
|
||||
for (ModLoader.LoadedMod mod : this.mods.reversed()) {
|
||||
try { mod.mod().onStopping(); }
|
||||
catch (RuntimeException e) { this.logger.log(System.Logger.Level.ERROR, "'" + mod.descriptor().id() + "': onStopping() threw.", e); }
|
||||
catch (Throwable t) { this.logger.log(System.Logger.Level.ERROR, "'" + mod.descriptor().id() + "': onStopping() threw.", t); }
|
||||
}
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.stopMods(this.settings.shutdownTimeout());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rejects further main-thread tasks and cancels the queued ones, stops event delivery, gives
|
||||
|
||||
@@ -29,6 +29,9 @@ import java.util.stream.Collectors;
|
||||
*
|
||||
* Everything else on the parent's class path, such as ZomboidForge's own classes and libraries,
|
||||
* is not visible. A mod's own copy of a library that the game also bundles takes precedence.
|
||||
*
|
||||
* <p>The lookup order prevents accidental linkage only. It is not a security boundary: mod code
|
||||
* can still reach other classes through reflection or {@link ClassLoader#getSystemClassLoader()}.
|
||||
*/
|
||||
final class ModClassLoader extends URLClassLoader
|
||||
{
|
||||
|
||||
@@ -13,7 +13,8 @@ import java.util.regex.Pattern;
|
||||
*/
|
||||
public record ModVersion(int major, int minor, int patch, @Nullable String preRelease) implements Comparable<ModVersion>
|
||||
{
|
||||
private static final Pattern FORMAT = Pattern.compile("(\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))?(?:-([0-9A-Za-z.-]+))?");
|
||||
// At most 9 digits per number, so every number fits an int.
|
||||
private static final Pattern FORMAT = Pattern.compile("(\\d{1,9})(?:\\.(\\d{1,9}))?(?:\\.(\\d{1,9}))?(?:-([0-9A-Za-z.-]+))?");
|
||||
|
||||
private static final Comparator<ModVersion> ORDER = Comparator
|
||||
.comparingInt(ModVersion::major)
|
||||
|
||||
@@ -79,6 +79,8 @@ public final class MainThreadQueue
|
||||
int index = count == 0 ? 0 : this.next % count;
|
||||
int empty = 0;
|
||||
|
||||
try
|
||||
{
|
||||
while (empty < count && !this.closed)
|
||||
{
|
||||
ModQueue queue = queues[index];
|
||||
@@ -96,9 +98,12 @@ public final class MainThreadQueue
|
||||
|
||||
if (System.nanoTime() >= deadline) break;
|
||||
}
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.next = index;
|
||||
}
|
||||
}
|
||||
|
||||
/** Rejects further tasks and cancels the queued ones (their futures are cancelled). Any thread. */
|
||||
public void close()
|
||||
|
||||
@@ -25,8 +25,8 @@ final class ModTaskEvent extends jdk.jfr.Event
|
||||
|
||||
/**
|
||||
* Runs {@code action} as a {@code zomboidforge.ModTask} event. Mod code must not end the
|
||||
* calling thread's work, so failures are returned instead of thrown: runtime exceptions,
|
||||
* missing classes or members ({@link LinkageError}), and stack overflows.
|
||||
* calling thread's work, so every failure is returned instead of thrown, including errors
|
||||
* and checked exceptions thrown without being declared.
|
||||
*
|
||||
* @return the failure, or {@code null} when {@code action} returned normally
|
||||
*/
|
||||
@@ -40,9 +40,9 @@ final class ModTaskEvent extends jdk.jfr.Event
|
||||
action.run();
|
||||
return null;
|
||||
}
|
||||
catch (RuntimeException | LinkageError | StackOverflowError e)
|
||||
catch (Throwable t)
|
||||
{
|
||||
return e;
|
||||
return t;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -44,6 +44,13 @@ public final class ModTables implements ModStorage
|
||||
/** A stored schema. */
|
||||
private record Schema(int version, List<Column> columns) {}
|
||||
|
||||
/** Work on one stored row; may throw {@link SQLException}. */
|
||||
@FunctionalInterface
|
||||
private interface RowAction
|
||||
{
|
||||
void accept(Row row) throws SQLException;
|
||||
}
|
||||
|
||||
private final String id;
|
||||
private final StorageDatabase database;
|
||||
private final System.Logger logger;
|
||||
@@ -226,13 +233,12 @@ public final class ModTables implements ModStorage
|
||||
throw new StorageException(table + " has schema version " + stored.version() + ", the mod declares " + this.version + " but no migration from " + stored.version() + ".");
|
||||
|
||||
String rebuilt = physical + "__migrating";
|
||||
List<Row> rows = ModTables.rows(connection, physical);
|
||||
SqlTable<R> target = new SqlTable<>(ModTables.this.database, codec, rebuilt);
|
||||
|
||||
ModTables.execute(connection, "DROP TABLE IF EXISTS " + SqlTable.quoted(rebuilt));
|
||||
ModTables.create(connection, rebuilt, codec.columns());
|
||||
|
||||
for (Row row : rows)
|
||||
int migrated = ModTables.forEachRow(connection, physical, row ->
|
||||
{
|
||||
R record;
|
||||
|
||||
@@ -240,13 +246,13 @@ public final class ModTables implements ModStorage
|
||||
catch (RuntimeException e) { throw new StorageException(table + ": the migration from version " + stored.version() + " failed for row '" + row.key() + "': " + e, e); }
|
||||
|
||||
target.set(row.key(), record);
|
||||
}
|
||||
});
|
||||
|
||||
ModTables.execute(connection, "DROP TABLE " + SqlTable.quoted(physical));
|
||||
ModTables.execute(connection, "ALTER TABLE " + SqlTable.quoted(rebuilt) + " RENAME TO " + SqlTable.quoted(physical));
|
||||
ModTables.this.saveSchema(connection, this.name, this.version, codec.columns());
|
||||
|
||||
ModTables.this.logger.log(System.Logger.Level.INFO, table + ": migrated " + rows.size() + " row(s) from schema version " + stored.version() + " to " + this.version + ".");
|
||||
ModTables.this.logger.log(System.Logger.Level.INFO, table + ": migrated " + migrated + " row(s) from schema version " + stored.version() + " to " + this.version + ".");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,10 +282,15 @@ public final class ModTables implements ModStorage
|
||||
ModTables.execute(connection, "CREATE TABLE " + SqlTable.quoted(physical) + " (" + SqlTable.quoted(SqlTable.KEY) + " TEXT PRIMARY KEY NOT NULL" + definitions + ")");
|
||||
}
|
||||
|
||||
/** Every row of {@code physical} with all its columns, sorted by key. */
|
||||
private static List<Row> rows(Connection connection, String physical) throws SQLException
|
||||
/**
|
||||
* Calls {@code action} for every row of {@code physical} with all its columns, sorted by key,
|
||||
* reading one row at a time.
|
||||
*
|
||||
* @return the number of rows
|
||||
*/
|
||||
private static int forEachRow(Connection connection, String physical, RowAction action) throws SQLException
|
||||
{
|
||||
List<Row> rows = new ArrayList<>();
|
||||
int count = 0;
|
||||
|
||||
try (Statement statement = connection.createStatement(); ResultSet result = statement.executeQuery("SELECT * FROM " + SqlTable.quoted(physical) + " ORDER BY " + SqlTable.quoted(SqlTable.KEY)))
|
||||
{
|
||||
@@ -299,11 +310,12 @@ public final class ModTables implements ModStorage
|
||||
else values.put(column, value instanceof Integer number ? Long.valueOf(number) : value);
|
||||
}
|
||||
|
||||
rows.add(new StoredRow(key, values));
|
||||
action.accept(new StoredRow(key, values));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return rows;
|
||||
return count;
|
||||
}
|
||||
|
||||
private static List<String> tableNames(Connection connection, String mod) throws SQLException
|
||||
|
||||
@@ -102,7 +102,8 @@ final class RecordCodec<R extends Record>
|
||||
if (stored == null && !column.nullable())
|
||||
throw new StorageException("Column '" + column.name() + "' of '" + this.type.getSimpleName() + "' is null in the database.");
|
||||
|
||||
arguments[i] = stored == null ? null : RecordCodec.value(column.kind(), this.types[i], stored);
|
||||
try { arguments[i] = stored == null ? null : RecordCodec.value(column.kind(), this.types[i], stored); }
|
||||
catch (RuntimeException e) { throw new StorageException("Column '" + column.name() + "' of '" + this.type.getSimpleName() + "' holds '" + stored + "', which is not a valid '" + this.types[i].getSimpleName() + "': " + e, e); }
|
||||
}
|
||||
|
||||
try { return this.type.cast(this.constructor.invokeWithArguments(arguments)); }
|
||||
|
||||
@@ -10,7 +10,10 @@ import java.nio.file.Path;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Savepoint;
|
||||
import java.sql.Statement;
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
@@ -31,6 +34,9 @@ public final class StorageDatabase implements AutoCloseable
|
||||
/** File name, in the world's save folder. */
|
||||
public static final String FILE = "zomboidforge.db";
|
||||
|
||||
/** Longest wait of a backup for the running storage operation. */
|
||||
static final Duration BACKUP_WAIT = Duration.ofSeconds(10);
|
||||
|
||||
/** Work with the connection that has a result; may throw {@link SQLException}. */
|
||||
@FunctionalInterface
|
||||
public interface Work<T>
|
||||
@@ -104,8 +110,10 @@ public final class StorageDatabase implements AutoCloseable
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs {@code work} in a transaction. Nested calls on the same thread join the outer
|
||||
* transaction; it commits when the outermost call returns and rolls back when any throws.
|
||||
* Runs {@code work} in a transaction. The outermost call on a thread commits when
|
||||
* {@code work} returns and rolls back when it throws. A nested call runs inside a savepoint
|
||||
* of the outer transaction: when its {@code work} throws, only its own writes are rolled
|
||||
* back, also when the outer work catches the exception.
|
||||
*/
|
||||
public <T> T transaction(Work<T> work)
|
||||
{
|
||||
@@ -118,19 +126,23 @@ public final class StorageDatabase implements AutoCloseable
|
||||
boolean outermost = this.depth == 0;
|
||||
|
||||
if (outermost) connection.setAutoCommit(false);
|
||||
|
||||
Savepoint savepoint = outermost ? null : connection.setSavepoint();
|
||||
this.depth++;
|
||||
|
||||
try
|
||||
{
|
||||
T result = work.run(connection);
|
||||
if (outermost) connection.commit();
|
||||
|
||||
if (savepoint == null) connection.commit();
|
||||
else connection.releaseSavepoint(savepoint);
|
||||
|
||||
return result;
|
||||
}
|
||||
catch (SQLException | RuntimeException | Error e)
|
||||
catch (Throwable t)
|
||||
{
|
||||
if (outermost) StorageDatabase.rollback(connection, e);
|
||||
throw e;
|
||||
StorageDatabase.rollback(connection, savepoint, t);
|
||||
throw t;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -149,15 +161,30 @@ public final class StorageDatabase implements AutoCloseable
|
||||
}
|
||||
|
||||
/**
|
||||
* Blocks storage for a backup of the save folder: waits for the running operation, writes
|
||||
* the WAL into the database file ({@code PRAGMA wal_checkpoint(TRUNCATE)}), and keeps the
|
||||
* lock until {@link #backupFinished()} on the same thread. Other threads' storage calls wait.
|
||||
* Blocks storage for a backup of the save folder: waits up to {@link #BACKUP_WAIT} for the
|
||||
* running operation, writes the WAL into the database file
|
||||
* ({@code PRAGMA wal_checkpoint(TRUNCATE)}), and keeps the lock until
|
||||
* {@link #backupFinished()} on the same thread. Other threads' storage calls wait.
|
||||
*
|
||||
* <p>When the running operation takes longer, for example a transaction that waits for the
|
||||
* thread making the backup, the backup runs without the lock and storage stays usable.
|
||||
*
|
||||
* @return a problem to log, or {@code null}
|
||||
*/
|
||||
public @Nullable String backupStarted()
|
||||
public @Nullable String backupStarted() { return this.backupStarted(StorageDatabase.BACKUP_WAIT); }
|
||||
|
||||
@Nullable String backupStarted(Duration wait)
|
||||
{
|
||||
this.lock.lock();
|
||||
try
|
||||
{
|
||||
if (!this.lock.tryLock(wait.toMillis(), TimeUnit.MILLISECONDS))
|
||||
return "Storage was busy for " + wait.toSeconds() + " s; the backup runs without pausing storage, so its copy of '" + StorageDatabase.FILE + "' may be incomplete.";
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
Thread.currentThread().interrupt();
|
||||
return "Interrupted while waiting for storage; the backup runs without pausing storage, so its copy of '" + StorageDatabase.FILE + "' may be incomplete.";
|
||||
}
|
||||
|
||||
Connection connection = this.connection;
|
||||
if (connection == null) return null;
|
||||
@@ -241,9 +268,21 @@ public final class StorageDatabase implements AutoCloseable
|
||||
return connection;
|
||||
}
|
||||
|
||||
private static void rollback(Connection connection, Throwable cause)
|
||||
/** Rolls back the transaction, or only to {@code savepoint} (and releases it) when one is given. */
|
||||
private static void rollback(Connection connection, @Nullable Savepoint savepoint, Throwable cause)
|
||||
{
|
||||
try { connection.rollback(); }
|
||||
catch (SQLException e) { cause.addSuppressed(e); }
|
||||
try
|
||||
{
|
||||
if (savepoint == null) {
|
||||
connection.rollback();
|
||||
} else {
|
||||
connection.rollback(savepoint);
|
||||
connection.releaseSavepoint(savepoint);
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
cause.addSuppressed(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
import testmods.ContextMod;
|
||||
import testmods.ErrorMod;
|
||||
import testmods.Recorder;
|
||||
import testmods.ThreadMod;
|
||||
|
||||
@@ -197,6 +198,25 @@ class ForgeTest
|
||||
assertEquals(Lifecycle.Phase.BOOTING, forge.phase());
|
||||
}
|
||||
|
||||
@Test
|
||||
void errorsOfModsInStartedAndStoppingReachNeitherTheGameNorTheOtherMods() throws Exception
|
||||
{
|
||||
TestMods.folder(this.mods, "economy", TestMods.toml("economy", "economy.EconomyMod", ForgeTest.USES_GAME), Map.of(
|
||||
"economy/EconomyMod", TestMods.modClass("economy/EconomyMod", "economy", null, false)
|
||||
));
|
||||
TestMods.folder(this.mods, "errors", TestMods.toml("errors", ErrorMod.class.getName(), "[dependencies]\neconomy = \"1.0\"\n"), Map.of(
|
||||
"testmods/ErrorMod", TestMods.classFile(ErrorMod.class)
|
||||
));
|
||||
|
||||
Forge forge = this.load();
|
||||
|
||||
forge.started();
|
||||
forge.stopping();
|
||||
|
||||
assertEquals(List.of("economy:new", "economy:onLoad", "economy:onServerStarted", "economy:onStopping"), Recorder.EVENTS, "economy is stopped after errors stopped");
|
||||
assertEquals(Lifecycle.Phase.STOPPING, forge.phase());
|
||||
}
|
||||
|
||||
@Test
|
||||
void failsWhenTheEntryPointIsNoMod() throws IOException
|
||||
{
|
||||
|
||||
@@ -26,6 +26,15 @@ class ModVersionTest
|
||||
assertThrows(IllegalArgumentException.class, () -> ModVersion.parse("v1.0"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void rejectsNumbersOutsideTheIntRange()
|
||||
{
|
||||
assertEquals(new ModVersion(999999999, 0, 0, null), ModVersion.parse("999999999"));
|
||||
assertTrue(ModVersion.tryParse("99999999999").isEmpty());
|
||||
assertTrue(ModVersion.tryParse("1.99999999999").isEmpty());
|
||||
assertTrue(ModVersion.tryParse("1.0.99999999999").isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
void preReleaseSortsBeforeRelease()
|
||||
{
|
||||
|
||||
@@ -152,6 +152,22 @@ class MainThreadQueueTest
|
||||
assertEquals(List.of("ERROR: A main-thread task threw. (java.lang.IllegalStateException: executed)"), this.logger.messages);
|
||||
}
|
||||
|
||||
@Test
|
||||
void logsErrorsOfTasksAndRunsTheNextTask() throws Exception
|
||||
{
|
||||
MainThread a = this.queue.forMod("a", this.logger);
|
||||
|
||||
MainThreadQueueTest.fromOtherThread(() -> {
|
||||
a.execute(() -> { throw new AssertionError("failed"); });
|
||||
a.execute(() -> this.ran.add("next"));
|
||||
});
|
||||
|
||||
this.queue.drain();
|
||||
|
||||
assertEquals(List.of("next"), this.ran);
|
||||
assertEquals(List.of("ERROR: A main-thread task threw. (java.lang.AssertionError: failed)"), this.logger.messages);
|
||||
}
|
||||
|
||||
@Test
|
||||
void closeCancelsQueuedTasksAndRejectsNewOnes() throws Exception
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -34,6 +35,8 @@ class ModTablesTest
|
||||
{
|
||||
private enum Mode { EASY, HARD }
|
||||
|
||||
private enum RenamedMode { SIMPLE, HARD }
|
||||
|
||||
private record Everything(String text, long big, int small, double ratio, float factor, boolean flag, byte[] bytes, UUID id, Instant when, Mode mode, @Nullable Long optional) {}
|
||||
|
||||
private record Balance(long coins) {}
|
||||
@@ -46,6 +49,10 @@ class ModTablesTest
|
||||
|
||||
private record Empty() {}
|
||||
|
||||
private record Difficulty(Mode mode) {}
|
||||
|
||||
private record RenamedDifficulty(RenamedMode mode) {}
|
||||
|
||||
@TempDir
|
||||
Path directory;
|
||||
|
||||
@@ -90,6 +97,18 @@ class ModTablesTest
|
||||
assertTrue(Files.isRegularFile(this.file), "the database is created on first use");
|
||||
}
|
||||
|
||||
@Test
|
||||
void reportsUnreadableStoredValuesAsStorageExceptions()
|
||||
{
|
||||
this.storage("shop").table("difficulties", Difficulty.class).set("a", new Difficulty(Mode.EASY));
|
||||
|
||||
Table<RenamedDifficulty> renamed = this.storage("shop").table("difficulties", RenamedDifficulty.class);
|
||||
|
||||
StorageException e = assertThrows(StorageException.class, () -> renamed.get("a"));
|
||||
assertTrue(e.getMessage().startsWith("Column 'mode' of 'RenamedDifficulty' holds 'EASY', which is not a valid 'RenamedMode': "), e.getMessage());
|
||||
assertThrows(StorageException.class, () -> renamed.forEach((key, difficulty) -> {}));
|
||||
}
|
||||
|
||||
@Test
|
||||
void readsAndWritesRows()
|
||||
{
|
||||
@@ -140,6 +159,50 @@ class ModTablesTest
|
||||
assertEquals(9, sum);
|
||||
}
|
||||
|
||||
@Test
|
||||
void rollsBackAFailedNestedTransactionThatTheOuterOneCatches()
|
||||
{
|
||||
ModStorage storage = this.storage("shop");
|
||||
Table<Balance> balances = storage.table("balances", Balance.class);
|
||||
|
||||
storage.transaction(() -> {
|
||||
balances.set("a", new Balance(1));
|
||||
|
||||
assertThrows(IllegalStateException.class, () -> storage.transaction(() -> {
|
||||
balances.set("a", new Balance(100));
|
||||
balances.set("b", new Balance(100));
|
||||
throw new IllegalStateException("abort");
|
||||
}));
|
||||
|
||||
balances.set("c", new Balance(3));
|
||||
});
|
||||
|
||||
assertEquals(Optional.of(new Balance(1)), balances.get("a"));
|
||||
assertFalse(balances.contains("b"));
|
||||
assertEquals(Optional.of(new Balance(3)), balances.get("c"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void rollsBackForErrorsAndUndeclaredCheckedExceptions()
|
||||
{
|
||||
ModStorage storage = this.storage("shop");
|
||||
Table<Balance> balances = storage.table("balances", Balance.class);
|
||||
|
||||
assertThrows(AssertionError.class, () -> storage.transaction(() -> {
|
||||
balances.set("a", new Balance(1));
|
||||
throw new AssertionError("abort");
|
||||
}));
|
||||
assertThrows(Exception.class, () -> storage.transaction(() -> {
|
||||
balances.set("b", new Balance(1));
|
||||
ModTablesTest.sneakyThrow(new Exception("abort"));
|
||||
}));
|
||||
|
||||
assertEquals(0, balances.count());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <E extends Throwable> void sneakyThrow(Throwable t) throws E { throw (E) t; }
|
||||
|
||||
@Test
|
||||
void keepsModsApart()
|
||||
{
|
||||
@@ -277,6 +340,38 @@ class ModTablesTest
|
||||
assertTrue(balances.contains("b"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void backupsDoNotWaitForeverForStorage() throws Exception
|
||||
{
|
||||
Table<Balance> balances = this.storage("shop").table("balances", Balance.class);
|
||||
balances.set("a", new Balance(1));
|
||||
|
||||
CountDownLatch inside = new CountDownLatch(1);
|
||||
CountDownLatch release = new CountDownLatch(1);
|
||||
Thread holder = Thread.ofPlatform().start(() -> this.storage("shop").transaction(() -> {
|
||||
inside.countDown();
|
||||
ModTablesTest.await(release);
|
||||
}));
|
||||
|
||||
assertTrue(inside.await(5, TimeUnit.SECONDS));
|
||||
|
||||
String problem = this.database.backupStarted(Duration.ofSeconds(1));
|
||||
assertEquals("Storage was busy for 1 s; the backup runs without pausing storage, so its copy of 'zomboidforge.db' may be incomplete.", problem);
|
||||
this.database.backupFinished();
|
||||
|
||||
release.countDown();
|
||||
holder.join();
|
||||
|
||||
balances.set("b", new Balance(2));
|
||||
assertTrue(balances.contains("b"), "storage stays usable after the skipped pause");
|
||||
}
|
||||
|
||||
private static void await(CountDownLatch latch)
|
||||
{
|
||||
try { latch.await(); }
|
||||
catch (InterruptedException e) { Thread.currentThread().interrupt(); }
|
||||
}
|
||||
|
||||
@Test
|
||||
void rejectsBadNamesTypesAndUseAfterClose()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package testmods;
|
||||
|
||||
import dev.overlord.zomboidforge.api.Mod;
|
||||
|
||||
/**
|
||||
* Entry point that tests package into a mod jar. Its lifecycle methods throw errors, which aren't
|
||||
* {@link RuntimeException}.
|
||||
*/
|
||||
public final class ErrorMod extends Mod
|
||||
{
|
||||
@Override
|
||||
public void onServerStarted() { throw new AssertionError("started"); }
|
||||
|
||||
@Override
|
||||
public void onStopping() { throw new NoClassDefFoundError("stopping"); }
|
||||
}
|
||||
@@ -32,7 +32,8 @@ public abstract class DownloadGame extends DefaultTask
|
||||
static final String JAR = "java/projectzomboid.jar";
|
||||
|
||||
private static final String APP_ID = "380870";
|
||||
private static final String IMAGE = "docker.io/steamcmd/steamcmd:latest";
|
||||
// The same image as the Dockerfile's server stage.
|
||||
private static final String IMAGE = "docker.io/steamcmd/steamcmd:debian-13@sha256:b0b49ef3101c304ed6e3fbc3ea930b2940d7c489563a1ebac524ad5bb46d336d";
|
||||
private static final int MAX_ATTEMPTS = 3;
|
||||
|
||||
@Internal
|
||||
|
||||
+15
-3
@@ -102,7 +102,7 @@ public abstract class GenerateModDescriptor extends DefaultTask
|
||||
if (!dependencies.isEmpty())
|
||||
{
|
||||
toml.append("\n[dependencies]\n");
|
||||
dependencies.forEach((id, version) -> toml.append(id).append(" = ").append(GenerateModDescriptor.string(version)).append('\n'));
|
||||
dependencies.forEach((id, version) -> toml.append(GenerateModDescriptor.string(id)).append(" = ").append(GenerateModDescriptor.string(version)).append('\n'));
|
||||
}
|
||||
|
||||
return toml.toString();
|
||||
@@ -110,6 +110,18 @@ public abstract class GenerateModDescriptor extends DefaultTask
|
||||
|
||||
private static String list(List<String> values) { return values.stream().map(GenerateModDescriptor::string).collect(Collectors.joining(", ", "[", "]")); }
|
||||
|
||||
/** A TOML basic string. */
|
||||
private static String string(String value) { return "\"" + value.replace("\\", "\\\\").replace("\"", "\\\"") + "\""; }
|
||||
/** A TOML basic string, also used for keys: backslashes, quotes, and control characters are escaped. */
|
||||
private static String string(String value)
|
||||
{
|
||||
StringBuilder escaped = new StringBuilder("\"");
|
||||
|
||||
for (char c : value.toCharArray())
|
||||
{
|
||||
if (c == '\\' || c == '"') escaped.append('\\').append(c);
|
||||
else if (c < 0x20 || c == 0x7F) escaped.append(String.format("\\u%04X", (int) c));
|
||||
else escaped.append(c);
|
||||
}
|
||||
|
||||
return escaped.append('"').toString();
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package dev.overlord.zomboidforge.gradle;
|
||||
import org.gradle.api.DefaultTask;
|
||||
import org.gradle.api.GradleException;
|
||||
import org.gradle.api.file.DirectoryProperty;
|
||||
import org.gradle.api.file.RegularFileProperty;
|
||||
import org.gradle.api.provider.Property;
|
||||
import org.gradle.api.tasks.Input;
|
||||
import org.gradle.api.tasks.Internal;
|
||||
@@ -15,6 +16,13 @@ import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.nio.file.attribute.PosixFileAttributeView;
|
||||
import java.nio.file.attribute.PosixFilePermissions;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -37,6 +45,8 @@ public abstract class RunServer extends DefaultTask
|
||||
/** Seconds the server gets to save the world after a stop request. */
|
||||
private static final int STOP_TIMEOUT = 120;
|
||||
|
||||
private static final SecureRandom RANDOM = new SecureRandom();
|
||||
|
||||
/** Contains one folder per mod, as in {@code <forge>/mods}. */
|
||||
@Internal
|
||||
public abstract DirectoryProperty getModsDirectory();
|
||||
@@ -50,9 +60,17 @@ public abstract class RunServer extends DefaultTask
|
||||
@Input
|
||||
public abstract Property<String> getDataVolume();
|
||||
|
||||
@Input
|
||||
/** Not an input, so it is not stored in the task history. */
|
||||
@Internal
|
||||
public abstract Property<String> getAdminPassword();
|
||||
|
||||
/** Holds the generated admin password of the volume when {@link #getAdminPassword()} is not set. */
|
||||
@Internal
|
||||
public abstract RegularFileProperty getAdminPasswordFile();
|
||||
|
||||
@Input
|
||||
public abstract Property<String> getServerAddress();
|
||||
|
||||
@Input
|
||||
@Optional
|
||||
public abstract Property<String> getContainerEngine();
|
||||
@@ -62,21 +80,26 @@ public abstract class RunServer extends DefaultTask
|
||||
{
|
||||
String engine = Executables.containerEngine(this.getContainerEngine().getOrNull());
|
||||
String name = this.getContainerName().get();
|
||||
String address = this.getServerAddress().get();
|
||||
|
||||
// ADMIN_PASSWORD without a value takes the value from the engine's environment, so it is not in the command line.
|
||||
List<String> command = List.of(
|
||||
engine, "run", "--rm",
|
||||
"--name", name,
|
||||
"--publish", "16261:16261/udp",
|
||||
"--publish", "16262:16262/udp",
|
||||
"--env", "ADMIN_PASSWORD=" + this.getAdminPassword().get(),
|
||||
"--publish", address + ":16261:16261/udp",
|
||||
"--publish", address + ":16262:16262/udp",
|
||||
"--env", "ADMIN_PASSWORD",
|
||||
"--volume", this.getDataVolume().get() + ":/data",
|
||||
"--volume", this.getModsDirectory().get().getAsFile().getAbsolutePath() + ":/forge/mods:ro,Z",
|
||||
this.getImage().get()
|
||||
);
|
||||
|
||||
this.getLogger().lifecycle("Starting {} with the mod; connect to localhost:16261. Cancel the build (Ctrl+C) to stop the server.", this.getImage().get());
|
||||
ProcessBuilder builder = new ProcessBuilder(command).redirectErrorStream(true);
|
||||
builder.environment().put("ADMIN_PASSWORD", this.adminPassword());
|
||||
|
||||
Process process = new ProcessBuilder(command).redirectErrorStream(true).start();
|
||||
this.getLogger().lifecycle("Starting {} with the mod on {}:16261. Cancel the build (Ctrl+C) to stop the server.", this.getImage().get(), address);
|
||||
|
||||
Process process = builder.start();
|
||||
Thread output = new Thread(() -> RunServer.forward(process), "runServer output");
|
||||
|
||||
output.setDaemon(true);
|
||||
@@ -96,6 +119,42 @@ public abstract class RunServer extends DefaultTask
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The configured admin password, else the one in {@link #getAdminPasswordFile()}; a random one
|
||||
* is generated into the file when it does not exist. The server uses the password only when it
|
||||
* creates the admin account on the volume's first start.
|
||||
*/
|
||||
private String adminPassword() throws IOException
|
||||
{
|
||||
String configured = this.getAdminPassword().getOrNull();
|
||||
if (configured != null) return configured;
|
||||
|
||||
Path file = this.getAdminPasswordFile().get().getAsFile().toPath();
|
||||
|
||||
if (Files.exists(file)) return Files.readString(file, StandardCharsets.UTF_8).strip();
|
||||
|
||||
byte[] random = new byte[18];
|
||||
RunServer.RANDOM.nextBytes(random);
|
||||
|
||||
String password = Base64.getUrlEncoder().withoutPadding().encodeToString(random);
|
||||
|
||||
Files.createDirectories(file.getParent());
|
||||
Files.writeString(file, password, StandardCharsets.UTF_8, StandardOpenOption.CREATE_NEW);
|
||||
RunServer.restrictToOwner(file);
|
||||
|
||||
this.getLogger().lifecycle("Generated the admin password '{}' for '{}', kept in '{}'.", password, this.getDataVolume().get(), file);
|
||||
|
||||
return password;
|
||||
}
|
||||
|
||||
/** Makes {@code file} readable and writable by its owner only, where the file system has POSIX permissions. */
|
||||
private static void restrictToOwner(Path file) throws IOException
|
||||
{
|
||||
if (!Files.getFileStore(file).supportsFileAttributeView(PosixFileAttributeView.class)) return;
|
||||
|
||||
Files.setPosixFilePermissions(file, PosixFilePermissions.fromString("rw-------"));
|
||||
}
|
||||
|
||||
/** Copies the container's output to the build output, line by line. */
|
||||
private static void forward(Process process)
|
||||
{
|
||||
|
||||
+8
-1
@@ -64,9 +64,16 @@ public abstract class ZomboidForgeExtension
|
||||
/** Image for {@code runServer}. Default: the ZomboidForge image tagged "latest". */
|
||||
public abstract Property<String> getServerImage();
|
||||
|
||||
/** Admin password of the {@code runServer} server. Default: "admin". */
|
||||
/**
|
||||
* Admin password of the {@code runServer} server, used when its volume is created. Default:
|
||||
* a random password, generated once per volume and kept in
|
||||
* {@code <Gradle user home>/zomboidforge/admin-passwords/<volume>}.
|
||||
*/
|
||||
public abstract Property<String> getAdminPassword();
|
||||
|
||||
/** Host address {@code runServer} publishes the game ports on. Default: "127.0.0.1" (this machine only); "0.0.0.0" for every interface. */
|
||||
public abstract Property<String> getServerAddress();
|
||||
|
||||
/** Volume for the {@code runServer} server's /data (world, config). Default: "zomboidforge-<id>". */
|
||||
public abstract Property<String> getDataVolume();
|
||||
|
||||
|
||||
+8
-2
@@ -55,6 +55,7 @@ public final class ZomboidForgeModPlugin implements Plugin<Project>
|
||||
private static final String TOOLS = "dev.overlord.zomboidforge:mod-tools:";
|
||||
private static final String TOOLS_MAIN = "dev.overlord.zomboidforge.tools.ModCheck";
|
||||
private static final String DEFAULT_IMAGE = "git.security-command.org/overlord/zomboidforge:latest";
|
||||
private static final String MOD_CONFIG = "config.toml";
|
||||
private static final int JAVA = 25;
|
||||
|
||||
@Override
|
||||
@@ -72,7 +73,7 @@ public final class ZomboidForgeModPlugin implements Plugin<Project>
|
||||
extension.getApi().convention(version);
|
||||
extension.getSteamBranch().convention("public");
|
||||
extension.getServerImage().convention(ZomboidForgeModPlugin.DEFAULT_IMAGE);
|
||||
extension.getAdminPassword().convention("admin");
|
||||
extension.getServerAddress().convention("127.0.0.1");
|
||||
extension.getDataVolume().convention(extension.getId().map(id -> "zomboidforge-" + id));
|
||||
extension.getGameJar().convention(layout.file(project.getProviders().gradleProperty("zomboidforge.gameJar").map(File::new)));
|
||||
|
||||
@@ -220,6 +221,8 @@ public final class ZomboidForgeModPlugin implements Plugin<Project>
|
||||
project.getTasks().named(LifecycleBasePlugin.ASSEMBLE_TASK_NAME, task -> task.dependsOn(modFolder, modZip));
|
||||
|
||||
// Trying the mod.
|
||||
File passwords = new File(project.getGradle().getGradleUserHomeDir(), "zomboidforge/admin-passwords");
|
||||
|
||||
project.getTasks().register("runServer", RunServer.class, task ->
|
||||
{
|
||||
task.setGroup(ZomboidForgeModPlugin.GROUP);
|
||||
@@ -230,14 +233,17 @@ public final class ZomboidForgeModPlugin implements Plugin<Project>
|
||||
task.getContainerName().set(id.map(name -> "zomboidforge-" + name));
|
||||
task.getDataVolume().set(extension.getDataVolume());
|
||||
task.getAdminPassword().set(extension.getAdminPassword());
|
||||
task.getAdminPasswordFile().set(layout.file(extension.getDataVolume().map(volume -> new File(passwords, volume))));
|
||||
task.getServerAddress().set(extension.getServerAddress());
|
||||
task.getContainerEngine().set(extension.getContainerEngine());
|
||||
});
|
||||
|
||||
project.getTasks().register("deployMod", Sync.class, task ->
|
||||
{
|
||||
task.setGroup(ZomboidForgeModPlugin.GROUP);
|
||||
task.setDescription("Copies the mod folder into zomboidForge.deployDirectory (a server's mods directory).");
|
||||
task.setDescription("Copies the mod folder into zomboidForge.deployDirectory (a server's mods directory); keeps the server's config.toml of the mod.");
|
||||
task.from(modFolder);
|
||||
task.preserve(filter -> filter.include(ZomboidForgeModPlugin.MOD_CONFIG));
|
||||
task.into(extension.getDeployDirectory().dir(id).orElse(layout.getBuildDirectory().dir("deploy-not-configured")));
|
||||
task.onlyIf("zomboidForge.deployDirectory is set", element -> extension.getDeployDirectory().isPresent());
|
||||
});
|
||||
|
||||
+35
-1
@@ -22,6 +22,7 @@ import java.util.jar.JarOutputStream;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.objectweb.asm.Opcodes.ACC_FINAL;
|
||||
import static org.objectweb.asm.Opcodes.ACC_PRIVATE;
|
||||
@@ -140,6 +141,23 @@ class ZomboidForgeModPluginTest
|
||||
assertEquals(TaskOutcome.UP_TO_DATE, again.task(":checkMod").getOutcome());
|
||||
}
|
||||
|
||||
@Test
|
||||
void deployReplacesTheModButKeepsTheServerSettings() throws IOException
|
||||
{
|
||||
this.modProject(" deployDirectory = layout.projectDirectory.dir(\"server/mods\")", "");
|
||||
|
||||
Path deployed = this.project.resolve("server/mods/shop");
|
||||
this.write("server/mods/shop/config.toml", "limit = 7\n");
|
||||
this.write("server/mods/shop/lib/old.jar", "");
|
||||
|
||||
this.runner("deployMod").build();
|
||||
|
||||
assertTrue(Files.isRegularFile(deployed.resolve("shop.jar")));
|
||||
assertTrue(Files.isRegularFile(deployed.resolve("lib/util.jar")));
|
||||
assertFalse(Files.exists(deployed.resolve("lib/old.jar")), "files the mod no longer has are removed");
|
||||
assertEquals("limit = 7\n", Files.readString(deployed.resolve("config.toml")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void checksAGameModAgainstTheGameJar() throws IOException
|
||||
{
|
||||
@@ -159,7 +177,7 @@ class ZomboidForgeModPluginTest
|
||||
String toml = new String(jar.getInputStream(jar.getEntry("META-INF/zomboidforge/mod.toml")).readAllBytes(), StandardCharsets.UTF_8);
|
||||
|
||||
assertTrue(toml.contains("game = [\"42.21\"]"), toml);
|
||||
assertTrue(toml.contains("[dependencies]\neconomy = \"2.0\""), toml);
|
||||
assertTrue(toml.contains("[dependencies]\n\"economy\" = \"2.0\""), toml);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,6 +207,22 @@ class ZomboidForgeModPluginTest
|
||||
assertTrue(result.getOutput().contains("is written by hand; the ZomboidForge plugin generates mod.toml from zomboidForge { }."), result.getOutput());
|
||||
}
|
||||
|
||||
@Test
|
||||
void writesAnyTextAsValidToml() throws IOException
|
||||
{
|
||||
this.modProject("""
|
||||
name = "Shop\\tMod \\"one\\""
|
||||
dependsOn("eco.nomy", "2.0")
|
||||
""", "");
|
||||
|
||||
BuildResult result = this.runner("build").buildAndFail();
|
||||
|
||||
assertTrue(result.getOutput().contains("'dependencies' contains 'eco.nomy', which is not a valid mod id."), result.getOutput());
|
||||
|
||||
String toml = Files.readString(this.project.resolve("build/generated/zomboidforge/descriptor/META-INF/zomboidforge/mod.toml"));
|
||||
assertTrue(toml.contains("name = \"Shop\\u0009Mod \\\"one\\\"\""), toml);
|
||||
}
|
||||
|
||||
@Test
|
||||
void failsWhenTheEntryPointIsMissing() throws IOException
|
||||
{
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@ group=dev.overlord.zomboidforge
|
||||
|
||||
# Project Zomboid version the build targets. Selects compat/b<major>/, and
|
||||
# :patcher:patchServerJar fails when the server jar reports another version.
|
||||
# "42.21" matches every 42.21.x build; "42.21.0" matches exactly.
|
||||
pz.version=42.21
|
||||
# "42" matches every Build 42 version, "42.21" every 42.21.x build, "42.21.0" exactly.
|
||||
pz.version=42
|
||||
|
||||
# Vanilla dedicated server jar used for compilation and patching.
|
||||
# Default: lib/server/java/projectzomboid.jar (relative to the root project).
|
||||
|
||||
@@ -3,6 +3,7 @@ asm = "9.10.1"
|
||||
junit = "6.1.3"
|
||||
jetbrains-annotations = "26.0.2"
|
||||
night-config = "3.9.0"
|
||||
shadow = "9.6.1"
|
||||
sqlite-jdbc = "3.48.0.0" # Same version as the SQLite JDBC driver bundled in Project Zomboid (sqlite-jdbc.properties).
|
||||
|
||||
[libraries]
|
||||
@@ -20,3 +21,6 @@ junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher
|
||||
|
||||
[bundles]
|
||||
asm = ["asm", "asm-tree", "asm-commons", "asm-util"]
|
||||
|
||||
[plugins]
|
||||
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
|
||||
@@ -0,0 +1,884 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<verification-metadata xmlns="https://schema.gradle.org/dependency-verification" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://schema.gradle.org/dependency-verification https://schema.gradle.org/dependency-verification/dependency-verification-1.4.xsd">
|
||||
<configuration>
|
||||
<verify-metadata>true</verify-metadata>
|
||||
<verify-signatures>false</verify-signatures>
|
||||
<trusted-artifacts>
|
||||
<trust file=".*-javadoc[.]jar" regex="true"/>
|
||||
<trust file=".*-sources[.]jar" regex="true"/>
|
||||
</trusted-artifacts>
|
||||
</configuration>
|
||||
<components>
|
||||
<component group="com.electronwill.night-config" name="core" version="3.9.0">
|
||||
<artifact name="core-3.9.0.jar">
|
||||
<sha256 value="cd890520bd3c680cf82e79f16071de9c8f367206a2f841c777d944289f343ebc" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="core-3.9.0.module">
|
||||
<sha256 value="b3110c2f09d492dbb9c28485a678c75c18abc19090e22a70d053661c78caa958" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="com.electronwill.night-config" name="toml" version="3.9.0">
|
||||
<artifact name="toml-3.9.0.jar">
|
||||
<sha256 value="475e6fa3315619294d5ab74f2eb80f0705129d43e652d3ccd5337c77d0a29a6b" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="toml-3.9.0.module">
|
||||
<sha256 value="6b06ac9284f0daa19464263852b04cba4e77e6d1193ccbe0693aee4a89640fe1" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="com.fasterxml" name="oss-parent" version="55">
|
||||
<artifact name="oss-parent-55.pom">
|
||||
<sha256 value="0f5e18f2b35ebf6d839f7fd549972883f696c210f9ae3230afd2c20ba886c04d" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="com.fasterxml" name="oss-parent" version="68">
|
||||
<artifact name="oss-parent-68.pom">
|
||||
<sha256 value="25eafd96dae242b6b5a7108f55b2c14015b828daa5abe234289fd6e774a1ce57" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="com.fasterxml" name="oss-parent" version="69">
|
||||
<artifact name="oss-parent-69.pom">
|
||||
<sha256 value="3856d584aaa1c8e33ce94c67244f71f6f70538a259ffe8e781761b9faaad875f" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="com.fasterxml.jackson" name="jackson-bom" version="2.19.2">
|
||||
<artifact name="jackson-bom-2.19.2.pom">
|
||||
<sha256 value="22006be70fd018099e99c6c27ac0982320f3a0f3c2ce053c55703579a5eea303" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="com.fasterxml.jackson" name="jackson-parent" version="2.19.3">
|
||||
<artifact name="jackson-parent-2.19.3.pom">
|
||||
<sha256 value="23d186c8d8cd06015d022c710c715423d660d49e2973b15870b029cc26018682" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="com.fasterxml.woodstox" name="woodstox-core" version="7.1.1">
|
||||
<artifact name="woodstox-core-7.1.1.jar">
|
||||
<sha256 value="02b9d022e9d47704ff8a7a859a0dbfd3b2882a8311eb7ff1e180f760ccda2712" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="woodstox-core-7.1.1.pom">
|
||||
<sha256 value="afb5cb45d41c1f9e3675909de4fef242bdc1cea4476a0634ae20f4d7a54433ff" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="com.google.code.gson" name="gson" version="2.11.0">
|
||||
<artifact name="gson-2.11.0.jar">
|
||||
<sha256 value="57928d6e5a6edeb2abd3770a8f95ba44dce45f3b23b7a9dc2b309c581552a78b" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="gson-2.11.0.pom">
|
||||
<sha256 value="c0e547bea998888e6e25c5886a90e762272bc88b5275343dd2c05ded6ca2e360" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="com.google.code.gson" name="gson-parent" version="2.11.0">
|
||||
<artifact name="gson-parent-2.11.0.pom">
|
||||
<sha256 value="8acb1f3b72a6f026916ac0735bad9aab0293d527edb7b365327def13a9367b7a" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="com.google.errorprone" name="error_prone_annotations" version="2.27.0">
|
||||
<artifact name="error_prone_annotations-2.27.0.jar">
|
||||
<sha256 value="24c923372c58e35d0b9f16a028929bb9aedc77521867c274f2bd0735df5ba1f5" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="error_prone_annotations-2.27.0.pom">
|
||||
<sha256 value="4ca5a35d61235e16549ac346d1e34551cdf0fe27e84aa57e03cbeb255ea4e5da" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="com.google.errorprone" name="error_prone_parent" version="2.27.0">
|
||||
<artifact name="error_prone_parent-2.27.0.pom">
|
||||
<sha256 value="fa81829d049559df6927f9c9a6fd6bbd09f8b50e6d4736ae72c8300b6c3d7654" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="com.gradleup.shadow" name="com.gradleup.shadow.gradle.plugin" version="9.6.1">
|
||||
<artifact name="com.gradleup.shadow.gradle.plugin-9.6.1.pom">
|
||||
<sha256 value="3e3e0fa4124c31db0f0a8c7502ca6574abc09dc383a5ac5c582040d53244d112" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="com.gradleup.shadow" name="shadow-gradle-plugin" version="9.6.1">
|
||||
<artifact name="shadow-gradle-plugin-9.6.1.jar">
|
||||
<sha256 value="7053bc4366cf80798f205e37f4f649cde516081e5e653a3c49ea6700b2047b11" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="shadow-gradle-plugin-9.6.1.module">
|
||||
<sha256 value="dabee846ad818d012ceb002d61fac34fb4937f74eeeb4c964519318a2a260d25" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="commons-codec" name="commons-codec" version="1.22.0">
|
||||
<artifact name="commons-codec-1.22.0.jar">
|
||||
<sha256 value="d164fe79f262c32d9b18a0b5b2d317d1c27653d5e98fd2b998c24bf901c72ce4" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="commons-codec-1.22.0.pom">
|
||||
<sha256 value="d9a565d978faa69d2b1195fb1ec27e60f29e7feb09afb85adac78f280068f8fe" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="commons-io" name="commons-io" version="2.22.0">
|
||||
<artifact name="commons-io-2.22.0.jar">
|
||||
<sha256 value="2b9a7b1f726fb86216dbd2c8321eabe0221dbd5b1be81c18e1cb53811b104758" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="commons-io-2.22.0.pom">
|
||||
<sha256 value="6425cec0ea760035efa77277de85f89fa6dbed147ab3dd95b8d2cbc55340accf" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="jakarta.platform" name="jakarta.jakartaee-bom" version="9.1.0">
|
||||
<artifact name="jakarta.jakartaee-bom-9.1.0.pom">
|
||||
<sha256 value="df98e0266219fdbb82562826d79a3a20776a8ba02aa787f0f0765a538654c8a4" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="jakarta.platform" name="jakartaee-api-parent" version="9.1.0">
|
||||
<artifact name="jakartaee-api-parent-9.1.0.pom">
|
||||
<sha256 value="a7702c487026802784b5797b62330a8b8d6592bf0f4737b25c67a5eac82659c0" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.apache" name="apache" version="35">
|
||||
<artifact name="apache-35.pom">
|
||||
<sha256 value="ea297dcd114136e8b8e8b630230d52a76c2fc69f6c5db25d672b1857000728b8" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.apache" name="apache" version="37">
|
||||
<artifact name="apache-37.pom">
|
||||
<sha256 value="524ec4787aff73af6b3a9fafa154c7f1881b648299b663fdbfcadda1286f2353" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.apache.ant" name="ant" version="1.10.17">
|
||||
<artifact name="ant-1.10.17.jar">
|
||||
<sha256 value="8be692e02837f41a47a3d21cde6655792142fdf42fe23bcb16d7129cad9b2284" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="ant-1.10.17.pom">
|
||||
<sha256 value="63a6eb88e2e0fcd76967aae7e6f5811b02f3f9c52d96db766b6b4905768fc62b" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.apache.ant" name="ant-launcher" version="1.10.17">
|
||||
<artifact name="ant-launcher-1.10.17.jar">
|
||||
<sha256 value="f6e3de06dc0ea396638004f1a003f55fdbd20c3e7ccfb9b7a524f49fd0ae8568" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="ant-launcher-1.10.17.pom">
|
||||
<sha256 value="f400b6a35d13bd9e71eac48359f1d91fbf7d40c86d9c776ec3167f7108795ecd" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.apache.ant" name="ant-parent" version="1.10.17">
|
||||
<artifact name="ant-parent-1.10.17.pom">
|
||||
<sha256 value="9a9ef70732bee11a34a08643aa69463d1c258658401d7279a54f73ad0a15a9e4" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.apache.commons" name="commons-parent" version="98">
|
||||
<artifact name="commons-parent-98.pom">
|
||||
<sha256 value="d40318527f56033e0ff0789971cc38c856aa99a685eea11270814e7f1eda9fba" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.apache.groovy" name="groovy-bom" version="4.0.27">
|
||||
<artifact name="groovy-bom-4.0.27.module">
|
||||
<sha256 value="d6c2254c8347b84cda84caf74914a187c2f377e4284e8d8bb3f901521810aa8b" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="groovy-bom-4.0.27.pom">
|
||||
<sha256 value="aa44eb52bfdfe61d27b3e450d2b348d88deaa3437ab4d9d49a84095348f9f6fb" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.apache.logging.log4j" name="log4j" version="2.26.1">
|
||||
<artifact name="log4j-2.26.1.pom">
|
||||
<sha256 value="ea4705725fd94bf5debe2911d4ea7af20898603f68354e64b2461a0f249e445d" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.apache.logging.log4j" name="log4j-api" version="2.26.1">
|
||||
<artifact name="log4j-api-2.26.1.jar">
|
||||
<sha256 value="f1810a4704ccce019d02bba029dc02a4f2ac0c997f647b465e7d409c1927f822" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="log4j-api-2.26.1.module">
|
||||
<sha256 value="5ed93f6fb5334bf7ee52943d1a654bc3a1f3f10765ae2fd4bbd387333be6678a" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.apache.logging.log4j" name="log4j-bom" version="2.26.1">
|
||||
<artifact name="log4j-bom-2.26.1.pom">
|
||||
<sha256 value="4415ad189dd04db54958a43e23b37cc397a1edee9e888214b8bd47fbe819072e" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.apache.logging.log4j" name="log4j-core" version="2.26.1">
|
||||
<artifact name="log4j-core-2.26.1.jar">
|
||||
<sha256 value="2ec8c3bf5a6d7c89be8620116a2fc973f7dda1ad0261ad393c4d4726edfd3dcb" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="log4j-core-2.26.1.module">
|
||||
<sha256 value="03bfd8adbe306ac46001ec9de668f8e5d24f6659f212fc64e62a1b672a5a2f6a" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.apache.maven" name="maven" version="4.0.0-rc-5">
|
||||
<artifact name="maven-4.0.0-rc-5.pom">
|
||||
<sha256 value="8514a1eb3998f1222d24580909c4576d5cf0df53d4069dbbb4ca6d34313802f5" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.apache.maven" name="maven-api" version="4.0.0-rc-5">
|
||||
<artifact name="maven-api-4.0.0-rc-5.pom">
|
||||
<sha256 value="610c044f0159a6e15c579ed0579403270fbf9e00e83edb276926b1cf77f5aca9" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.apache.maven" name="maven-api-annotations" version="4.0.0-rc-5">
|
||||
<artifact name="maven-api-annotations-4.0.0-rc-5.jar">
|
||||
<sha256 value="1f7325c01a0ac5a5206caff09fa388520c6505dab850178f452d2c6aad3d3c83" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="maven-api-annotations-4.0.0-rc-5.pom">
|
||||
<sha256 value="294b175b31db653d186a12c1f9c12abc30ce24d84fd08ed8ee7acd3ffcff7352" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.apache.maven" name="maven-api-xml" version="4.0.0-rc-5">
|
||||
<artifact name="maven-api-xml-4.0.0-rc-5.jar">
|
||||
<sha256 value="358851a87edd0ddd566a437470ea021ba851a0487ec4d14825ff04db03ff5877" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="maven-api-xml-4.0.0-rc-5.pom">
|
||||
<sha256 value="8a9255abee26463f9a730c5aadaef42d5914935980509bd16777f885f2732d1b" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.apache.maven" name="maven-impl-modules" version="4.0.0-rc-5">
|
||||
<artifact name="maven-impl-modules-4.0.0-rc-5.pom">
|
||||
<sha256 value="9734a4c3338786c6e6aafe7db4376cad0b9f4edea63d9efcc8e9f26f20625f35" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.apache.maven" name="maven-parent" version="45">
|
||||
<artifact name="maven-parent-45.pom">
|
||||
<sha256 value="94fe869eb9b4ce9fce3995d05ea86b168c85d927f9d17beb814a1960c76d7e6f" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.apache.maven" name="maven-xml" version="4.0.0-rc-5">
|
||||
<artifact name="maven-xml-4.0.0-rc-5.jar">
|
||||
<sha256 value="a4b7ad3e3410e0feb6438ebb6231c8e02449cd02fcf6451baed820008a103564" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="maven-xml-4.0.0-rc-5.pom">
|
||||
<sha256 value="a5030a4958eaa43b067ce360c2973190bd78ba49eecce5eaf36f196853efc92f" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.apiguardian" name="apiguardian-api" version="1.1.2">
|
||||
<artifact name="apiguardian-api-1.1.2.jar">
|
||||
<sha256 value="b509448ac506d607319f182537f0b35d71007582ec741832a1f111e5b5b70b38" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="apiguardian-api-1.1.2.module">
|
||||
<sha256 value="e08028131375b357d1d28734e9a4fb4216da84b240641cb3ef7e7c7d628223fc" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.codehaus.plexus" name="plexus" version="25">
|
||||
<artifact name="plexus-25.pom">
|
||||
<sha256 value="faa7947c2020967ad0c92b259ee9fa361d05e90cd036d17c37098bb1edaea3a3" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.codehaus.plexus" name="plexus-utils" version="4.0.3">
|
||||
<artifact name="plexus-utils-4.0.3.jar">
|
||||
<sha256 value="421ff6ed146c53a9d4eaade8f629b52b12af7187101f1bd06c2c64e904019f3c" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="plexus-utils-4.0.3.pom">
|
||||
<sha256 value="35736658f3fe1efa395086c91df2592664fafa24c3f2608fdaba1136d17fd360" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.codehaus.plexus" name="plexus-xml" version="4.1.1">
|
||||
<artifact name="plexus-xml-4.1.1.jar">
|
||||
<sha256 value="e09b1fcc46da744a0e4dabe703f287ce133b631ea95c6e1a8a82ebad2b1a2815" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="plexus-xml-4.1.1.pom">
|
||||
<sha256 value="cf88711cc5bf9089334710e727616095407cf04b968375677e0ddaa98aa57e0d" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.codehaus.woodstox" name="stax2-api" version="4.2.2">
|
||||
<artifact name="stax2-api-4.2.2.jar">
|
||||
<sha256 value="a61c48d553efad78bc01fffc4ac528bebbae64cbaec170b2a5e39cf61eb51abe" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="stax2-api-4.2.2.pom">
|
||||
<sha256 value="4e902ec556fc6598b41c2952ec1573edc815037e7330ec4922eab619422686e2" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.eclipse.ee4j" name="project" version="1.0.7">
|
||||
<artifact name="project-1.0.7.pom">
|
||||
<sha256 value="205c039a42cbae3556efbeb04a483eb3a3cf9550bd75bf84260dc8f28218f105" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.gradle.kotlin" name="gradle-kotlin-dsl-plugins" version="6.7.6">
|
||||
<artifact name="gradle-kotlin-dsl-plugins-6.7.6.jar">
|
||||
<sha256 value="25f9dfe83fee8d12408aca94c8b596d2ebdb7331730fad815d5470ccb92aaeb0" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="gradle-kotlin-dsl-plugins-6.7.6.module">
|
||||
<sha256 value="9e6127e1412675f5294b5324ccfde26f12a95c024e230353da2f9fe6318f43f1" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.gradle.kotlin.kotlin-dsl" name="org.gradle.kotlin.kotlin-dsl.gradle.plugin" version="6.7.6">
|
||||
<artifact name="org.gradle.kotlin.kotlin-dsl.gradle.plugin-6.7.6.pom">
|
||||
<sha256 value="a74aa6bd177ed61defa0d57524f0d9429f9553d845a4dc2d7363442090e7e2b2" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jdom" name="jdom2" version="2.0.6.1">
|
||||
<artifact name="jdom2-2.0.6.1.jar">
|
||||
<sha256 value="0b20f45e3a0fd8f0d12cdc5316b06776e902b1365db00118876f9175c60f302c" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="jdom2-2.0.6.1.pom">
|
||||
<sha256 value="55795e1018b8ae647b937967cf810a99b08582c2374e7873c128734c8c914bf3" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains" name="annotations" version="13.0">
|
||||
<artifact name="annotations-13.0.jar">
|
||||
<sha256 value="ace2a10dc8e2d5fd34925ecac03e4988b2c0f851650c94b8cef49ba1bd111478" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="annotations-13.0.pom">
|
||||
<sha256 value="965aeb2bedff369819bdde1bf7a0b3b89b8247dd69c88b86375d76163bb8c397" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains" name="annotations" version="26.0.2">
|
||||
<artifact name="annotations-26.0.2.jar">
|
||||
<sha256 value="2037be378980d3ba9333e97955f3b2cde392aa124d04ca73ce2eee6657199297" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="annotations-26.0.2.module">
|
||||
<sha256 value="bef0b8352b2dfd4cb7155ecc2a39227bf16a3e08667babec650c76b1abbfcecb" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="fus-statistics-gradle-plugin" version="2.4.10">
|
||||
<artifact name="fus-statistics-gradle-plugin-2.4.10-gradle813.jar">
|
||||
<sha256 value="d312eb7d69a8d5ac5377c712546665c9b94a63ca8fc9cdd315431f10672e8091" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="fus-statistics-gradle-plugin-2.4.10.module">
|
||||
<sha256 value="8ed5af5c6da4a233cad89f0bedacfccfd3ef0e19396a020bb974e2fedbe23e97" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-assignment" version="2.4.10">
|
||||
<artifact name="kotlin-assignment-2.4.10-gradle813.jar">
|
||||
<sha256 value="350dc125b48e62b2d458ecde12153274c1d5b644bee34a8c4565776ed43ba851" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-assignment-2.4.10.module">
|
||||
<sha256 value="bb0abf587a21039337fd81a8347564f6c5b7b1d44c7b46f15dfa41a349ee36a9" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-assignment-compiler-plugin-embeddable" version="2.4.10">
|
||||
<artifact name="kotlin-assignment-compiler-plugin-embeddable-2.4.10.jar">
|
||||
<sha256 value="f915c845195fc5dedfe893057cfa6cb806a5819f46cfca408abef483817f3afd" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-assignment-compiler-plugin-embeddable-2.4.10.pom">
|
||||
<sha256 value="ca65889d2a6b5f336035c3458f57cbdb73d300958f26a6bf50bff310b5918bef" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-build-statistics" version="2.4.10">
|
||||
<artifact name="kotlin-build-statistics-2.4.10.jar">
|
||||
<sha256 value="ba2748b67fb7b24ee1401eecfee32eb67dd055c85a59a5742188f795477a11cc" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-build-statistics-2.4.10.pom">
|
||||
<sha256 value="01cc32ad3b11274444939d06424cbf43a3e207e877683d1c851196ca19088ac1" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-build-tools-api" version="2.4.0">
|
||||
<artifact name="kotlin-build-tools-api-2.4.0.jar">
|
||||
<sha256 value="66917335497f9ab75a36c34b3d90bad2bc8dc256c34b2413ecd0c9467fcf597d" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-build-tools-api-2.4.0.pom">
|
||||
<sha256 value="9686fa8f16867b2aba2e5c0e4cfc4a0aeecf59fe6de419f89f7bd838fdde8e74" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-build-tools-api" version="2.4.10">
|
||||
<artifact name="kotlin-build-tools-api-2.4.10.jar">
|
||||
<sha256 value="3953d283e7710c990672e403a87df393d9726a9bf3e172194ebb5c33e062fcb0" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-build-tools-api-2.4.10.pom">
|
||||
<sha256 value="78242a9440f92400eaf3df8d2108ad706f669a53125845a7d31d3df7c4de4439" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-build-tools-compat" version="2.4.10">
|
||||
<artifact name="kotlin-build-tools-compat-2.4.10.jar">
|
||||
<sha256 value="cdcc50d8016f4250e7dc61822f28f227ba9a9b7d3f9eb5503c315eb12188d952" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-build-tools-compat-2.4.10.pom">
|
||||
<sha256 value="a081a796f828ae644b59950f072cd00bd64ac74f12b12e830399da8de2e4fa34" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-build-tools-cri-impl" version="2.4.0">
|
||||
<artifact name="kotlin-build-tools-cri-impl-2.4.0.jar">
|
||||
<sha256 value="5168b866945f6ac1ffcb6d4c88cf582497249469c2e4a4eafc0bcd35b5a264a9" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-build-tools-cri-impl-2.4.0.pom">
|
||||
<sha256 value="856d59395489276e93edb4390c99397de83e20d27572c5238c56ed21e43433da" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-build-tools-cri-impl" version="2.4.10">
|
||||
<artifact name="kotlin-build-tools-cri-impl-2.4.10.jar">
|
||||
<sha256 value="781c95a28f053ded2d183b818bdae98db3d6d15ebc0555cecf64800fea003b3b" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-build-tools-cri-impl-2.4.10.pom">
|
||||
<sha256 value="ada6ecb7cb544ef2fcee73e252c31f80c8e342c3bdb51bb9999fe57fec041fd2" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-build-tools-impl" version="2.4.0">
|
||||
<artifact name="kotlin-build-tools-impl-2.4.0.jar">
|
||||
<sha256 value="076c0a7f84d303f1e390774410c8678b8b584faa3f642435f93d2e4e81dabe7c" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-build-tools-impl-2.4.0.pom">
|
||||
<sha256 value="485ca3d511aa384207db5706e0741dc79ace45d40e0489f9ef29731aafb14f7c" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-build-tools-impl" version="2.4.10">
|
||||
<artifact name="kotlin-build-tools-impl-2.4.10.jar">
|
||||
<sha256 value="4a32f63522ef4726afbdee1783f05698499abc7a5ecade3a6cafa3e4074562ee" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-build-tools-impl-2.4.10.pom">
|
||||
<sha256 value="f1b431c37717f0d472cd053dc81d893204cb59280f8035d636f534bc7c5d8db4" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-compiler-embeddable" version="2.4.0">
|
||||
<artifact name="kotlin-compiler-embeddable-2.4.0.jar">
|
||||
<sha256 value="c2b25e8c1c93ec416ba4327f5e31eaec0f0c8847241b9353e294b8db9dce564f" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-compiler-embeddable-2.4.0.pom">
|
||||
<sha256 value="f5d78540108e7bbc9162253ce52c42507ead2e530945213dd2a3b793b590c53c" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-compiler-embeddable" version="2.4.10">
|
||||
<artifact name="kotlin-compiler-embeddable-2.4.10.jar">
|
||||
<sha256 value="9309638a2ee03e6bde9ef4b7444055a94b84ab906563675d71ff9aecb64da913" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-compiler-embeddable-2.4.10.pom">
|
||||
<sha256 value="c3adb4f66fbfaa843c019b402d2c7e5f0880d32956bd8dd84022946177251102" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-compiler-runner" version="2.4.0">
|
||||
<artifact name="kotlin-compiler-runner-2.4.0.jar">
|
||||
<sha256 value="ad9608152740e92d94a278b4ff2ca82c4bf5ff8ef219220e3c07aeb554638cee" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-compiler-runner-2.4.0.pom">
|
||||
<sha256 value="5e1ed156cb8d38b61e2ccc546dbd8b2bde778367eb298f8875bd820fbfd0b0f2" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-compiler-runner" version="2.4.10">
|
||||
<artifact name="kotlin-compiler-runner-2.4.10.jar">
|
||||
<sha256 value="9e869d66504572852f421bcb1625c0d564c2b3c8cecbf6cd5fef7e7f33e0013e" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-compiler-runner-2.4.10.pom">
|
||||
<sha256 value="180738762c8941c4e30d7174a92071955bd869587332d785e61391167c82bc5a" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-daemon-client" version="2.4.0">
|
||||
<artifact name="kotlin-daemon-client-2.4.0.jar">
|
||||
<sha256 value="f546f0b3699c4984f320dd03080de05cad61064208ba8f37df0d3f8f4a7fd14a" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-daemon-client-2.4.0.pom">
|
||||
<sha256 value="143793627382d905eda93e152a28c993f6323fc4b748370a45c7badc99914a13" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-daemon-client" version="2.4.10">
|
||||
<artifact name="kotlin-daemon-client-2.4.10.jar">
|
||||
<sha256 value="a3d1a5854fd92766de1ca37ff003a822d3da2039902008384dd1f7375f3d5cf9" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-daemon-client-2.4.10.pom">
|
||||
<sha256 value="f6de9e3a0e89add8e043fa76866d9a2ff10fb87963b1396377bbb00c229fde6e" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-daemon-embeddable" version="2.4.0">
|
||||
<artifact name="kotlin-daemon-embeddable-2.4.0.jar">
|
||||
<sha256 value="383093af5e078435b60043d19bfa83eb6191be0f4d13a28fb1c8a0f3ab24fe66" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-daemon-embeddable-2.4.0.pom">
|
||||
<sha256 value="cb36e780fcb39ee09aab6e398f9bd5ea27f982bb6e19329742a20eb2ebdc2936" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-daemon-embeddable" version="2.4.10">
|
||||
<artifact name="kotlin-daemon-embeddable-2.4.10.jar">
|
||||
<sha256 value="547d969a2eab602fe0bdfd9fcb1b563a5c6d30099d3351394d6427eba8288467" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-daemon-embeddable-2.4.10.pom">
|
||||
<sha256 value="44ed1a490a4b646313fc0bc2683897a1eac4d8c6b57c0825d3e81fa7ca376d35" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-gradle-plugin" version="2.4.10">
|
||||
<artifact name="kotlin-gradle-plugin-2.4.10-gradle813.jar">
|
||||
<sha256 value="13e22c869df3972db9496b47bf2815fbcfb61e0439f96cbd8d6aeb912b481375" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-gradle-plugin-2.4.10.module">
|
||||
<sha256 value="0e7713d84605da0bee038b578f31795882ccd721220a79cc36736ac9af9cb412" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-gradle-plugin-annotations" version="2.4.10">
|
||||
<artifact name="kotlin-gradle-plugin-annotations-2.4.10.jar">
|
||||
<sha256 value="15c3b98f18c874b9ac5be2565f3724b3eaf6c6cf57dc784d73516a22a9e470cf" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-gradle-plugin-annotations-2.4.10.pom">
|
||||
<sha256 value="44fc5a0a711c92df16f00d3575d0f2c4a264f43ab2f588e455b3c6043124fd53" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-gradle-plugin-api" version="2.4.10">
|
||||
<artifact name="kotlin-gradle-plugin-api-2.4.10-gradle813.jar">
|
||||
<sha256 value="74c4e4f7d037e850bab666db12c90a49e065d9495fd2dfdaa7bc39dd963083d6" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-gradle-plugin-api-2.4.10.module">
|
||||
<sha256 value="ade28e1831b222e161e00c120d5c9d56f9d4fe3b0aabed9e54912d71ab6ee8cb" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-gradle-plugin-idea" version="2.4.10">
|
||||
<artifact name="kotlin-gradle-plugin-idea-2.4.10.jar">
|
||||
<sha256 value="086734484c7edf19a620ab1a617d097c40e03bc52602e77840ea5ebd6380e514" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-gradle-plugin-idea-2.4.10.module">
|
||||
<sha256 value="7e883fbfe9d2c9ced4a8fa99217a8dd413bb14a7ea932edbbda35d5e91a5119a" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-gradle-plugin-idea-proto" version="2.4.10">
|
||||
<artifact name="kotlin-gradle-plugin-idea-proto-2.4.10.jar">
|
||||
<sha256 value="355ac566ff74d74d230f7cb6d55e2ed50158b4c28fc186fc8d8268e8fe9868f4" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-gradle-plugin-idea-proto-2.4.10.pom">
|
||||
<sha256 value="074ee0dd408de542a8e4b726daad829dc33a9e56ddb4f43a00eb9b9f67aff17f" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-gradle-plugins-bom" version="2.4.10">
|
||||
<artifact name="kotlin-gradle-plugins-bom-2.4.10.module">
|
||||
<sha256 value="48eb4756284d1d7ea24639d22861f15ff0cb685a15331a6c6a3674ff44baf029" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-gradle-plugins-bom-2.4.10.pom">
|
||||
<sha256 value="733fccda03ae34773e7b5c85d0e278c897df283370059cb39825f7c0381e49b6" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-klib-commonizer-api" version="2.4.10">
|
||||
<artifact name="kotlin-klib-commonizer-api-2.4.10.jar">
|
||||
<sha256 value="971bb968b4af10932bcc18f3395721ee48cc166597b50926731aeeff334086da" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-klib-commonizer-api-2.4.10.pom">
|
||||
<sha256 value="139b3ce8d655807eb68a45798f04329760b2106669ab332d2ac108843d758b29" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-klib-commonizer-embeddable" version="2.4.10">
|
||||
<artifact name="kotlin-klib-commonizer-embeddable-2.4.10.jar">
|
||||
<sha256 value="c5e543412f81a32ff4611a886e18399fa5afa15c77e3ef2fdc0faa397ad8abce" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-klib-commonizer-embeddable-2.4.10.pom">
|
||||
<sha256 value="bebdd5b6115a8d377edd8d00e8c1d4cfcacbf2bc0bdbb7248d43c5c7a19bafab" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-metadata-jvm" version="2.4.10">
|
||||
<artifact name="kotlin-metadata-jvm-2.4.10.jar">
|
||||
<sha256 value="233aaa84ca268e26d6d3a99ce30401e6dc111a7ae10e0a0b4794ce6351d7adc4" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-metadata-jvm-2.4.10.pom">
|
||||
<sha256 value="694915b86862dbd6060c69239690594f1f52df2543bb110a011666242a41060b" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-native-utils" version="2.4.10">
|
||||
<artifact name="kotlin-native-utils-2.4.10.jar">
|
||||
<sha256 value="76ec55f967dc8f57481a27b3e7868cc97cb32964d6d285517aef310c3d754a44" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-native-utils-2.4.10.pom">
|
||||
<sha256 value="9b91e38cfc84eaa34183140192c307ddc68f4a4c6035f554c4c22e15f33916c7" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-reflect" version="1.6.10">
|
||||
<artifact name="kotlin-reflect-1.6.10.jar">
|
||||
<sha256 value="3277ac102ae17aad10a55abec75ff5696c8d109790396434b496e75087854203" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-reflect-1.6.10.pom">
|
||||
<sha256 value="57905524274a00ae028aaccc27283f6bc5925a934a046c1cc5d06c8ee4d6d5a9" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-reflect" version="2.4.10">
|
||||
<artifact name="kotlin-reflect-2.4.10.jar">
|
||||
<sha256 value="25a1aef7454d46548ecaaf51021b0e52e38141a62ed75af124da109b7324c4e5" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-reflect-2.4.10.pom">
|
||||
<sha256 value="4258f0212f4bd72e3047f7daace38e0de2ebff3f7e923e836431fd8f5b19189d" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-sam-with-receiver" version="2.4.10">
|
||||
<artifact name="kotlin-sam-with-receiver-2.4.10-gradle813.jar">
|
||||
<sha256 value="a84421755b6d88994ea547921a0a548f62a5fa35062e1a4c8e71644ca08f36b8" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-sam-with-receiver-2.4.10.module">
|
||||
<sha256 value="1b23bbbdf7eb4c34e63482e04f54efc4b437add063ced3507da889b0af9c069f" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-sam-with-receiver-compiler-plugin-embeddable" version="2.4.10">
|
||||
<artifact name="kotlin-sam-with-receiver-compiler-plugin-embeddable-2.4.10.jar">
|
||||
<sha256 value="8f30cb3c9ca1127c0c196abf3eb9eee96415442d471c341327d5fc05ca2ad4c9" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-sam-with-receiver-compiler-plugin-embeddable-2.4.10.pom">
|
||||
<sha256 value="26785f2a3a79b173f50e8bac682001430cb6291074d49fc0af11adb18cbc70ed" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-script-runtime" version="2.4.0">
|
||||
<artifact name="kotlin-script-runtime-2.4.0.jar">
|
||||
<sha256 value="196e8ecbf63daf477e34e67c2f871ee232ae7bf8b377432d876d1bbf9d273de3" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-script-runtime-2.4.0.pom">
|
||||
<sha256 value="ce705c50e7e0afb22298acff0a983cdb6ea0f7fe2d1b473cee42b38405bc357f" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-script-runtime" version="2.4.10">
|
||||
<artifact name="kotlin-script-runtime-2.4.10.jar">
|
||||
<sha256 value="f4a5b30c2fdfbe386b097101b7989dbeea3743c06396136664784e08e15c6899" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-script-runtime-2.4.10.pom">
|
||||
<sha256 value="edcf0e2cd709646c4e5945be0f0a4920a0f3f417f328756746a29d92b23b1593" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-scripting-common" version="2.4.10">
|
||||
<artifact name="kotlin-scripting-common-2.4.10.jar">
|
||||
<sha256 value="d5399982cdbf5994f7f3a731afacfbc5c21b797d97ffd7328b62cea670103076" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-scripting-common-2.4.10.pom">
|
||||
<sha256 value="185636a91c18f09f8af87f87ea1788c2d55f72a6880210a0365a5a6a44d61833" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-scripting-compiler-embeddable" version="2.4.10">
|
||||
<artifact name="kotlin-scripting-compiler-embeddable-2.4.10.jar">
|
||||
<sha256 value="156c68ff816251c9d297c90d77e7e8e513eaad594277cee50a36faeddbe88935" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-scripting-compiler-embeddable-2.4.10.pom">
|
||||
<sha256 value="07d9913a83317c28ca7704be0c109a1429a276236e43be8b98f87dbd4d02afad" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-scripting-compiler-impl-embeddable" version="2.4.10">
|
||||
<artifact name="kotlin-scripting-compiler-impl-embeddable-2.4.10.jar">
|
||||
<sha256 value="1dcfc5495d8c74966fcbbd39240a9c0f8ab36bb4faad2ea5ffc000c5d7785171" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-scripting-compiler-impl-embeddable-2.4.10.pom">
|
||||
<sha256 value="a80b463dc4e3de57555c4e1b6e73658d40ac215b2788f4c193f56c91b3494ca9" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-scripting-jvm" version="2.4.10">
|
||||
<artifact name="kotlin-scripting-jvm-2.4.10.jar">
|
||||
<sha256 value="0b7518219da69b427e0b3f840f13e280db9e61a839c7d3ff094de4630ddbc9f5" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-scripting-jvm-2.4.10.pom">
|
||||
<sha256 value="403a12911dc71b4fa4c2e3dc305cd98e0ef3fea1fabce72d0a656dcf890b3775" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-stdlib" version="2.4.0">
|
||||
<artifact name="kotlin-stdlib-2.4.0.jar">
|
||||
<sha256 value="ccb14ff83fabcb11458b798dbc9824748ccdffeec79c9aba789e6ed1cda86b1c" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-stdlib-2.4.0.module">
|
||||
<sha256 value="c24a47dcbd9295d776f443be41d77ac245309601ed053711dee2b0254be02db6" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-stdlib" version="2.4.10">
|
||||
<artifact name="kotlin-stdlib-2.4.10.jar">
|
||||
<sha256 value="4ec0293bc3751423b203f1d8493251c57c42e73eb6377a6b8560d0974ff0a6df" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-stdlib-2.4.10.module">
|
||||
<sha256 value="1c04a98f1200c8705d015df08977211589eecbc87cf1c4c6d28a92682fe8446e" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-tooling-core" version="2.4.10">
|
||||
<artifact name="kotlin-tooling-core-2.4.10.jar">
|
||||
<sha256 value="59ea305372e3a2b7417764dcfecf645066a0d9b1792ab40afd15c1cc8535b58a" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-tooling-core-2.4.10.pom">
|
||||
<sha256 value="590248328a863d8f000ef063ac0ee8b4483f52d3e22fa51ca243ce7f6a78c75c" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-util-io" version="2.4.10">
|
||||
<artifact name="kotlin-util-io-2.4.10.jar">
|
||||
<sha256 value="06a9a0f89884c1c1a86baa96260238d927fb027077ba67bb5d2958af6fd776d7" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-util-io-2.4.10.pom">
|
||||
<sha256 value="3c9ca43ebff84366e7ff28742b7475553619c5f0f8acc2d7a979a6f4b437c81a" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-util-klib" version="2.4.10">
|
||||
<artifact name="kotlin-util-klib-2.4.10.jar">
|
||||
<sha256 value="408d3bd16e0f513ac2f4f04a78871701924836081c2cc774aa2b3f739278e430" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-util-klib-2.4.10.pom">
|
||||
<sha256 value="631dbfefce3aefea1de3573d8dc1e54919be9af88c142505d3352127d84abb84" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlin" name="kotlin-util-klib-metadata" version="2.4.10">
|
||||
<artifact name="kotlin-util-klib-metadata-2.4.10.jar">
|
||||
<sha256 value="f9b0cc33542c53d83004ab4aeff6f6515d509d26e14e78f420eeae2a459f4927" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlin-util-klib-metadata-2.4.10.pom">
|
||||
<sha256 value="606f70d8788a23f9b017039107d005248d0887481f0815e6284ba9a6933a7b7b" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlinx" name="kotlinx-coroutines-bom" version="1.8.0">
|
||||
<artifact name="kotlinx-coroutines-bom-1.8.0.pom">
|
||||
<sha256 value="1239e9dbe1397cd5971342956b2511bc3ace7b641842e4372a088dcfa8b9ad55" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jetbrains.kotlinx" name="kotlinx-coroutines-core-jvm" version="1.8.0">
|
||||
<artifact name="kotlinx-coroutines-core-jvm-1.8.0.jar">
|
||||
<sha256 value="9860906a1937490bf5f3b06d2f0e10ef451e65b95b269f22daf68a3d1f5065c5" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="kotlinx-coroutines-core-jvm-1.8.0.module">
|
||||
<sha256 value="ff6a22da40040938751db0ae21177e76517dbf126a76796f5426727bf76c1228" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.jspecify" name="jspecify" version="1.0.0">
|
||||
<artifact name="jspecify-1.0.0.jar">
|
||||
<sha256 value="1fad6e6be7557781e4d33729d49ae1cdc8fdda6fe477bb0cc68ce351eafdfbab" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="jspecify-1.0.0.module">
|
||||
<sha256 value="d307ca77a54e18ac1ef1aaed4e5bbe014bd2f49f29e1d2f813e47c278283195b" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.junit" name="junit-bom" version="5.13.1">
|
||||
<artifact name="junit-bom-5.13.1.module">
|
||||
<sha256 value="33c07ab9724790a6e5859ba07d69117ac530439724545a81c4179e3272c75de8" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="junit-bom-5.13.1.pom">
|
||||
<sha256 value="fa68451ea830572ed43ffe51d75b6a05f7a5e665a602a51f49d6be02063a65f3" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.junit" name="junit-bom" version="5.13.4">
|
||||
<artifact name="junit-bom-5.13.4.module">
|
||||
<sha256 value="e959288fde1b1b050d9bc082fc786789128da5d2853091468fca504104bdf400" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="junit-bom-5.13.4.pom">
|
||||
<sha256 value="d7a08a99b2502f0bb68cd4e1f984f0bf69324aaa208bd0f73366c03fc3548a42" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.junit" name="junit-bom" version="5.14.1">
|
||||
<artifact name="junit-bom-5.14.1.module">
|
||||
<sha256 value="278acb11ccc9998694224386f96fb4941a22edb42cb446c92e0f1f33014b6b48" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="junit-bom-5.14.1.pom">
|
||||
<sha256 value="01b01dfa366550b40ac5760548a7d728b6109d17c451e83864d1e5e0ce862c94" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.junit" name="junit-bom" version="5.14.2">
|
||||
<artifact name="junit-bom-5.14.2.module">
|
||||
<sha256 value="5d26f4440392326dd2483cf490143eea1495d5095459a0b9651a7b1b38e24ebf" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="junit-bom-5.14.2.pom">
|
||||
<sha256 value="ed2dcc7855bd460bccc93a1bf0c962e63b566ff7d8f1ded0f1f2593ba8183aaf" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.junit" name="junit-bom" version="6.1.3">
|
||||
<artifact name="junit-bom-6.1.3.module">
|
||||
<sha256 value="9f5d57dadcfa07f7b38efcfb22b052ece188922a1df76b5a98e44a1df7a7701b" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="junit-bom-6.1.3.pom">
|
||||
<sha256 value="a9000043610a3e90c852e779a6b1a8eb724a9f312cf5f7ddd57862b010c65dc8" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.junit.jupiter" name="junit-jupiter" version="6.1.3">
|
||||
<artifact name="junit-jupiter-6.1.3.jar">
|
||||
<sha256 value="6b0a14075c74221de53047e363860b7d19fce802bebc152df2c35c4089c6c379" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="junit-jupiter-6.1.3.module">
|
||||
<sha256 value="ca7b7dd4508d57a9dc105102aa93fb5bc960b2095601534b9311f951ffb39979" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.junit.jupiter" name="junit-jupiter-api" version="6.1.3">
|
||||
<artifact name="junit-jupiter-api-6.1.3.jar">
|
||||
<sha256 value="555d6cf20fa1710884dd01b86cc5785397ba73e21ada2d4b784f5f1a14dcafc4" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="junit-jupiter-api-6.1.3.module">
|
||||
<sha256 value="ad9909c1fa88a579b2821a091a196c45a84bcd0f4fc7357990fdc73d3801c8a5" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.junit.jupiter" name="junit-jupiter-engine" version="6.1.3">
|
||||
<artifact name="junit-jupiter-engine-6.1.3.jar">
|
||||
<sha256 value="414559e78bbfa3bdb2eab009ac3ab1e22369ac31117c270a0bd666da115c5c6c" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="junit-jupiter-engine-6.1.3.module">
|
||||
<sha256 value="626a29f286c36d0f6f36409644371e12a3fe2bfcbb881e13f8265ac9de96bb77" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.junit.jupiter" name="junit-jupiter-params" version="6.1.3">
|
||||
<artifact name="junit-jupiter-params-6.1.3.jar">
|
||||
<sha256 value="05c51cedba2c06a9770707391e006cee825876937dea580b94a265ce145d4939" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="junit-jupiter-params-6.1.3.module">
|
||||
<sha256 value="9ec7795f4aeb92578fb4d43b6a73c324fff216ca971f3910335073882c78a167" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.junit.platform" name="junit-platform-commons" version="6.1.3">
|
||||
<artifact name="junit-platform-commons-6.1.3.jar">
|
||||
<sha256 value="a4774ae923c109544034aeae7c762cf017fbcdd1342403ba90e0921984b608c3" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="junit-platform-commons-6.1.3.module">
|
||||
<sha256 value="a6f1218616341b599f6aa029a3768c6f956ab1d3216ed7250e4be5d79adfce7d" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.junit.platform" name="junit-platform-engine" version="6.1.3">
|
||||
<artifact name="junit-platform-engine-6.1.3.jar">
|
||||
<sha256 value="21ad7ad3a35beda16387979317be1833a72a71d812f9a66ee4b9a7bafb56334c" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="junit-platform-engine-6.1.3.module">
|
||||
<sha256 value="70f5020adb4c91575025499a804b266e8fc2d027aa6e78febfa372be3a88cef5" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.junit.platform" name="junit-platform-launcher" version="6.1.3">
|
||||
<artifact name="junit-platform-launcher-6.1.3.jar">
|
||||
<sha256 value="1dec64b1fc0b7c47a11302aa5b4d37d8160c041b396e27067709ce775601a7b6" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="junit-platform-launcher-6.1.3.module">
|
||||
<sha256 value="62d2198a3a779c54316bbe839e51623b3a6bd111e672d586dd9a3bbb222569e6" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.mockito" name="mockito-bom" version="4.11.0">
|
||||
<artifact name="mockito-bom-4.11.0.pom">
|
||||
<sha256 value="d8531a746c988f7f68ed5f188cdea945006aea993ec5df9e524e0d27d61491da" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.mockito" name="mockito-bom" version="5.20.0">
|
||||
<artifact name="mockito-bom-5.20.0.pom">
|
||||
<sha256 value="626bc0f79f389d2c41543d16d8d9db0b53ad0848cc37a6e0b4ce771a4fe0bc49" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.opentest4j" name="opentest4j" version="1.3.0">
|
||||
<artifact name="opentest4j-1.3.0.jar">
|
||||
<sha256 value="48e2df636cab6563ced64dcdff8abb2355627cb236ef0bf37598682ddf742f1b" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="opentest4j-1.3.0.module">
|
||||
<sha256 value="48bf1d6c8b5dc94f74652bd17900f654deb714350248cf5e8fca27b9090c8e0d" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.ow2" name="ow2" version="1.5.1">
|
||||
<artifact name="ow2-1.5.1.pom">
|
||||
<sha256 value="321ddbb7ee6fe4f53dea6b4cd6db74154d6bfa42391c1f763b361b9f485acf05" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.ow2.asm" name="asm" version="9.10.1">
|
||||
<artifact name="asm-9.10.1.jar">
|
||||
<sha256 value="ed825d10ab1399c8c0cb669e688cf0c8c82629b4c8399b58352b68e92ca10fcb" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="asm-9.10.1.pom">
|
||||
<sha256 value="e1b1c3832ca3ac0a9e563c405f4c760118b5556a4920daee14058886197e094d" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.ow2.asm" name="asm-analysis" version="9.10.1">
|
||||
<artifact name="asm-analysis-9.10.1.jar">
|
||||
<sha256 value="dede75a21306b65974ecd8f87114ff6970f09fb794157a4ca09ab25c888c2bfc" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="asm-analysis-9.10.1.pom">
|
||||
<sha256 value="534fbb85f643c2330691e92652ec40dd497b4f279ef13d829d85858905d33ba3" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.ow2.asm" name="asm-commons" version="9.10.1">
|
||||
<artifact name="asm-commons-9.10.1.jar">
|
||||
<sha256 value="6d0abefb7cbf972ea16edb37ec14835372505063a45f976ab7ea889ed9497895" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="asm-commons-9.10.1.pom">
|
||||
<sha256 value="ceb2c43f3a273db88af8652d89ed6312f3e91a1a1e0ffc6f7823169278cf795c" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.ow2.asm" name="asm-tree" version="9.10.1">
|
||||
<artifact name="asm-tree-9.10.1.jar">
|
||||
<sha256 value="3dfb0d5b6a106cd40b5b250e39935fbf2f927f4477546a5369a3ac609cf0506b" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="asm-tree-9.10.1.pom">
|
||||
<sha256 value="963eebdea6e2e1ff25c9068b64a238e1585c99f8acd455595ac159a7f52b6c41" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.ow2.asm" name="asm-util" version="9.10.1">
|
||||
<artifact name="asm-util-9.10.1.jar">
|
||||
<sha256 value="1bb99d091fba2597dc6d51193e9bbcf0d8447e7ed96bd8f0198b18152f09655c" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="asm-util-9.10.1.pom">
|
||||
<sha256 value="fcea2bad7868ed18949a2e71c40cf26de1516d16440e63f585c3e05d285c0d2b" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.springframework" name="spring-framework-bom" version="5.3.39">
|
||||
<artifact name="spring-framework-bom-5.3.39.module">
|
||||
<sha256 value="f88b40e2a50333b40b42f181eee272b75ec75dd8666cb145bd90b15b97e183e3" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="spring-framework-bom-5.3.39.pom">
|
||||
<sha256 value="f6d481093e75767cba1ac7e1db38f8f692cbe3e38744693371a75aeb21c6148b" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.vafer" name="jdependency" version="2.16">
|
||||
<artifact name="jdependency-2.16.jar">
|
||||
<sha256 value="86981d2f50ab15eebe1a90f843a195f28f0bd1ee52255d76a73ec0b4b7ec79cd" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="jdependency-2.16.pom">
|
||||
<sha256 value="fa35299b0d0c47313d70364a75d20b9ac3a887443c632c7ecf50ba7df8871be5" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.xerial" name="sqlite-jdbc" version="3.48.0.0">
|
||||
<artifact name="sqlite-jdbc-3.48.0.0.jar">
|
||||
<sha256 value="dbe24ab138e9654c918f561299e47cb6a3baf1a946eda97871f6f3abd4eca395" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
<artifact name="sqlite-jdbc-3.48.0.0.pom">
|
||||
<sha256 value="edd6eb33447eeaaf21dac7d4bd879dc9874c868bb023183a140489fd473c0108" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
</components>
|
||||
</verification-metadata>
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionSha256Sum=bafd5ce9cfaea0fbccfdc8439a1ac42fbd4cd9c89dc9a988228d8a2639a58e6c
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.0-bin.zip
|
||||
networkTimeout=10000
|
||||
|
||||
@@ -174,7 +174,7 @@ public final class ModCheck
|
||||
if (descriptor == null) return new Result(null, null, problems);
|
||||
|
||||
ModCheck.checkDefaultConfig(arguments.jar(), problems);
|
||||
ModCheck.checkEntrypoint(arguments.jar(), descriptor, problems);
|
||||
ModCheck.checkEntrypoint(arguments, descriptor, problems);
|
||||
|
||||
List<ModDiscovery.Candidate> candidates = new ArrayList<>();
|
||||
|
||||
@@ -283,9 +283,14 @@ public final class ModCheck
|
||||
}
|
||||
}
|
||||
|
||||
/** The entry point and its superclasses inside the jar must lead to {@code Mod}. */
|
||||
private static void checkEntrypoint(Path jar, ModDescriptor descriptor, List<String> problems)
|
||||
/**
|
||||
* The entry point must be in the jar, and its superclasses must lead to {@code Mod}. As in the
|
||||
* server's class loader, superclasses come from the jar, its libraries, and then its
|
||||
* dependencies.
|
||||
*/
|
||||
private static void checkEntrypoint(Arguments arguments, ModDescriptor descriptor, List<String> problems)
|
||||
{
|
||||
Path jar = arguments.jar();
|
||||
String entrypoint = descriptor.entrypoint();
|
||||
ClassNode type = ModCheck.classNode(jar, entrypoint.replace('.', '/'), problems);
|
||||
|
||||
@@ -300,6 +305,11 @@ public final class ModCheck
|
||||
boolean constructor = type.methods.stream().anyMatch(ModCheck::isPublicNoArgConstructor);
|
||||
if (!constructor || (type.access & Opcodes.ACC_PUBLIC) == 0) problems.add("The entry point '" + entrypoint + "' needs to be public, with a public constructor without parameters.");
|
||||
|
||||
List<Path> visible = new ArrayList<>();
|
||||
visible.add(jar);
|
||||
visible.addAll(arguments.libraries());
|
||||
visible.addAll(arguments.dependencies());
|
||||
|
||||
ClassNode current = type;
|
||||
|
||||
for (int depth = 0; depth < 32; depth++)
|
||||
@@ -309,7 +319,13 @@ public final class ModCheck
|
||||
if (ModCheck.MOD_CLASS.equals(superName)) return;
|
||||
if (superName == null) break;
|
||||
|
||||
ClassNode parent = ModCheck.classNode(jar, superName, problems);
|
||||
ClassNode parent = ModCheck.classNode(visible, superName, problems);
|
||||
|
||||
if (parent == null && !ModCheck.isJdkClass(superName)) {
|
||||
problems.add("The entry point '" + entrypoint + "' extends '" + superName.replace('/', '.') + "', which is not in '" + jar.getFileName() + "', its libraries, or its dependencies.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (parent == null) break;
|
||||
|
||||
current = parent;
|
||||
@@ -344,6 +360,21 @@ public final class ModCheck
|
||||
}
|
||||
}
|
||||
|
||||
/** Whether {@code internalName} is a JDK class; none of them leads to {@code Mod}. */
|
||||
private static boolean isJdkClass(String internalName) { return ClassLoader.getPlatformClassLoader().getResource(internalName + ".class") != null; }
|
||||
|
||||
/** The class from the first of {@code jars} that contains it. */
|
||||
private static @Nullable ClassNode classNode(List<Path> jars, String internalName, List<String> problems)
|
||||
{
|
||||
for (Path jar : jars)
|
||||
{
|
||||
ClassNode node = ModCheck.classNode(jar, internalName, problems);
|
||||
if (node != null) return node;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static @Nullable ClassNode classNode(Path jar, String internalName, List<String> problems)
|
||||
{
|
||||
byte[] bytes = ModCheck.bytes(jar, internalName + ".class", problems);
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
package dev.overlord.zomboidforge.tools;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarOutputStream;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
|
||||
import static org.objectweb.asm.Opcodes.ALOAD;
|
||||
import static org.objectweb.asm.Opcodes.INVOKESPECIAL;
|
||||
import static org.objectweb.asm.Opcodes.RETURN;
|
||||
import static org.objectweb.asm.Opcodes.V25;
|
||||
|
||||
class ModCheckTest
|
||||
{
|
||||
private static final String MOD = "dev/overlord/zomboidforge/api/Mod";
|
||||
private static final String TOML = """
|
||||
id = "shop"
|
||||
version = "1.0.0"
|
||||
entrypoint = "a.Main"
|
||||
api = "0.3"
|
||||
""";
|
||||
|
||||
@TempDir
|
||||
Path directory;
|
||||
|
||||
@Test
|
||||
void findsEntryPointSuperclassesInLibraries() throws IOException
|
||||
{
|
||||
Path mod = this.jar("shop.jar", ModCheckTest.TOML, Map.of("a/Main", ModCheckTest.type("a/Main", "b/Base")));
|
||||
Path library = this.jar("base.jar", null, Map.of("b/Base", ModCheckTest.type("b/Base", ModCheckTest.MOD)));
|
||||
|
||||
ModCheck.Result result = ModCheck.check(new ModCheck.Arguments(mod, null, List.of(library), List.of(), null));
|
||||
|
||||
assertEquals(List.of(), result.problems());
|
||||
}
|
||||
|
||||
@Test
|
||||
void reportsSuperclassesThatAreNowhere() throws IOException
|
||||
{
|
||||
Path mod = this.jar("shop.jar", ModCheckTest.TOML, Map.of("a/Main", ModCheckTest.type("a/Main", "b/Base")));
|
||||
|
||||
ModCheck.Result result = ModCheck.check(new ModCheck.Arguments(mod, null, List.of(), List.of(), null));
|
||||
|
||||
assertEquals(List.of("The entry point 'a.Main' extends 'b.Base', which is not in 'shop.jar', its libraries, or its dependencies."), result.problems());
|
||||
}
|
||||
|
||||
@Test
|
||||
void reportsEntryPointsThatDoNotExtendMod() throws IOException
|
||||
{
|
||||
Path mod = this.jar("shop.jar", ModCheckTest.TOML, Map.of("a/Main", ModCheckTest.type("a/Main", "java/lang/Thread")));
|
||||
|
||||
ModCheck.Result result = ModCheck.check(new ModCheck.Arguments(mod, null, List.of(), List.of(), null));
|
||||
|
||||
assertEquals(List.of("The entry point 'a.Main' does not extend 'dev.overlord.zomboidforge.api.Mod'."), result.problems());
|
||||
}
|
||||
|
||||
/** A public class extending {@code superName} with a public constructor without parameters. */
|
||||
private static byte[] type(String name, String superName)
|
||||
{
|
||||
ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
|
||||
writer.visit(V25, ACC_PUBLIC, name, null, superName, null);
|
||||
|
||||
MethodVisitor init = writer.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
|
||||
init.visitVarInsn(ALOAD, 0);
|
||||
init.visitMethodInsn(INVOKESPECIAL, superName, "<init>", "()V", false);
|
||||
init.visitInsn(RETURN);
|
||||
init.visitMaxs(0, 0);
|
||||
|
||||
writer.visitEnd();
|
||||
return writer.toByteArray();
|
||||
}
|
||||
|
||||
/** A jar with {@code mod.toml} (unless {@code null}) and {@code classes} (internal name to bytes). */
|
||||
private Path jar(String name, @Nullable String toml, Map<String, byte[]> classes) throws IOException
|
||||
{
|
||||
Path jar = this.directory.resolve(name);
|
||||
|
||||
try (OutputStream file = Files.newOutputStream(jar); JarOutputStream out = new JarOutputStream(file))
|
||||
{
|
||||
if (toml != null) {
|
||||
out.putNextEntry(new JarEntry("META-INF/zomboidforge/mod.toml"));
|
||||
out.write(toml.getBytes(StandardCharsets.UTF_8));
|
||||
out.closeEntry();
|
||||
}
|
||||
|
||||
for (Map.Entry<String, byte[]> entry : classes.entrySet()) {
|
||||
out.putNextEntry(new JarEntry(entry.getKey() + ".class"));
|
||||
out.write(entry.getValue());
|
||||
out.closeEntry();
|
||||
}
|
||||
}
|
||||
|
||||
return jar;
|
||||
}
|
||||
}
|
||||
@@ -60,3 +60,17 @@ tasks.register<JavaExec>("patchServerJar") {
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
// Used by ci/release.sh (Dockerfile stage game-version) to name the image before the full build.
|
||||
tasks.register<JavaExec>("printGameVersion") {
|
||||
description = "Prints the game version of the server jar (pz.jar)."
|
||||
group = "help"
|
||||
|
||||
val serverJar = projectZomboid.serverJar
|
||||
|
||||
classpath = sourceSets.main.get().runtimeClasspath
|
||||
mainClass = "dev.overlord.zomboidforge.patcher.GameVersionReader"
|
||||
argumentProviders.add(CommandLineArgumentProvider {
|
||||
listOf(serverJar.get().asFile.absolutePath)
|
||||
})
|
||||
}
|
||||
@@ -13,6 +13,8 @@ import org.objectweb.asm.tree.IntInsnNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -32,6 +34,18 @@ public final class GameVersionReader
|
||||
|
||||
private GameVersionReader() {}
|
||||
|
||||
/** Usage: {@code GameVersionReader <server.jar>}. Prints the jar's game version, e.g. {@code 42.21.0}. */
|
||||
static void main(String[] args) throws IOException
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
System.err.println("Usage: GameVersionReader <server.jar>");
|
||||
System.exit(2);
|
||||
}
|
||||
|
||||
System.out.println(JarPatcher.readGameVersion(Path.of(args[0])));
|
||||
}
|
||||
|
||||
public static GameVersion read(byte[] coreClass)
|
||||
{
|
||||
ClassNode core = new ClassNode();
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
package dev.overlord.zomboidforge.patcher;
|
||||
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.LocalVariableNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import org.objectweb.asm.tree.VarInsnNode;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* A value of the patched method that a {@link Hook} receives as an argument. The hook's
|
||||
* parameters are the types of its arguments, in order.
|
||||
*/
|
||||
public sealed interface HookArgument
|
||||
{
|
||||
/**
|
||||
* The local variable slot that holds the value at the instruction {@code at} of
|
||||
* {@code method}. Fails with an {@link IllegalStateException} when the value does not
|
||||
* exist there.
|
||||
*/
|
||||
Slot resolve(ClassNode node, MethodNode method, AbstractInsnNode at);
|
||||
|
||||
/** A local variable slot and the type of the value in it. */
|
||||
record Slot(int index, Type type)
|
||||
{
|
||||
/** The instruction that pushes the value onto the operand stack. */
|
||||
public VarInsnNode load() { return new VarInsnNode(this.type.getOpcode(Opcodes.ILOAD), this.index); }
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameter {@code index} of the patched method, counted from 0 in the order of its
|
||||
* descriptor; {@code this} of an instance method is not counted.
|
||||
*/
|
||||
record Parameter(int index) implements HookArgument
|
||||
{
|
||||
public Parameter
|
||||
{
|
||||
if (index < 0) throw new IllegalArgumentException("Not a parameter index: " + index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Slot resolve(ClassNode node, MethodNode method, AbstractInsnNode at)
|
||||
{
|
||||
Type[] types = Type.getArgumentTypes(method.desc);
|
||||
|
||||
if (this.index >= types.length) throw new IllegalStateException("'" + node.name + "." + method.name + method.desc + "' has no parameter " + this.index + ".");
|
||||
|
||||
int slot = (method.access & Opcodes.ACC_STATIC) != 0 ? 0 : 1;
|
||||
for (int i = 0; i < this.index; i++) slot += types[i].getSize();
|
||||
|
||||
return new Slot(slot, types[this.index]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() { return "parameter " + this.index; }
|
||||
}
|
||||
|
||||
/**
|
||||
* The local variable {@code name} of the patched method, from its local variable table.
|
||||
* Exactly one variable of that name has to be in scope at the anchor.
|
||||
*/
|
||||
record Local(String name) implements HookArgument
|
||||
{
|
||||
public Local
|
||||
{
|
||||
Objects.requireNonNull(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Slot resolve(ClassNode node, MethodNode method, AbstractInsnNode at)
|
||||
{
|
||||
List<LocalVariableNode> variables = Objects.requireNonNullElse(method.localVariables, List.<LocalVariableNode>of());
|
||||
int position = method.instructions.indexOf(at);
|
||||
|
||||
List<LocalVariableNode> matches = variables.stream()
|
||||
.filter(variable -> variable.name.equals(this.name))
|
||||
.filter(variable -> method.instructions.indexOf(variable.start) <= position && position < method.instructions.indexOf(variable.end))
|
||||
.toList();
|
||||
|
||||
if (matches.size() != 1) {
|
||||
throw new IllegalStateException(
|
||||
"Expected exactly one local variable '" + this.name + "' in scope at the anchor in '"
|
||||
+ node.name + "." + method.name + method.desc + "', found " + matches.size()
|
||||
);
|
||||
}
|
||||
|
||||
LocalVariableNode variable = matches.getFirst();
|
||||
|
||||
return new Slot(variable.index, Type.getType(variable.desc));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() { return "local '" + this.name + "'"; }
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
@@ -161,7 +162,7 @@ public final class JarPatcher
|
||||
{
|
||||
ZipEntry entry = entries.nextElement();
|
||||
List<ClassPatch> patches = patchesByEntry.get(entry.getName());
|
||||
byte[] bytes = jar.getInputStream(entry).readAllBytes();
|
||||
byte[] bytes = JarPatcher.read(jar, entry);
|
||||
|
||||
if (patches != null) {
|
||||
bytes = transform(jar, bytes, patches);
|
||||
@@ -205,10 +206,7 @@ public final class JarPatcher
|
||||
ClassNode node = new ClassNode();
|
||||
new ClassReader(bytes).accept(node, 0);
|
||||
|
||||
for (ClassPatch patch : patches) {
|
||||
JarPatcher.verifyAnchor(patch, node);
|
||||
patch.apply(node);
|
||||
}
|
||||
for (ClassPatch patch : patches) JarPatcher.apply(patch, node);
|
||||
|
||||
HierarchyClassWriter writer = new HierarchyClassWriter(name -> JarPatcher.read(jar, name + ".class"));
|
||||
node.accept(writer);
|
||||
@@ -216,9 +214,14 @@ public final class JarPatcher
|
||||
return writer.toByteArray();
|
||||
}
|
||||
|
||||
private static void verifyAnchor(ClassPatch patch, ClassNode node)
|
||||
/** Verifies the anchor of {@code patch}, then applies it; failures name the patch. */
|
||||
private static void apply(ClassPatch patch, ClassNode node)
|
||||
{
|
||||
try { patch.anchor().verify(node); }
|
||||
try
|
||||
{
|
||||
patch.anchor().verify(node);
|
||||
patch.apply(node);
|
||||
}
|
||||
catch (IllegalStateException e) { throw new IllegalStateException("'" + patch.getClass().getSimpleName() + "': " + e.getMessage(), e); }
|
||||
}
|
||||
|
||||
@@ -227,7 +230,12 @@ public final class JarPatcher
|
||||
ZipEntry entry = jar.getEntry(entryName);
|
||||
if (entry == null) return null;
|
||||
|
||||
try { return jar.getInputStream(entry).readAllBytes(); }
|
||||
try { return JarPatcher.read(jar, entry); }
|
||||
catch (IOException e) { throw new UncheckedIOException(e); }
|
||||
}
|
||||
|
||||
private static byte[] read(ZipFile jar, ZipEntry entry) throws IOException
|
||||
{
|
||||
try (InputStream in = jar.getInputStream(entry)) { return in.readAllBytes(); }
|
||||
}
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
package dev.overlord.zomboidforge.patcher.Patches;
|
||||
|
||||
import dev.overlord.zomboidforge.patcher.Anchor;
|
||||
import dev.overlord.zomboidforge.patcher.ClassPatch;
|
||||
import dev.overlord.zomboidforge.patcher.Hook;
|
||||
import dev.overlord.zomboidforge.patcher.HookArgument;
|
||||
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.InsnList;
|
||||
import org.objectweb.asm.tree.InsnNode;
|
||||
import org.objectweb.asm.tree.JumpInsnNode;
|
||||
import org.objectweb.asm.tree.LabelNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Makes a call in the target class depend on a {@link Hook}: the hook runs directly before the
|
||||
* call and returns {@code true} to skip it.
|
||||
*
|
||||
* <pre>{@code
|
||||
* if (!Hooks.hook(arguments)) Owner.call(...);
|
||||
* }</pre>
|
||||
*
|
||||
* The receiver and the arguments of the call are evaluated before the hook runs; a skipped call
|
||||
* pops them. The call returns {@code void}, so a skipped call leaves no value missing. The hook
|
||||
* receives the {@link HookArgument}s, which are read from local variable slots.
|
||||
*/
|
||||
public abstract class CancellableHookPatch implements ClassPatch
|
||||
{
|
||||
private final String target;
|
||||
private final Anchor.Call anchor;
|
||||
private final Hook hook;
|
||||
private final List<HookArgument> arguments;
|
||||
|
||||
/** A hook with one parameter per element of {@code arguments}, in order, returning {@code boolean}. */
|
||||
protected CancellableHookPatch(String target, Anchor.Call anchor, Hook hook, List<HookArgument> arguments)
|
||||
{
|
||||
if (!Type.getReturnType(anchor.desc()).equals(Type.VOID_TYPE))
|
||||
throw new IllegalArgumentException("Anchor call '" + anchor.owner() + "." + anchor.name() + anchor.desc() + "' must return 'V'.");
|
||||
|
||||
if (anchor.name().equals("<init>"))
|
||||
throw new IllegalArgumentException("Anchor call '" + anchor.owner() + "." + anchor.name() + anchor.desc() + "' is a constructor, which cannot be skipped.");
|
||||
|
||||
HookCall.checkShape(hook, arguments, Type.BOOLEAN_TYPE);
|
||||
|
||||
this.target = Objects.requireNonNull(target);
|
||||
this.anchor = anchor;
|
||||
this.hook = hook;
|
||||
this.arguments = List.copyOf(arguments);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String target() { return this.target; }
|
||||
@Override
|
||||
public final Anchor.Call anchor() { return this.anchor; }
|
||||
@Override
|
||||
public final Hook hook() { return this.hook; }
|
||||
|
||||
@Override
|
||||
public final void apply(ClassNode node)
|
||||
{
|
||||
MethodNode method = this.anchor.in().resolve(node);
|
||||
MethodInsnNode call = this.anchor.resolve(node);
|
||||
InsnList code = HookCall.invoke(this.hook, this.arguments, Type.BOOLEAN_TYPE, node, method, call);
|
||||
LabelNode run = new LabelNode();
|
||||
LabelNode end = new LabelNode();
|
||||
|
||||
code.add(new JumpInsnNode(Opcodes.IFEQ, run));
|
||||
code.add(CancellableHookPatch.discardOperands(call));
|
||||
code.add(new JumpInsnNode(Opcodes.GOTO, end));
|
||||
code.add(run);
|
||||
|
||||
method.instructions.insertBefore(call, code);
|
||||
method.instructions.insert(call, end);
|
||||
}
|
||||
|
||||
/** Pops the arguments of {@code call}, last first, then its receiver. */
|
||||
private static InsnList discardOperands(MethodInsnNode call)
|
||||
{
|
||||
InsnList code = new InsnList();
|
||||
Type[] arguments = Type.getArgumentTypes(call.desc);
|
||||
|
||||
for (int i = arguments.length - 1; i >= 0; i--) code.add(new InsnNode(arguments[i].getSize() == 2 ? Opcodes.POP2 : Opcodes.POP));
|
||||
if (call.getOpcode() != Opcodes.INVOKESTATIC) code.add(new InsnNode(Opcodes.POP));
|
||||
|
||||
return code;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package dev.overlord.zomboidforge.patcher.Patches;
|
||||
|
||||
import dev.overlord.zomboidforge.patcher.Hook;
|
||||
import dev.overlord.zomboidforge.patcher.HookArgument;
|
||||
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.InsnList;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** The call of a {@link Hook} with its {@link HookArgument}s, shared by the hook patch types. */
|
||||
final class HookCall
|
||||
{
|
||||
private HookCall() {}
|
||||
|
||||
/**
|
||||
* Fails unless {@code hook} returns {@code returnType} and takes {@code arguments} parameters.
|
||||
* The parameter types are checked by {@link #invoke}, once the arguments are resolved.
|
||||
*/
|
||||
static void checkShape(Hook hook, List<HookArgument> arguments, Type returnType)
|
||||
{
|
||||
Type actualReturn = Type.getReturnType(hook.desc());
|
||||
Type[] parameters = Type.getArgumentTypes(hook.desc());
|
||||
|
||||
if (!actualReturn.equals(returnType))
|
||||
throw new IllegalArgumentException("Hook '" + hook + "' must return '" + returnType.getDescriptor() + "'.");
|
||||
|
||||
if (parameters.length != arguments.size())
|
||||
throw new IllegalArgumentException("Hook '" + hook + "' must take " + arguments.size() + " parameter(s), one per argument " + arguments + ".");
|
||||
}
|
||||
|
||||
/**
|
||||
* Instructions that push {@code arguments} and call {@code hook}, for insertion directly
|
||||
* before or after {@code at} in {@code method}. Fails when the hook's descriptor does not
|
||||
* match the types of the arguments.
|
||||
*/
|
||||
static InsnList invoke(Hook hook, List<HookArgument> arguments, Type returnType, ClassNode node, MethodNode method, AbstractInsnNode at)
|
||||
{
|
||||
InsnList code = new InsnList();
|
||||
Type[] types = new Type[arguments.size()];
|
||||
|
||||
for (int i = 0; i < arguments.size(); i++)
|
||||
{
|
||||
HookArgument.Slot slot = arguments.get(i).resolve(node, method, at);
|
||||
|
||||
types[i] = slot.type();
|
||||
code.add(slot.load());
|
||||
}
|
||||
|
||||
String expected = Type.getMethodDescriptor(returnType, types);
|
||||
if (!hook.desc().equals(expected))
|
||||
throw new IllegalStateException("Hook '" + hook + "' must have descriptor '" + expected + "' for the arguments " + arguments + ".");
|
||||
|
||||
code.add(new MethodInsnNode(Opcodes.INVOKESTATIC, hook.owner(), hook.name(), hook.desc(), false));
|
||||
|
||||
return code;
|
||||
}
|
||||
}
|
||||
+17
-18
@@ -3,34 +3,40 @@ package dev.overlord.zomboidforge.patcher.Patches;
|
||||
import dev.overlord.zomboidforge.patcher.Anchor;
|
||||
import dev.overlord.zomboidforge.patcher.ClassPatch;
|
||||
import dev.overlord.zomboidforge.patcher.Hook;
|
||||
import dev.overlord.zomboidforge.patcher.HookArgument;
|
||||
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Inserts a call to a {@link Hook} directly after a call in the target class. The hook takes
|
||||
* no arguments and returns nothing, so the operand stack and the stack map frames of the
|
||||
* patched method stay unchanged.
|
||||
* Inserts a call to a {@link Hook} directly after a call in the target class. The hook returns
|
||||
* nothing and receives the {@link HookArgument}s, which are read from local variable slots, so
|
||||
* the operand stack after the inserted code is the same as before it.
|
||||
*/
|
||||
public abstract class HookInjectionPatch implements ClassPatch
|
||||
{
|
||||
private static final String HOOK_DESC = "()V";
|
||||
|
||||
private final String target;
|
||||
private final Anchor.Call anchor;
|
||||
private final Hook hook;
|
||||
private final List<HookArgument> arguments;
|
||||
|
||||
protected HookInjectionPatch(String target, Anchor.Call anchor, Hook hook)
|
||||
/** A hook without arguments, {@code ()V}. */
|
||||
protected HookInjectionPatch(String target, Anchor.Call anchor, Hook hook) { this(target, anchor, hook, List.of()); }
|
||||
|
||||
/** A hook with one parameter per element of {@code arguments}, in order, returning {@code void}. */
|
||||
protected HookInjectionPatch(String target, Anchor.Call anchor, Hook hook, List<HookArgument> arguments)
|
||||
{
|
||||
if (!hook.desc().equals(HookInjectionPatch.HOOK_DESC))
|
||||
throw new IllegalArgumentException("Hook '" + hook + "' must have descriptor '" + HookInjectionPatch.HOOK_DESC + "'.");
|
||||
HookCall.checkShape(hook, arguments, Type.VOID_TYPE);
|
||||
|
||||
this.target = Objects.requireNonNull(target);
|
||||
this.anchor = Objects.requireNonNull(anchor);
|
||||
this.hook = hook;
|
||||
this.arguments = List.copyOf(arguments);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -43,16 +49,9 @@ public abstract class HookInjectionPatch implements ClassPatch
|
||||
@Override
|
||||
public final void apply(ClassNode node)
|
||||
{
|
||||
MethodNode method = this.anchor.in().resolve(node);
|
||||
MethodInsnNode call = this.anchor.resolve(node);
|
||||
|
||||
this.anchor.in().resolve(node).instructions.insert(
|
||||
call, new MethodInsnNode(
|
||||
Opcodes.INVOKESTATIC,
|
||||
this.hook.owner(),
|
||||
this.hook.name(),
|
||||
this.hook.desc(),
|
||||
false
|
||||
)
|
||||
);
|
||||
method.instructions.insert(call, HookCall.invoke(this.hook, this.arguments, Type.VOID_TYPE, node, method, call));
|
||||
}
|
||||
}
|
||||
+196
@@ -0,0 +1,196 @@
|
||||
package dev.overlord.zomboidforge.patcher;
|
||||
|
||||
import dev.overlord.zomboidforge.patcher.Patches.CancellableHookPatch;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Type;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
|
||||
import static org.objectweb.asm.Opcodes.ACC_STATIC;
|
||||
import static org.objectweb.asm.Opcodes.ALOAD;
|
||||
import static org.objectweb.asm.Opcodes.INVOKESTATIC;
|
||||
import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL;
|
||||
import static org.objectweb.asm.Opcodes.LLOAD;
|
||||
import static org.objectweb.asm.Opcodes.RETURN;
|
||||
import static org.objectweb.asm.Opcodes.V25;
|
||||
|
||||
class CancellableHookPatchTest
|
||||
{
|
||||
private static final String CALLS = Type.getInternalName(CancellableHookPatchTest.Calls.class);
|
||||
private static final String CALLS_DESC = Type.getDescriptor(CancellableHookPatchTest.Calls.class);
|
||||
|
||||
@TempDir
|
||||
Path dir;
|
||||
|
||||
/** Stands in for the anchor calls and the hooks, and records the calls. */
|
||||
public static final class Calls
|
||||
{
|
||||
public static final List<String> LOG = new ArrayList<>();
|
||||
|
||||
/** What the hooks return. */
|
||||
public static boolean cancel;
|
||||
|
||||
public static void staticCall(long number, String text) { Calls.LOG.add("call " + number + " " + text); }
|
||||
|
||||
public void virtualCall(String text) { Calls.LOG.add("virtual " + text); }
|
||||
|
||||
public static void after() { Calls.LOG.add("after"); }
|
||||
|
||||
public static boolean staticHook(String text, long number)
|
||||
{
|
||||
Calls.LOG.add("hook " + text + " " + number);
|
||||
|
||||
return Calls.cancel;
|
||||
}
|
||||
|
||||
public static boolean virtualHook(String text)
|
||||
{
|
||||
Calls.LOG.add("virtual hook " + text);
|
||||
|
||||
return Calls.cancel;
|
||||
}
|
||||
}
|
||||
|
||||
/** Skips {@code Calls.staticCall(number, text)} in {@code runStatic}; the hook gets {@code text} and {@code number}. */
|
||||
private static final class StaticCallPatch extends CancellableHookPatch
|
||||
{
|
||||
StaticCallPatch() {
|
||||
super(
|
||||
"t/Target",
|
||||
new Anchor.Call(new Anchor.Method("runStatic", "(JLjava/lang/String;)V"), CancellableHookPatchTest.CALLS, "staticCall", "(JLjava/lang/String;)V"),
|
||||
new Hook(CancellableHookPatchTest.CALLS, "staticHook", "(Ljava/lang/String;J)Z"),
|
||||
List.of(new HookArgument.Parameter(1), new HookArgument.Parameter(0))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/** Skips {@code calls.virtualCall(text)} in {@code runVirtual}; the hook gets {@code text}. */
|
||||
private static final class VirtualCallPatch extends CancellableHookPatch
|
||||
{
|
||||
VirtualCallPatch() {
|
||||
super(
|
||||
"t/Target",
|
||||
new Anchor.Call(new Anchor.Method("runVirtual", "(" + CancellableHookPatchTest.CALLS_DESC + "Ljava/lang/String;)V"), CancellableHookPatchTest.CALLS, "virtualCall", "(Ljava/lang/String;)V"),
|
||||
new Hook(CancellableHookPatchTest.CALLS, "virtualHook", "(Ljava/lang/String;)Z"),
|
||||
List.of(new HookArgument.Parameter(1))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@code static runStatic(long number, String text)}: {@code Calls.staticCall(number, text); Calls.after();}
|
||||
* and {@code static runVirtual(Calls calls, String text)}: {@code calls.virtualCall(text); Calls.after();}.
|
||||
*/
|
||||
private static byte[] target()
|
||||
{
|
||||
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
|
||||
cw.visit(V25, ACC_PUBLIC, "t/Target", null, "java/lang/Object", null);
|
||||
|
||||
MethodVisitor runStatic = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "runStatic", "(JLjava/lang/String;)V", null, null);
|
||||
runStatic.visitVarInsn(LLOAD, 0);
|
||||
runStatic.visitVarInsn(ALOAD, 2);
|
||||
runStatic.visitMethodInsn(INVOKESTATIC, CancellableHookPatchTest.CALLS, "staticCall", "(JLjava/lang/String;)V", false);
|
||||
runStatic.visitMethodInsn(INVOKESTATIC, CancellableHookPatchTest.CALLS, "after", "()V", false);
|
||||
runStatic.visitInsn(RETURN);
|
||||
runStatic.visitMaxs(0, 0);
|
||||
|
||||
MethodVisitor runVirtual = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "runVirtual", "(" + CancellableHookPatchTest.CALLS_DESC + "Ljava/lang/String;)V", null, null);
|
||||
runVirtual.visitVarInsn(ALOAD, 0);
|
||||
runVirtual.visitVarInsn(ALOAD, 1);
|
||||
runVirtual.visitMethodInsn(INVOKEVIRTUAL, CancellableHookPatchTest.CALLS, "virtualCall", "(Ljava/lang/String;)V", false);
|
||||
runVirtual.visitMethodInsn(INVOKESTATIC, CancellableHookPatchTest.CALLS, "after", "()V", false);
|
||||
runVirtual.visitInsn(RETURN);
|
||||
runVirtual.visitMaxs(0, 0);
|
||||
|
||||
cw.visitEnd();
|
||||
return cw.toByteArray();
|
||||
}
|
||||
|
||||
/** Patches {@link #target()} with both patches and runs {@code runStatic(7, "a")} and {@code runVirtual(new Calls(), "b")}. */
|
||||
private List<String> runPatched(boolean cancel) throws Exception
|
||||
{
|
||||
Path in = this.dir.resolve("in.jar");
|
||||
Path out = this.dir.resolve("patched.jar");
|
||||
|
||||
try (ZipOutputStream zip = new ZipOutputStream(Files.newOutputStream(in)))
|
||||
{
|
||||
zip.putNextEntry(new ZipEntry("t/Target.class"));
|
||||
zip.write(CancellableHookPatchTest.target());
|
||||
zip.closeEntry();
|
||||
}
|
||||
|
||||
assertEquals(1, new JarPatcher(List.of(new StaticCallPatch(), new VirtualCallPatch())).patch(in, out));
|
||||
|
||||
CancellableHookPatchTest.Calls.cancel = cancel;
|
||||
|
||||
try (URLClassLoader loader = new URLClassLoader(new URL[]{out.toUri().toURL()}, CancellableHookPatchTest.class.getClassLoader()))
|
||||
{
|
||||
Class<?> target = loader.loadClass("t.Target");
|
||||
|
||||
target.getMethod("runStatic", long.class, String.class).invoke(null, 7L, "a");
|
||||
target.getMethod("runVirtual", CancellableHookPatchTest.Calls.class, String.class).invoke(null, new CancellableHookPatchTest.Calls(), "b");
|
||||
}
|
||||
|
||||
return CancellableHookPatchTest.Calls.LOG;
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
void clearLog() { CancellableHookPatchTest.Calls.LOG.clear(); }
|
||||
|
||||
@Test
|
||||
void runsTheCallWhenTheHookReturnsFalse() throws Exception
|
||||
{
|
||||
assertEquals(
|
||||
List.of("hook a 7", "call 7 a", "after", "virtual hook b", "virtual b", "after"),
|
||||
this.runPatched(false)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void skipsTheCallWhenTheHookReturnsTrue() throws Exception
|
||||
{
|
||||
assertEquals(
|
||||
List.of("hook a 7", "after", "virtual hook b", "after"),
|
||||
this.runPatched(true)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void rejectsAnchorCallThatReturnsAValue()
|
||||
{
|
||||
Anchor.Call anchor = new Anchor.Call(new Anchor.Method("run", "()V"), "t/Dep", "value", "()I");
|
||||
|
||||
assertThrows(IllegalArgumentException.class, () -> new CancellableHookPatch("t/Target", anchor, new Hook("t/Hooks", "hook", "()Z"), List.of()) {});
|
||||
}
|
||||
|
||||
@Test
|
||||
void rejectsConstructorAnchor()
|
||||
{
|
||||
Anchor.Call anchor = new Anchor.Call(new Anchor.Method("run", "()V"), "t/Dep", "<init>", "()V");
|
||||
|
||||
assertThrows(IllegalArgumentException.class, () -> new CancellableHookPatch("t/Target", anchor, new Hook("t/Hooks", "hook", "()Z"), List.of()) {});
|
||||
}
|
||||
|
||||
@Test
|
||||
void rejectsHookThatDoesNotReturnBoolean()
|
||||
{
|
||||
Anchor.Call anchor = new Anchor.Call(new Anchor.Method("run", "()V"), "t/Dep", "call", "()V");
|
||||
|
||||
assertThrows(IllegalArgumentException.class, () -> new CancellableHookPatch("t/Target", anchor, new Hook("t/Hooks", "hook", "()V"), List.of()) {});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package dev.overlord.zomboidforge.patcher;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.InsnNode;
|
||||
import org.objectweb.asm.tree.LabelNode;
|
||||
import org.objectweb.asm.tree.LocalVariableNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
|
||||
import static org.objectweb.asm.Opcodes.ACC_STATIC;
|
||||
import static org.objectweb.asm.Opcodes.ALOAD;
|
||||
import static org.objectweb.asm.Opcodes.ASM9;
|
||||
import static org.objectweb.asm.Opcodes.LLOAD;
|
||||
import static org.objectweb.asm.Opcodes.NOP;
|
||||
import static org.objectweb.asm.Opcodes.RETURN;
|
||||
|
||||
class HookArgumentTest
|
||||
{
|
||||
private static final String STRING = "Ljava/lang/String;";
|
||||
|
||||
private static ClassNode target()
|
||||
{
|
||||
ClassNode node = new ClassNode();
|
||||
node.name = "t/Target";
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
@Test
|
||||
void parameterSlotsSkipThisAndCountWideTypesTwice()
|
||||
{
|
||||
MethodNode staticMethod = new MethodNode(ASM9, ACC_PUBLIC | ACC_STATIC, "run", "(JLjava/lang/String;)V", null, null);
|
||||
MethodNode instanceMethod = new MethodNode(ASM9, ACC_PUBLIC, "run", "(JLjava/lang/String;)V", null, null);
|
||||
ClassNode node = HookArgumentTest.target();
|
||||
|
||||
assertEquals(new HookArgument.Slot(0, Type.LONG_TYPE), new HookArgument.Parameter(0).resolve(node, staticMethod, new InsnNode(RETURN)));
|
||||
assertEquals(new HookArgument.Slot(2, Type.getType(HookArgumentTest.STRING)), new HookArgument.Parameter(1).resolve(node, staticMethod, new InsnNode(RETURN)));
|
||||
assertEquals(new HookArgument.Slot(3, Type.getType(HookArgumentTest.STRING)), new HookArgument.Parameter(1).resolve(node, instanceMethod, new InsnNode(RETURN)));
|
||||
}
|
||||
|
||||
@Test
|
||||
void slotLoadsWithTheOpcodeOfItsType()
|
||||
{
|
||||
assertEquals(LLOAD, new HookArgument.Slot(0, Type.LONG_TYPE).load().getOpcode());
|
||||
assertEquals(ALOAD, new HookArgument.Slot(2, Type.getType(HookArgumentTest.STRING)).load().getOpcode());
|
||||
}
|
||||
|
||||
@Test
|
||||
void reportsMissingParameter()
|
||||
{
|
||||
MethodNode method = new MethodNode(ASM9, ACC_STATIC, "run", "(I)V", null, null);
|
||||
|
||||
IllegalStateException e = assertThrows(
|
||||
IllegalStateException.class,
|
||||
() -> new HookArgument.Parameter(1).resolve(HookArgumentTest.target(), method, new InsnNode(RETURN))
|
||||
);
|
||||
|
||||
assertEquals("'t/Target.run(I)V' has no parameter 1.", e.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void rejectsNegativeParameterIndex()
|
||||
{
|
||||
assertThrows(IllegalArgumentException.class, () -> new HookArgument.Parameter(-1));
|
||||
}
|
||||
|
||||
/** {@code run()}: {@code nop} (before), label, {@code nop} (inside), label, {@code return}; {@code name} is in scope only inside. */
|
||||
@Test
|
||||
void localResolvesOnlyWhereItIsInScope()
|
||||
{
|
||||
MethodNode method = new MethodNode(ASM9, ACC_STATIC, "run", "()V", null, null);
|
||||
InsnNode before = new InsnNode(NOP);
|
||||
InsnNode inside = new InsnNode(NOP);
|
||||
LabelNode start = new LabelNode();
|
||||
LabelNode end = new LabelNode();
|
||||
|
||||
method.instructions.add(before);
|
||||
method.instructions.add(start);
|
||||
method.instructions.add(inside);
|
||||
method.instructions.add(end);
|
||||
method.instructions.add(new InsnNode(RETURN));
|
||||
method.localVariables.add(new LocalVariableNode("name", HookArgumentTest.STRING, null, start, end, 4));
|
||||
|
||||
HookArgument.Local name = new HookArgument.Local("name");
|
||||
|
||||
assertEquals(new HookArgument.Slot(4, Type.getType(HookArgumentTest.STRING)), name.resolve(HookArgumentTest.target(), method, inside));
|
||||
|
||||
IllegalStateException e = assertThrows(IllegalStateException.class, () -> name.resolve(HookArgumentTest.target(), method, before));
|
||||
assertEquals("Expected exactly one local variable 'name' in scope at the anchor in 't/Target.run()V', found 0", e.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void localRejectsTwoVariablesOfTheSameNameInScope()
|
||||
{
|
||||
MethodNode method = new MethodNode(ASM9, ACC_STATIC, "run", "()V", null, null);
|
||||
InsnNode inside = new InsnNode(NOP);
|
||||
LabelNode start = new LabelNode();
|
||||
LabelNode end = new LabelNode();
|
||||
|
||||
method.instructions.add(start);
|
||||
method.instructions.add(inside);
|
||||
method.instructions.add(end);
|
||||
method.localVariables.add(new LocalVariableNode("name", HookArgumentTest.STRING, null, start, end, 0));
|
||||
method.localVariables.add(new LocalVariableNode("name", "I", null, start, end, 1));
|
||||
|
||||
IllegalStateException e = assertThrows(
|
||||
IllegalStateException.class,
|
||||
() -> new HookArgument.Local("name").resolve(HookArgumentTest.target(), method, inside)
|
||||
);
|
||||
|
||||
assertEquals("Expected exactly one local variable 'name' in scope at the anchor in 't/Target.run()V', found 2", e.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -2,15 +2,19 @@ package dev.overlord.zomboidforge.patcher;
|
||||
|
||||
import dev.overlord.zomboidforge.patcher.Patches.HookInjectionPatch;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Label;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Type;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.zip.ZipEntry;
|
||||
@@ -20,6 +24,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
|
||||
import static org.objectweb.asm.Opcodes.ACC_STATIC;
|
||||
import static org.objectweb.asm.Opcodes.ASTORE;
|
||||
import static org.objectweb.asm.Opcodes.DUP;
|
||||
import static org.objectweb.asm.Opcodes.GETSTATIC;
|
||||
import static org.objectweb.asm.Opcodes.INVOKESPECIAL;
|
||||
@@ -171,4 +176,105 @@ class HookInjectionPatchTest
|
||||
"t/Target", HookInjectionPatchTest.ANCHOR, new Hook("t/Hooks", "hook", "(I)V")
|
||||
) {});
|
||||
}
|
||||
|
||||
@Test
|
||||
void rejectsHookThatReturnsAValue()
|
||||
{
|
||||
assertThrows(IllegalArgumentException.class, () -> new HookInjectionPatch(
|
||||
"t/Target", HookInjectionPatchTest.ANCHOR, new Hook("t/Hooks", "hook", "()Z")
|
||||
) {});
|
||||
}
|
||||
|
||||
// Hooks with arguments
|
||||
|
||||
private static final String CALLS = Type.getInternalName(HookInjectionPatchTest.Calls.class);
|
||||
|
||||
private static final Anchor.Call ARGUMENTS_ANCHOR = new Anchor.Call(
|
||||
new Anchor.Method("run", "(JLjava/lang/String;)V"), HookInjectionPatchTest.CALLS, "anchor", "()V"
|
||||
);
|
||||
|
||||
private static final List<HookArgument> ARGUMENTS = List.of(
|
||||
new HookArgument.Parameter(1),
|
||||
new HookArgument.Parameter(0),
|
||||
new HookArgument.Local("word")
|
||||
);
|
||||
|
||||
/** Stands in for the anchor call and the hook of {@link ArgumentPatch} and records the calls. */
|
||||
public static final class Calls
|
||||
{
|
||||
public static final List<String> LOG = new ArrayList<>();
|
||||
|
||||
private Calls() {}
|
||||
|
||||
public static void anchor() { Calls.LOG.add("anchor"); }
|
||||
|
||||
public static void hook(String text, long number, String word) { Calls.LOG.add("hook " + text + " " + number + " " + word); }
|
||||
}
|
||||
|
||||
private static final class ArgumentPatch extends HookInjectionPatch
|
||||
{
|
||||
ArgumentPatch(String hookDesc) {
|
||||
super("t/Target", HookInjectionPatchTest.ARGUMENTS_ANCHOR, new Hook(HookInjectionPatchTest.CALLS, "hook", hookDesc), HookInjectionPatchTest.ARGUMENTS);
|
||||
}
|
||||
}
|
||||
|
||||
/** {@code static run(long number, String text)}: {@code String word = "local"; Calls.anchor();}. */
|
||||
private static byte[] argumentsTarget()
|
||||
{
|
||||
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
|
||||
cw.visit(V25, ACC_PUBLIC, "t/Target", null, "java/lang/Object", null);
|
||||
|
||||
Label start = new Label();
|
||||
Label end = new Label();
|
||||
|
||||
MethodVisitor run = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "run", "(JLjava/lang/String;)V", null, null);
|
||||
run.visitLdcInsn("local");
|
||||
run.visitVarInsn(ASTORE, 3);
|
||||
run.visitLabel(start);
|
||||
run.visitMethodInsn(INVOKESTATIC, HookInjectionPatchTest.CALLS, "anchor", "()V", false);
|
||||
run.visitInsn(RETURN);
|
||||
run.visitLabel(end);
|
||||
run.visitLocalVariable("word", "Ljava/lang/String;", null, start, end, 3);
|
||||
run.visitMaxs(0, 0);
|
||||
|
||||
cw.visitEnd();
|
||||
return cw.toByteArray();
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
void clearLog() { HookInjectionPatchTest.Calls.LOG.clear(); }
|
||||
|
||||
@Test
|
||||
void passesParametersAndLocalsToHook() throws Exception
|
||||
{
|
||||
Path in = this.jar(Map.of("t/Target.class", HookInjectionPatchTest.argumentsTarget()));
|
||||
Path out = this.dir.resolve("patched.jar");
|
||||
|
||||
new JarPatcher(List.of(new ArgumentPatch("(Ljava/lang/String;JLjava/lang/String;)V"))).patch(in, out);
|
||||
|
||||
try (URLClassLoader loader = new URLClassLoader(new URL[]{out.toUri().toURL()}, HookInjectionPatchTest.class.getClassLoader()))
|
||||
{
|
||||
loader.loadClass("t.Target").getMethod("run", long.class, String.class).invoke(null, 7L, "text");
|
||||
}
|
||||
|
||||
assertEquals(List.of("anchor", "hook text 7 local"), HookInjectionPatchTest.Calls.LOG);
|
||||
}
|
||||
|
||||
@Test
|
||||
void reportsHookWhoseParametersDoNotMatchTheArguments() throws Exception
|
||||
{
|
||||
Path in = this.jar(Map.of("t/Target.class", HookInjectionPatchTest.argumentsTarget()));
|
||||
ArgumentPatch patch = new ArgumentPatch("(Ljava/lang/String;ILjava/lang/String;)V");
|
||||
|
||||
IllegalStateException e = assertThrows(
|
||||
IllegalStateException.class,
|
||||
() -> new JarPatcher(List.of(patch)).patch(in, this.dir.resolve("out.jar"))
|
||||
);
|
||||
|
||||
assertEquals(
|
||||
"'ArgumentPatch': Hook '" + patch.hook() + "' must have descriptor '(Ljava/lang/String;JLjava/lang/String;)V'"
|
||||
+ " for the arguments [parameter 1, parameter 0, local 'word'].",
|
||||
e.getMessage()
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user