Files
PixelPics/tools/edgecase-plugin/build.sh
T

20 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Builds the edge-case test plugin (PPTest.jar) against the compiled PixelPics classes.
# Usage: ./gradlew compileJava && tools/edgecase-plugin/build.sh [compile-classpath] [out.jar]
# classpath default: ./gradlew -q printCompileClasspath; JAVAC must be a JDK >= 25 (default: javac).
# Drop the jar into the TEST server's plugins/ (never production), start the server and run `pptest all`
# (or `pptest <scene>...`) in its console; renders land in plugins/PPTest/<scene>.png.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
API="${1:-$(cd "$ROOT" && ./gradlew -q printCompileClasspath)}"
OUT="${2:-$ROOT/build/PPTest.jar}"
JAVAC="${JAVAC:-javac}"
TMP="$(mktemp -d)"
trap 'rm -rf "$TMP"' EXIT
"$JAVAC" -nowarn -d "$TMP" -cp "$ROOT/build/classes/java/main:$API" "$ROOT/tools/edgecase-plugin/pptest/PPTest.java"
cp "$ROOT/tools/edgecase-plugin/plugin.yml" "$TMP/"
mkdir -p "$(dirname "$OUT")"
rm -f "$OUT" # zip would update an existing jar and keep stale classes
(cd "$TMP" && zip -q -r "$OUT" .)
echo "Wrote $OUT"