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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
#!/usr/bin/env bash
ARGV=("$@")
###
# http://stackoverflow.com/a/23342259
###
exe() { echo "\$ $@" ; "$@" ; }
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd $CWD
show_usage () {
echo ""
echo "Set up the building of libssts and clean up too."
echo " This is not ment as a replacment for bazaar or for meson, just a"
echo " \"kick-start\" for new developers... and makes branching easier."
echo ""
echo " ./build.sh clean - Clean up the project and build files."
echo " cl"
echo ""
echo " ./build.sh build - Create the build directory, run CMake (if"
echo " bl needed) and build libssts."
echo ""
echo " ./build.sh help - Show this helpful help text."
echo " -h"
echo ""
echo " ./build.sh clean-tree - clean the bzr three. reverting all and any"
echo " ct changes made to the file tree since the last"
echo " commit."
echo ""
echo " ./build.sh commit - commit changes."
echo " cm"
echo ""
echo " ./build.sh branch <name> - create a branch. This will cd up one level"
echo " br and then do a branch. The name of the"
echo " branch will be \"simpletypesystem_<name>\"."
echo ""
echo " ./build.sh merge-trunk - Commits your current changes and then pull"
echo " mt merge from trunk. If the merge went smoothly"
echo " it will procide to commit the merge with"
echo " message \"* Merged trunk.\""
echo ""
echo " ./build.sh propose-merge - Propese merge of current branch."
echo " pm"
}
do_build () {
cd $CWD
if ( ! -d "./build" )
then
exe mkdir ./build
fi
cd ./build
if [ ! -f "build.ninja" ]
then
exe meson ..
fi
ninja
}
do_test () {
if ( ! -d "./build" )
then
do_build
fi
cd $__CWD/build
exe ninja test
}
do_clean () {
if [ -d "./build" ]
then
exe rm -R ./build
fi
}
do_clean_tree () {
exe brz revert
exe brz clean-tree
}
do_commit () {
exe brz commit
}
do_branch () {
echo ${ARGV[1]}
if [[ -z ${ARGV[1]} ]]
then
echo "Missing branch name."
show_usage
exit
else
#build up the branch name.
NEW_BRANCH_NAME="simpletypesystem_"${ARGV[1]}
CURRENT_WD=$(pwd)
exe cd ..
PARENT_WD=$(pwd)
exe bzr branch $CURRENT_WD $PARENT_WD/$NEW_BRANCH_NAME
if [[ -z $? ]]
then
echo ""
echo "Something went wrong when trying to branch..."
else
echo ""
echo "The directory $PARENT_WD/$NEW_BRANCH_NAME is ready. To go to that"
echo "branch cd to it."
echo ""
echo "Remember to commit often and run"
echo "$ bzr push --remember lp:~<lp-username>/simpletypesystem/${ARGV[1]}"
echo "before you start hacking."
fi
fi
}
do_merge_trunk () {
exe brz commit
exe brz merge lp:simpletypesystem
if [[ -z $? ]]
then
echo "Something went wrong with the merge! Plese solve these problems"
echo "before you procide to commit again!"
else
exe commit -m "* Merged with trunk."
fi
}
do_propose_merge () {
exe brz lp-propose-merge
}
case ${ARGV[0]} in
"help"|"-h") show_usage ;;
"clean"|"cl") do_clean ;;
"build"|"bl") do_build ;;
"test"|"tt") do_test ;;
"clean-tree"|"ct") do_clean_tree ;;
"commit"|"cm") do_commit ;;
"branch"|"br") do_branch ;;
"merge-trunk"|"mt") do_merge_trunk ;;
"propose-merge"|"pm") do_propose_merge ;;
*) show_usage ;;
esac
cd $CWD
|