3 # Author: Mike Beattie <mike@ethernal.org>
5 # Script to parse result from git describe, and push values into
6 # BuildInfo.java for use within altosdroid (to display the current
7 # version and build information, primarily).
10 srcdir=app/src/main/java/org/altusmetrum/AltosDroid
11 infile=${srcdir}/BuildInfo.java.in
12 outfile=${srcdir}/BuildInfo.java
19 builddate=$(date "+%Y-%m-%d")
20 buildtime=$(date "+%H:%M")
24 describe=$(git describe --match "$version" --long --always 2>/dev/null || echo '')
25 if [ -n "$describe" ]; then
26 branch=$(git branch | sed -ne 's/^\* //p')
27 commitdetails=$(echo $describe | sed -e "s/^$version-//")
28 commitnum=$(echo $commitdetails | cut -s -d- -f1)
29 commithash=$(echo $commitdetails | cut -d- -f2)
33 echo "Version $describe, built on $builddate $buildtime $buildtz"
35 sed -e "s/@VERSION@/$version/" \
36 -e "s/@DESCRIBE@/$describe/" \
37 -e "s/@BRANCH@/$branch/" \
38 -e "s/@COMMITNUM@/$commitnum/" \
39 -e "s/@COMMITHASH@/$commithash/" \
40 -e "s/@BUILDDATE@/$builddate/" \
41 -e "s/@BUILDTIME@/$buildtime/" \
42 -e "s/@BUILDTZ@/$buildtz/" \