diff options
| author | Selene ToyKeeper | 2023-12-05 16:49:24 -0700 |
|---|---|---|
| committer | Selene ToyKeeper | 2023-12-05 16:49:24 -0700 |
| commit | 50ae5684534ec9333a648794d4f371b882e53075 (patch) | |
| tree | e666fea7d540632dc99643468184b519e647c12d /bin/build-all.sh | |
| parent | d3aa: made it easy to switch between vddio2 and external voltage divider (diff) | |
| parent | moved version string calculation to bin/version-string.sh (diff) | |
| download | anduril-50ae5684534ec9333a648794d4f371b882e53075.tar.gz anduril-50ae5684534ec9333a648794d4f371b882e53075.tar.bz2 anduril-50ae5684534ec9333a648794d4f371b882e53075.zip | |
Merge branch 'trunk' into emisar-d3aa
* trunk:
moved version string calculation to bin/version-string.sh
forgot one item in the ChangeLog
ChangeLog: added 2023-12-03 release notes, converted @modelname to &modelname
docs: expanded / reorganized info on Version Check formats
updated MODELS, bin/models.py, and hw/BRANDS...
fw3x: document how it ships with the wrong fuse values, and how to fix it
github CI: fetch history too, to allow detection of version tags
build-all: handle the case where "git describe" can't get any tags
run CI on all branches, not just on trunk
fetch tags on CI checkout, so 'git describe' can work
added docs/battery-rainbow.png from old repo, since it's still relevant
added bin/make-release.sh to generate a .zip file ready for release
build-all.sh: re-indented, started organizing code into functions
changed version number to use the latest release tag instead of build date
Diffstat (limited to 'bin/build-all.sh')
| -rwxr-xr-x | bin/build-all.sh | 140 |
1 files changed, 77 insertions, 63 deletions
diff --git a/bin/build-all.sh b/bin/build-all.sh index df72ad5..f2420a7 100755 --- a/bin/build-all.sh +++ b/bin/build-all.sh @@ -9,68 +9,82 @@ # enable "**" for recursive glob (requires bash) shopt -s globstar -if [ "$#" -gt 0 ]; then - # multiple search terms with "AND" - SEARCH=( "$@" ) - # memes - [ "$1" = "me" ] && shift && shift && echo "Make your own $*." && exit 1 -fi - -# TODO: detect UI from $0 and/or $* -UI=anduril - -mkdir -p hex - -# TODO: use a git tag for the version, instead of build date -# TODO: use build/version.h instead of $UI/version.h ? -date '+#define VERSION_NUMBER "%Y-%m-%d"' > ui/$UI/version.h - -PASS=0 -FAIL=0 -PASSED='' -FAILED='' - -# build targets are hw/$vendor/$model/**/$ui.h -for TARGET in hw/*/*/**/"$UI".h ; do - - # friendly name for this build - NAME=$(echo "$TARGET" | perl -ne 's|/|-|g; /hw-(.*)-'"$UI"'.h/ && print "$1\n";') - - # limit builds to searched patterns, if given - SKIP=0 - if [ ${#SEARCH[@]} -gt 0 ]; then - for text in "${SEARCH[@]}" ; do - if ! echo "$NAME $TARGET" | grep -i -- "$text" > /dev/null ; then - SKIP=1 +function main { + + if [ "$#" -gt 0 ]; then + # multiple search terms with "AND" + SEARCH=( "$@" ) + # memes + [ "$1" = "me" ] && shift && shift && echo "Make your own $*." && exit 1 + fi + + # TODO: detect UI from $0 and/or $* + UI=anduril + + mkdir -p hex + + make-version-h # generate a version.h file + + PASS=0 + FAIL=0 + PASSED='' + FAILED='' + + # build targets are hw/$vendor/$model/**/$ui.h + for TARGET in hw/*/*/**/"$UI".h ; do + + # friendly name for this build + NAME=$(echo "$TARGET" | perl -ne 's|/|-|g; /hw-(.*)-'"$UI"'.h/ && print "$1\n";') + + # limit builds to searched patterns, if given + SKIP=0 + if [ ${#SEARCH[@]} -gt 0 ]; then + for text in "${SEARCH[@]}" ; do + if ! echo "$NAME $TARGET" | grep -i -- "$text" > /dev/null ; then + SKIP=1 + fi + done fi + if [ 1 = $SKIP ]; then continue ; fi + + # announce what we're going to build + echo "===== $UI $REV : $NAME =====" + + # try to compile, track result, and rename compiled files + if bin/build.sh "$TARGET" ; then + HEX_OUT="hex/$UI.$NAME.hex" + mv -f "ui/$UI/$UI".hex "$HEX_OUT" + MD5=$(md5sum "$HEX_OUT" | cut -d ' ' -f 1) + echo " # $MD5" + echo " > $HEX_OUT" + PASS=$((PASS + 1)) + PASSED="$PASSED $NAME" + else + echo "ERROR: build failed" + FAIL=$((FAIL + 1)) + FAILED="$FAILED $NAME" + fi + done - fi - if [ 1 = $SKIP ]; then continue ; fi - - # announce what we're going to build - echo "===== $UI : $NAME =====" - - # try to compile, track result, and rename compiled files - if bin/build.sh "$TARGET" ; then - HEX_OUT="hex/$UI.$NAME.hex" - mv -f "ui/$UI/$UI".hex "$HEX_OUT" - MD5=$(md5sum "$HEX_OUT" | cut -d ' ' -f 1) - echo " # $MD5" - echo " > $HEX_OUT" - PASS=$((PASS + 1)) - PASSED="$PASSED $NAME" - else - echo "ERROR: build failed" - FAIL=$((FAIL + 1)) - FAILED="$FAILED $NAME" - fi - -done - -# summary -echo "===== $PASS builds succeeded, $FAIL failed =====" -#echo "PASS: $PASSED" -if [ 0 != $FAIL ]; then - echo "FAIL:$FAILED" - exit 1 -fi + + # summary + echo "===== $PASS builds succeeded, $FAIL failed =====" + #echo "PASS: $PASSED" + if [ 0 != $FAIL ]; then + echo "FAIL:$FAILED" + exit 1 + fi +} + +function make-version-h { + # old: version = build date + #date '+#define VERSION_NUMBER "%Y-%m-%d"' > ui/$UI/version.h + + REV=$(bin/version-string.sh c) + # save the version name to version.h + mkdir -p ".build/$UI" + echo '#define VERSION_NUMBER "'"$REV"'"' > ".build/$UI/version.h" +} + +main "$@" + |
