Files
SirRoboGarage/tools/robocode_shim/compile_drussgt.sh
SirStone fe8b1eddff Add curated legacy Robocode roster (28 bots) and Tank Royale booter
Curated roster: 34 classic-Robocode archives were downloaded, measured in real
Tank Royale battles and curated to 28 usable bots, now in legacy_bots/<Name>/
(<Name>.jar + <Name>.json + <Name>.sh) with checksums in MANIFEST.sha256.
Six were dropped as NOT_USEFUL and deleted from tr_bots/_salvage/legacy_bots/
and tr_bots/_salvage/tr_wrappers/, with the rationale recorded in
legacy_bots/README.md and tools/robocode_shim/LEGACY_BOTS.md:

  - Nene, Seraphim  - Azuma-framework melee bots, completely inert (0 scans,
                      0 shots); getRobotRunnable() returns null so the shim has
                      no driver path for them.
  - Aurora          - fires 6 shots and crawls.
  - FloodMini, LightningBug, Aristocles - near-stationary turrets: they scan and
                      fire but land 0 hits and take 10+ hits every round.

DrussGT is the reference bot and is deliberately NOT in legacy_bots/: it lives in
tr_bots/DrussGT and is now vendored with its sources under
tools/robocode_shim/vendor/drussgt/.

Repo-relative paths replace /tmp: every <Name>.sh resolves the shim and the
vendor jars via $REPO (../..), and none hardcodes a server URL, a /tmp data
path, or anything under ~/Downloads. SERVER_URL/SERVER_SECRET come from the
environment, which the booter populates from its own -Dserver.url /
-Dsystem.secret system properties.

Booter: tools/booter/robocode-tankroyale-booter-0.35.5-all.jar, copied from a
local tank-royale build, plus a README covering the real CLI. Note the command
is `boot`; the upstream README's `run` is stale. Verified it discovers all 28
kept bots via both `dir` and `info`.

Licensing: every third-party jar here reads "not stated in jar", and DrussGT is
GPL. The repo owner has explicitly waived this - the repository is PRIVATE and
lives on their own LAN. Do not mirror or redistribute without revisiting that.

.gitignore flipped back to tracking legacy_bots/**/*.jar; an over-broad *.jar
rule already cost us the only copy of DrussGT.jar once.
2026-10-04 22:18:28 +02:00

39 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# ACCEPTANCE TEST: compile the REAL, unmodified DrussGT sources against the
# genuine Robocode 1.9.5.5 API (Approach B reuses robocode.jar instead of
# re-implementing robocode.*).
#
# ROBOCODE_JAR=... DRUSSGT_SRC=... DRUSSGT_JAR=... ./compile_drussgt.sh
#
# Why two source files are excluded:
# GFRange.java and Indice.java are *decompilation artefacts*. The same two
# classes are ALSO declared inline at the bottom of DrussGunDC.java, so a
# single javac invocation over all 22 files fails with
# "duplicate class: jk.mega.dGun.GFRange/Indice" even with no shim at all.
# The original DrussGT.jar already ships GFRange.class/Indice.class, so we
# drop the redundant standalone files and let the jar supply them (together
# with the 6 genuinely-unsourced classes: JKDCUtils, NormalDistribution,
# StoreScan, DCRobotState, DCWave, Scan).
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# All inputs are vendored inside the repo (tools/robocode_shim/vendor/) so a
# rebuild never depends on /tmp. Override any of the three to point elsewhere.
ROBOCODE_JAR="${ROBOCODE_JAR:-$HERE/vendor/robocode.jar}"
DRUSSGT_SRC="${DRUSSGT_SRC:-$HERE/vendor/drussgt/src}"
DRUSSGT_JAR="${DRUSSGT_JAR:-$HERE/vendor/drussgt/DrussGT.jar}"
OUT="${OUT:-$HERE/out/drussgt}"
for f in "$ROBOCODE_JAR" "$DRUSSGT_JAR"; do
[[ -f "$f" ]] || { echo "missing: $f" >&2; exit 1; }
done
[[ -d "$DRUSSGT_SRC" ]] || { echo "missing source dir: $DRUSSGT_SRC" >&2; exit 1; }
mkdir -p "$OUT"
mapfile -t SRC < <(find "$DRUSSGT_SRC" -name '*.java' ! -name 'GFRange.java' ! -name 'Indice.java' | sort)
echo "javac -nowarn -cp \"$ROBOCODE_JAR:$DRUSSGT_JAR\" -d \"$OUT\" <${#SRC[@]} files>"
javac -nowarn -cp "$ROBOCODE_JAR:$DRUSSGT_JAR" -d "$OUT" "${SRC[@]}"
echo "OK: ${#SRC[@]}/22 source files compiled, $(find "$OUT" -name '*.class' | wc -l) classes emitted"
echo "(2/22 excluded as duplicate-class decompilation artefacts; supplied by DrussGT.jar)"