feat(@projects/@magic-civilization): add local batch gdextension rebuild logic

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-05-03 04:18:17 -04:00
parent 2e2846a2ef
commit c0512c1fb5

View file

@ -140,6 +140,19 @@ echo "Parallel: $PARALLEL concurrent seed(s)"
echo "Safety timeout: ${SAFETY_TIMEOUT}s per game"
echo "============================================================"
# p1-45: Rebuild GDExtension before every local batch so the .so is never stale.
# Remote mode delegates to run_ap3.sh on the remote host, which is expected to
# have a fresh build already (or the caller ran build-gdext.sh manually).
# Uses a timestamped CARGO_TARGET_DIR to avoid collisions on multi-tenant hosts.
if [ -z "$AUTOPLAY_HOST" ]; then
echo "--- p1-45: rebuilding GDExtension before batch (CARGO_TARGET_DIR isolation) ---"
MC_BUILD_STAMP="$(date +%s)"
export CARGO_TARGET_DIR="/tmp/mc-build-${MC_BUILD_STAMP}/target"
(cd "$PROJECT_DIR/src/simulator" && bash build-gdext.sh)
unset CARGO_TARGET_DIR
echo "--- GDExtension rebuild complete ---"
fi
# Start the MCTS service (idempotent — no-op if already running).
# Runs only for local batches; remote batches rely on the remote host's
# run-services.sh invocation (or service already running on apricot).