Development setup #
The exact sequence used to build and test SDS on this machine. It is operational: run the steps in order, in the directories named.
Prerequisites #
- Docker 29.8.2 — builds the match image and runs the bridge's JDK in a container. There is no host JDK, by design.
- Rust and Cargo 1.99.1 — the bot, and the
helmsibling repository. - Python 3.13.15 — the match harness.
prek— installs the repository hooks (uv tool install prek).
The helm repository is a sibling checkout; these steps assume
/data/dev/helm. It reads a MegaMek release, which is never vendored here.
1. MegaMek 0.51.0 #
In the helm checkout:
./scripts/fetch-megamek.sh 0.51.0
This checks the tarball against the digest pinned in the script and unpacks it
to ~/.cache/helm/megamek/0.51.0, printing the path. The same release and
digest are what a match container pins.
Point the build cache at it:
mkdir -p ~/.cache/mul-build
ln -sfn ~/.cache/helm/megamek/0.51.0 ~/.cache/mul-build/megamek
MM_HOME defaults to ~/.cache/mul-build/megamek, and the bridge, the harness
and the setup checks all use it.
2. The helm database #
Still in /data/dev/helm:
cargo build --release -j 2
./bridge/dump.sh ~/.cache/mul-build/megamek /tmp/helm-bridge
./target/release/helm build \
--megamek ~/.cache/mul-build/megamek \
--megamek-version 0.51.0 \
--bridge-dir /tmp/helm-bridge \
--out ~/.cache/mul-build/helm.sqlite
The unit files alone are not enough: battle value and the equipment catalogue
are computed when MegaMek loads and come out through bridge/dump.sh. The
Python tests need the resulting helm.sqlite; they read
~/.cache/mul-build/helm.sqlite by default, or HELM_DB if set.
3. Build the match runner #
In this checkout:
./scripts/build.sh
That builds the Docker image, compiles the Java bridge against MM_HOME into
bridge/build/sds.jar, and builds target/release/sds-bot in release mode.
The image is tagged from the Dockerfile's content and is not rebuilt when the
tag already exists; set SDS_REBUILD=1 to force it.
4. Tests #
cargo test -j 2 --workspace -- --test-threads 2
python3 -m unittest discover -s tests -t .
-j 2 bounds compilation and --test-threads 2 bounds the test run; a
full-parallel run has taken this machine down. The harness suite is 727 tests
and needs the helm.sqlite from step 2.
5. Smoke test #
./sds.sh one
Runs one Princess-vs-Princess match headless. ./sds.sh play opens the real
MegaMek client instead, and ./sds.sh view runs/<run-dir> shows what the bot
thought.
Hooks #
In the checkout:
prek install
The hooks run cargo fmt, cargo clippy and the Rust and Python suites on
changes that touch them. A commit-msg hook stamps the Change-Id trailer a
stacked pull request is matched by.
Caches and licensing #
Everything above writes under ~/.cache; no cache, database, match output or
MegaMek install is repository content. MegaMek's data is CC BY-NC-SA 4.0 and
is not redistributed by this repository.