aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-11-30 17:45:46 -0700
committerSelene ToyKeeper2023-11-30 17:45:46 -0700
commit2dc1d19e67e2ad1606470bb14ca44e9f8c684d2b (patch)
tree802ee6530d9a4250e384b1696a21f99270ced147
parentfixed RGB aux turning on in momentary mode when post-off voltage was enabled (diff)
downloadanduril-2dc1d19e67e2ad1606470bb14ca44e9f8c684d2b.tar.gz
anduril-2dc1d19e67e2ad1606470bb14ca44e9f8c684d2b.tar.bz2
anduril-2dc1d19e67e2ad1606470bb14ca44e9f8c684d2b.zip
changed version number to use the latest release tag instead of build date
Before: 2023-11-30 (build date) After: 2023-10-31-98.1 (latest release tag + number of commits since + dirty flag)
Diffstat (limited to '')
-rw-r--r--.gitignore2
-rwxr-xr-xbin/build-all.sh20
-rwxr-xr-xbin/build.sh2
3 files changed, 19 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 965a3e3..d420e34 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+.build/
.env/
.venv/
.*.swo
@@ -7,6 +8,7 @@ env/
hex/
ignore/
old/
+releases/
venv/
*~
*.cpp
diff --git a/bin/build-all.sh b/bin/build-all.sh
index df72ad5..27209ca 100755
--- a/bin/build-all.sh
+++ b/bin/build-all.sh
@@ -21,9 +21,21 @@ 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
+# old: version = build date
+#date '+#define VERSION_NUMBER "%Y-%m-%d"' > ui/$UI/version.h
+
+# version = git tag + revs since + dirty flag
+REV=$(git describe --tags --dirty --abbrev=8 --match='r2*')
+# reformatting this would be easier with a perl one-liner,
+# but I'm trying to avoid extra build dependencies
+REV="${REV:1}" # strip the leading 'r'
+# strip rev hash (git won't give "commits since tag" without the rev hash)
+REV="${REV/-g[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]/}"
+REV="${REV/-dirty/.1}" # convert '-dirty' to '.1'
+# save the version name to version.h
+mkdir -p ".build/$UI"
+echo '#define VERSION_NUMBER "'"$REV"'"' > ".build/$UI/version.h"
+
PASS=0
FAIL=0
@@ -48,7 +60,7 @@ for TARGET in hw/*/*/**/"$UI".h ; do
if [ 1 = $SKIP ]; then continue ; fi
# announce what we're going to build
- echo "===== $UI : $NAME ====="
+ echo "===== $UI $REV : $NAME ====="
# try to compile, track result, and rename compiled files
if bin/build.sh "$TARGET" ; then
diff --git a/bin/build.sh b/bin/build.sh
index 9b4b0b3..d044ca5 100755
--- a/bin/build.sh
+++ b/bin/build.sh
@@ -49,7 +49,7 @@ export CPP=avr-cpp
export OBJCOPY=avr-objcopy
export DFPFLAGS="-B $DFPPATH/gcc/dev/$MCUNAME/ -I $DFPPATH/include/"
# TODO: include $user/ first so it can override other stuff
-INCLUDES="-I ui -I hw -I. -I.. -I../.. -I../../.."
+INCLUDES="-I .build -I ui -I hw -I. -I.. -I../.. -I../../.."
export CFLAGS=" -Wall -g -Os -mmcu=$MCUNAME -c -std=gnu99 -fgnu89-inline -fwhole-program $MCUFLAGS $INCLUDES -fshort-enums $DFPFLAGS"
export CPPFLAGS="-Wall -g -Os -mmcu=$MCUNAME -C -std=gnu99 -fgnu89-inline -fwhole-program $MCUFLAGS $INCLUDES -fshort-enums $DFPFLAGS"
export OFLAGS="-Wall -g -Os -mmcu=$MCUNAME -mrelax $DFPFLAGS"
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.