#!/usr/bin/env bash
# Generate a Tank Royale bot directory that boots the DrussGT bridge.
#
# tools/robocode_shim/make_botdir.sh [TARGET_DIR]
#
# The generated directory contains only text files (
.json + .sh); the
# third-party jars stay outside the repo and are referenced by absolute path.
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TARGET="${1:-/tmp/tr_bots/DrussGT}"
NAME="$(basename "$TARGET")"
ROBOCODE_JAR="${ROBOCODE_JAR:-/tmp/robocode/install/libs/robocode.jar}"
TR_BOT_API_JAR="${TR_BOT_API_JAR:-$HOME/Downloads/sample-bots-java-1.0.2/lib/robocode-tankroyale-bot-api-1.0.2.jar}"
OUT="${OUT:-$HERE/out}"
mkdir -p "$TARGET"
cat > "$TARGET/$NAME.json" < "$TARGET/$NAME.sh" <