Add build archival script with timestamped snapshots (.gba, .elf, .map) (#420)
* added .sh script for copying output files under folder * Update scripts/save_build.sh Co-authored-by: Rickey <ric@rf3.xyz> * Partial save functionality, comments & game name env variable * indentation fixes * exit with error val Co-authored-by: Rickey <ric@rf3.xyz> * make save_build.sh executable --------- Co-authored-by: Rickey <ric@rf3.xyz>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/.vscode
|
||||
/.idea
|
||||
/build
|
||||
/saved_builds
|
||||
/.vs
|
||||
_codeql_detected_source_root
|
||||
*.sln
|
||||
|
||||
@@ -95,6 +95,7 @@ In the repo we use custom scripts located in the [`scripts`](https://github.com/
|
||||
- **get_hash.py**: Get git hash from ROM.
|
||||
- **generate_font.py**: Generate a font manually.
|
||||
- **get_memory_map.sh**: Print the memory map of the pre-allocated pools.
|
||||
- **save_build.sh**: Save a timestamped copy of build outputs (.elf, .gba, .map).
|
||||
|
||||
## Debugging
|
||||
It's recommended to use [mGBA](https://mgba.io/) for ROM testing and debugging. As it provides a [`gdbserver`](https://en.wikipedia.org/wiki/Gdbserver) via the `-g` flag `mgba -g build/balatro-gba.gba`. You can connect via `gdb` or here is a [great guide for vscode](https://felixjones.co.uk/mgba_gdb/vscode.html).
|
||||
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# NOTE: This script is meant to be run from
|
||||
# the root repository directory to work as intended.
|
||||
|
||||
set -e
|
||||
|
||||
make
|
||||
|
||||
GAME_NAME="${GAME_NAME-balatro-gba}"
|
||||
timestamp=$(date +%Y%m%d_%H%M%S)
|
||||
arg=${1:-"build"}
|
||||
dir="saved_builds/${arg}_${timestamp}"
|
||||
|
||||
mkdir -p "$dir"
|
||||
|
||||
failed=0
|
||||
for fe in elf gba map; do
|
||||
if [ -f build/"$GAME_NAME".$fe ]; then
|
||||
cp build/"$GAME_NAME".$fe "$dir/"
|
||||
else
|
||||
echo "Warning: build/$GAME_NAME.$fe not found"
|
||||
failed=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $failed -eq 1 ]; then
|
||||
echo "Some files are missing, partially saved to $dir"
|
||||
else
|
||||
echo "Build files saved to $dir"
|
||||
fi
|
||||
|
||||
exit $failed
|
||||
|
||||
Reference in New Issue
Block a user