#!/usr/bin/env bash # Compile arena's own Java - MatchHost, MatchWatcher, TextRenderer - into a jar. # # MM_HOME extracted MegaMek release, for the compile classpath # OUT_JAR where to write arena.jar # JAVA_HOME a JDK # # Compiled against the *stock* MegaMek jar on purpose. Nothing in src/ may depend # on anything the patchset adds: the patches are MegaMek bugs we intend to # upstream, and if our own code needed them we would have turned a temporary # carry into a permanent fork. It is also the constraint the eventual ATProto # adapter has to live under - public API only. set -euo pipefail HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" : "${MM_HOME:?MM_HOME is required}" : "${OUT_JAR:?OUT_JAR is required}" : "${JAVA_HOME:?JAVA_HOME is required}" CLASSES="${CLASSES:-/tmp/arena-classes}" [ -f "$MM_HOME/MegaMek.jar" ] || { echo "ERROR: no MegaMek.jar under $MM_HOME" >&2; exit 1; } CP="$MM_HOME/MegaMek.jar" for jar in "$MM_HOME"/lib/*.jar; do CP="$CP:$jar"; done rm -rf "$CLASSES" mkdir -p "$CLASSES" "$JAVA_HOME/bin/javac" -nowarn -Xlint:-options -classpath "$CP" -d "$CLASSES" "$HERE"/arena/*.java "$JAVA_HOME/bin/jar" --create --file "$OUT_JAR" -C "$CLASSES" arena echo "built -> $OUT_JAR"