2022-02-25 08:54:16 +11:00
|
|
|
export CARGO_TARGET_DIR := env_var_or_default('CARGO_TARGET_DIR', justfile_directory() + "/target")
|
2022-04-25 02:07:43 +10:00
|
|
|
CLIPPY_ARGUMENTS := "-Dwarnings -Dclippy::all -Aclippy::empty-loop"
|
2022-02-25 08:54:16 +11:00
|
|
|
|
2022-02-25 08:35:02 +11:00
|
|
|
build: build-roms
|
2022-02-25 08:29:33 +11:00
|
|
|
|
2022-04-24 02:10:17 +10:00
|
|
|
build-debug:
|
2022-04-24 02:24:55 +10:00
|
|
|
just _build-debug agb
|
2023-07-24 05:36:54 +10:00
|
|
|
just _build-debug tracker/agb-tracker
|
2022-04-24 02:10:17 +10:00
|
|
|
build-release:
|
2022-04-24 02:24:55 +10:00
|
|
|
just _build-release agb
|
2023-07-24 05:36:54 +10:00
|
|
|
just _build-release tracker/agb-tracker
|
2022-04-24 02:10:17 +10:00
|
|
|
clippy:
|
|
|
|
just _all-crates _clippy
|
2022-08-05 07:23:49 +10:00
|
|
|
just _clippy tools
|
2022-04-24 02:10:17 +10:00
|
|
|
|
2022-02-25 08:54:16 +11:00
|
|
|
test:
|
2022-04-24 02:10:17 +10:00
|
|
|
just _test-debug agb
|
2023-10-18 09:49:57 +11:00
|
|
|
just _test-multiboot
|
2022-04-24 02:10:17 +10:00
|
|
|
just _test-debug agb-fixnum
|
2023-04-24 03:48:16 +10:00
|
|
|
just _test-debug agb-hashmap
|
2023-07-23 09:31:12 +10:00
|
|
|
just _test-debug tracker/agb-tracker
|
2022-08-02 02:36:12 +10:00
|
|
|
just _test-debug-arm agb
|
2022-08-05 07:23:49 +10:00
|
|
|
just _test-debug tools
|
2023-08-06 04:15:06 +10:00
|
|
|
just _test-debug emulator
|
2022-04-24 02:10:17 +10:00
|
|
|
|
|
|
|
test-release:
|
|
|
|
just _test-release agb
|
2023-06-07 08:00:17 +10:00
|
|
|
just _test-release agb-fixnum
|
2023-07-24 05:36:54 +10:00
|
|
|
just _test-release tracker/agb-tracker
|
2022-08-02 02:36:12 +10:00
|
|
|
just _test-release-arm agb
|
2022-02-25 08:54:16 +11:00
|
|
|
|
2022-07-12 23:37:17 +10:00
|
|
|
doctest-agb:
|
|
|
|
(cd agb && cargo test --doc -Z doctest-xcompile)
|
|
|
|
|
2022-10-13 03:29:20 +11:00
|
|
|
check-docs:
|
2023-07-24 04:52:11 +10:00
|
|
|
(cd agb && cargo doc --target=thumbv4t-none-eabi --no-deps)
|
|
|
|
(cd tracker/agb-tracker && cargo doc --target=thumbv4t-none-eabi --no-deps)
|
2022-10-13 03:29:20 +11:00
|
|
|
just _build_docs agb-fixnum
|
2023-04-24 03:37:22 +10:00
|
|
|
just _build_docs agb-hashmap
|
2022-10-13 03:29:20 +11:00
|
|
|
|
|
|
|
_build_docs crate:
|
2022-12-10 08:18:15 +11:00
|
|
|
(cd "{{crate}}" && cargo doc --no-deps)
|
2022-10-13 03:29:20 +11:00
|
|
|
|
2022-02-25 08:54:16 +11:00
|
|
|
clean:
|
|
|
|
just _all-crates _clean
|
|
|
|
|
2023-03-24 08:43:19 +11:00
|
|
|
fmt:
|
|
|
|
just _all-crates _fmt
|
|
|
|
just _fmt tools
|
|
|
|
fmt-check:
|
|
|
|
just _all-crates _fmt-check
|
|
|
|
just _fmt-check tools
|
|
|
|
|
2022-02-25 09:07:28 +11:00
|
|
|
run-example example:
|
|
|
|
just _build-example "{{example}}"
|
|
|
|
mgba-qt "$CARGO_TARGET_DIR/thumbv4t-none-eabi/debug/examples/{{example}}"
|
|
|
|
|
2022-02-25 09:08:36 +11:00
|
|
|
run-example-release example:
|
|
|
|
just _build-example-release "{{example}}"
|
|
|
|
mgba-qt "$CARGO_TARGET_DIR/thumbv4t-none-eabi/release/examples/{{example}}"
|
|
|
|
|
2022-02-25 09:19:25 +11:00
|
|
|
run-game game:
|
|
|
|
(cd "examples/{{game}}" && cargo run --release)
|
|
|
|
|
|
|
|
run-game-debug game:
|
|
|
|
(cd "examples/{{game}}" && cargo run)
|
|
|
|
|
2023-10-18 22:09:01 +11:00
|
|
|
ci: build-debug clippy fmt-check test miri build-release test-release doctest-agb test-games build-roms build-book check-docs
|
2022-02-25 08:29:33 +11:00
|
|
|
|
2022-02-25 08:35:02 +11:00
|
|
|
build-roms:
|
2022-02-25 08:29:33 +11:00
|
|
|
just _build-rom "examples/the-purple-night" "PURPLENIGHT"
|
|
|
|
just _build-rom "examples/the-hat-chooses-the-wizard" "HATWIZARD"
|
2022-07-25 06:35:28 +10:00
|
|
|
just _build-rom "examples/hyperspace-roll" "HYPERSPACE"
|
2023-07-26 05:27:03 +10:00
|
|
|
just _build-rom "examples/the-dungeon-puzzlers-lament" "DUNGLAMENT"
|
2023-04-26 10:37:37 +10:00
|
|
|
just _build-rom "examples/amplitude" "AMPLITUDE"
|
|
|
|
just _build-rom "examples/combo" "AGBGAMES"
|
2022-02-25 08:29:33 +11:00
|
|
|
|
|
|
|
just _build-rom "book/games/pong" "PONG"
|
|
|
|
|
|
|
|
(cd examples/target && zip examples.zip examples/*.gba)
|
|
|
|
|
2022-02-25 08:36:18 +11:00
|
|
|
build-book:
|
|
|
|
(cd book && mdbook build)
|
|
|
|
|
2023-08-07 06:04:58 +10:00
|
|
|
update-lockfiles *args:
|
|
|
|
bash .github/scripts/update-lockfiles.sh {{args}}
|
2022-02-25 08:37:22 +11:00
|
|
|
|
2023-04-13 00:12:00 +10:00
|
|
|
publish *args: (_run-tool "publish" args)
|
2022-08-05 06:30:52 +10:00
|
|
|
|
2022-10-03 03:55:05 +11:00
|
|
|
release +args: (_run-tool "release" args)
|
|
|
|
|
2023-04-24 02:46:00 +10:00
|
|
|
miri:
|
|
|
|
(cd agb-hashmap && cargo miri test)
|
|
|
|
|
2022-08-05 06:30:52 +10:00
|
|
|
_run-tool +tool:
|
2022-10-03 03:53:42 +11:00
|
|
|
(cd tools && cargo build)
|
2022-10-03 04:19:14 +11:00
|
|
|
"$CARGO_TARGET_DIR/debug/tools" {{tool}}
|
2022-08-05 06:30:52 +10:00
|
|
|
|
2023-09-14 21:29:13 +10:00
|
|
|
test-games:
|
|
|
|
just test-game the-dungeon-puzzlers-lament
|
|
|
|
|
|
|
|
test-game game:
|
|
|
|
(cd "examples/{{game}}" && CARGO_TARGET_THUMBV4T_NONE_EABI_RUNNER=mgba-test-runner cargo test)
|
|
|
|
|
2022-02-25 08:29:33 +11:00
|
|
|
_build-rom folder name:
|
|
|
|
#!/usr/bin/env bash
|
2022-02-25 08:35:02 +11:00
|
|
|
set -euxo pipefail
|
|
|
|
|
2022-02-25 08:29:33 +11:00
|
|
|
GAME_FOLDER="{{folder}}"
|
|
|
|
INTERNAL_NAME="{{name}}"
|
|
|
|
|
|
|
|
GAME_NAME="$(basename "$GAME_FOLDER")"
|
|
|
|
|
|
|
|
TARGET_FOLDER="${CARGO_TARGET_DIR:-$GAME_FOLDER/target}"
|
|
|
|
GBA_FILE="$TARGET_FOLDER/$GAME_NAME.gba"
|
|
|
|
|
2023-03-24 08:43:19 +11:00
|
|
|
(cd "$GAME_FOLDER" && cargo build --release --target thumbv4t-none-eabi && cargo clippy --release --target thumbv4t-none-eabi -- {{CLIPPY_ARGUMENTS}} && cargo fmt --all -- --check)
|
2022-02-25 08:29:33 +11:00
|
|
|
|
|
|
|
mkdir -p examples/target/examples
|
|
|
|
|
2023-04-09 06:18:27 +10:00
|
|
|
just gbafix --title "${INTERNAL_NAME:0:12}" --gamecode "${INTERNAL_NAME:0:4}" --makercode GC "$TARGET_FOLDER/thumbv4t-none-eabi/release/$GAME_NAME" -o "$GBA_FILE"
|
2022-02-25 08:29:33 +11:00
|
|
|
|
|
|
|
cp -v "$GBA_FILE" "examples/target/examples/$GAME_NAME.gba"
|
|
|
|
|
2023-04-09 06:14:11 +10:00
|
|
|
gbafix *args:
|
2023-04-09 06:10:47 +10:00
|
|
|
(cd agb-gbafix && cargo run --release -- {{args}})
|
|
|
|
|
2022-02-25 08:29:33 +11:00
|
|
|
_all-crates target:
|
2023-07-23 09:31:12 +10:00
|
|
|
for CARGO_PROJECT_FILE in agb-*/Cargo.toml agb/Cargo.toml tracker/agb-*/Cargo.toml; do \
|
2022-02-25 08:29:33 +11:00
|
|
|
PROJECT_DIR=$(dirname "$CARGO_PROJECT_FILE"); \
|
2022-03-14 07:10:37 +11:00
|
|
|
just "{{target}}" "$PROJECT_DIR" || exit $?; \
|
2022-02-25 08:29:33 +11:00
|
|
|
done
|
|
|
|
|
2022-04-24 02:10:17 +10:00
|
|
|
_build-debug crate:
|
|
|
|
(cd "{{crate}}" && cargo build --examples --tests)
|
|
|
|
_build-release crate:
|
|
|
|
(cd "{{crate}}" && cargo build --release --examples --tests)
|
2022-02-25 08:29:33 +11:00
|
|
|
_test-release crate:
|
2022-04-24 02:10:17 +10:00
|
|
|
just _build-release {{crate}}
|
|
|
|
(cd "{{crate}}" && cargo test --release)
|
2022-08-02 02:36:12 +10:00
|
|
|
_test-release-arm crate:
|
2022-08-23 21:44:54 +10:00
|
|
|
(cd "{{crate}}" && cargo test --release --target=armv4t-none-eabi)
|
2022-02-25 08:29:33 +11:00
|
|
|
_test-debug crate:
|
2022-04-24 02:10:17 +10:00
|
|
|
just _build-debug {{crate}}
|
|
|
|
(cd "{{crate}}" && cargo test)
|
2022-08-02 02:36:12 +10:00
|
|
|
_test-debug-arm crate:
|
2022-08-24 11:52:32 +10:00
|
|
|
(cd "{{crate}}" && cargo test --target=armv4t-none-eabi)
|
2023-10-18 09:49:57 +11:00
|
|
|
_test-multiboot:
|
2023-10-18 22:26:50 +11:00
|
|
|
(cd "agb" && AGB_MULTIBOOT=true cargo test --features=multiboot --test=test_multiboot)
|
2022-02-25 08:29:33 +11:00
|
|
|
_clippy crate:
|
2022-04-25 02:07:43 +10:00
|
|
|
(cd "{{crate}}" && cargo clippy --examples --tests -- {{CLIPPY_ARGUMENTS}})
|
2022-02-25 08:54:16 +11:00
|
|
|
_clean crate:
|
|
|
|
(cd "{{crate}}" && cargo clean)
|
2023-03-24 08:43:19 +11:00
|
|
|
_fmt crate:
|
|
|
|
(cd "{{crate}}" && cargo fmt --all)
|
|
|
|
_fmt-check crate:
|
|
|
|
(cd "{{crate}}" && cargo fmt --all -- --check)
|
2022-02-25 09:07:28 +11:00
|
|
|
|
|
|
|
_build-example example:
|
2022-02-25 09:08:36 +11:00
|
|
|
(cd agb && cargo build "--example={{example}}")
|
|
|
|
_build-example-release example:
|
2022-08-24 11:52:32 +10:00
|
|
|
(cd agb && cargo build "--example={{example}}" --release)
|