blob: fe213c16316d5f33deb1a4fbf7b7350e10e6bb16 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#!/usr/bin/env bash
set -e
MODE="${1}"
function checkclean {
if [ $(svn status | wc -l) -ne 0 ]; then
echo "error: Working copy not clean"
exit 1
fi
}
VER_MAJOR=$(cat common/versionNumber.h | grep "VER_MAJORMAJOR " | awk '{print $3;}')
VER_MINOR=$(cat common/versionNumber.h | grep "VER_MAJOR " | awk '{print $3;}')
VER_PATCH=$(cat common/versionNumber.h | grep "VER_MINOR " | awk '{print $3;}')
VER_BUILD=$(cat common/versionNumber.h | grep "VER_MINORMINOR " | awk '{print $3;}')
function writeall {
cat common/versionNumber.h | sed -e s/#define\ VER_MAJORMAJOR\ \ .\*/#define\ VER_MAJORMAJOR\ \ $VER_MAJOR/ > common/versionNumber.h.tmp && mv common/versionNumber.h.tmp common/versionNumber.h
cat common/versionNumber.h | sed -e s/#define\ VER_MAJOR\ \ \ \ \ \ .\*/#define\ VER_MAJOR\ \ \ \ \ \ $VER_MINOR/ > common/versionNumber.h.tmp && mv common/versionNumber.h.tmp common/versionNumber.h
cat common/versionNumber.h | sed -e s/#define\ VER_MINOR\ \ \ \ \ \ .\*/#define\ VER_MINOR\ \ \ \ \ \ $VER_PATCH/ > common/versionNumber.h.tmp && mv common/versionNumber.h.tmp common/versionNumber.h
cat common/versionNumber.h | sed -e s/#define\ VER_MINORMINOR\ .\*/#define\ VER_MINORMINOR\ $VER_BUILD/ > common/versionNumber.h.tmp && mv common/versionNumber.h.tmp common/versionNumber.h
}
case $MODE in
bumpmajor)
checkclean
VER_MAJOR=$(($VER_MAJOR + 1))
VER_MINOR=00
VER_PATCH=00
VER_BUILD=01
writeall
;;
bumpminor)
checkclean
VER_MINOR=$(printf "%02d" $(($(echo $VER_MINOR | sed 's/^0*//') + 1)))
VER_PATCH=00
VER_BUILD=01
writeall
;;
bumppatch)
checkclean
VER_PATCH=$(printf "%02d" $(($(echo $VER_PATCH | sed 's/^0*//') + 1)))
VER_BUILD=00
writeall
;;
bumpbuild)
VER_BUILD=$(printf "%02d" $(($(echo $VER_BUILD | sed 's/^0*//') + 1)))
writeall
;;
*)
echo "error: Wrong argument"
exit 1
;;
esac
|