/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk
116.1.2 by Gustav Hartvigsson
* added a build (build.sh)script that later can be used for other things.
1
#!/usr/bin/env bash
2
124 by Gustav Hartvigsson
* added branch commad to the ./build.sh script.
3
ARGV=("$@")
4
5
116.1.2 by Gustav Hartvigsson
* added a build (build.sh)script that later can be used for other things.
6
###
7
# http://stackoverflow.com/a/23342259
8
###
9
exe() { echo "\$ $@" ; "$@" ; }
10
11
show_usage () {
12
  echo ""
13
  echo "Set up the building of libssts and clean up too."
125.1.1 by Gustav Hartvigsson
* Added merge-trunk command to ./build.sh
14
  echo "  This is not ment as a replacment for bazaar or for cmake, just a"
15
  echo "  \"kick-start\" for new developers... and makes branching easier."
16
  echo ""
123 by Gustav Hartvigsson
* added clean-tree to build.sh
17
  echo "  ./build.sh clean      -  Clean up the project and build files."
125 by Gustav Hartvigsson
* Added aliases to ./build.sh
18
  echo "             cl"
123 by Gustav Hartvigsson
* added clean-tree to build.sh
19
  echo ""
20
  echo "  ./build.sh build      -  Create the build directory, run CMake (if"
125 by Gustav Hartvigsson
* Added aliases to ./build.sh
21
  echo "             bl            needed) and build libssts."
123 by Gustav Hartvigsson
* added clean-tree to build.sh
22
  echo ""
23
  echo "  ./build.sh help       -  Show this helpful help text."
125 by Gustav Hartvigsson
* Added aliases to ./build.sh
24
  echo "             -h"
123 by Gustav Hartvigsson
* added clean-tree to build.sh
25
  echo ""
26
  echo "  ./build.sh clean-tree -  clean the bzr three. reverting all and any"
125 by Gustav Hartvigsson
* Added aliases to ./build.sh
27
  echo "             ct            changes made to the file tree since the last"
123 by Gustav Hartvigsson
* added clean-tree to build.sh
28
  echo "                           commit."
124 by Gustav Hartvigsson
* added branch commad to the ./build.sh script.
29
  echo ""
30
  echo "  ./build.sh commit     -  commit changes."
125 by Gustav Hartvigsson
* Added aliases to ./build.sh
31
  echo "             cm"
124 by Gustav Hartvigsson
* added branch commad to the ./build.sh script.
32
  echo ""
33
  echo "  ./build.sh branch <name> - create a branch. This will cd up one level"
125 by Gustav Hartvigsson
* Added aliases to ./build.sh
34
  echo "             br              and then do a branch. The name of the"
124 by Gustav Hartvigsson
* added branch commad to the ./build.sh script.
35
  echo "                             branch will be \"simpletypesystem_<name>\"."
125 by Gustav Hartvigsson
* Added aliases to ./build.sh
36
  echo ""
125.1.2 by Gustav Hartvigsson
* deerrr.
37
  echo "  ./build.sh merge-trunk   - Commits your current changes and then pull"
125 by Gustav Hartvigsson
* Added aliases to ./build.sh
38
  echo "             mt             merge from trunk. If the merge went smoothly"
39
  echo "                            it will procide to commit the merge with"
40
  echo "                            message \"* Merged trunk.\""
125.1.1 by Gustav Hartvigsson
* Added merge-trunk command to ./build.sh
41
  echo ""
125.1.2 by Gustav Hartvigsson
* deerrr.
42
  echo " ./build.sh propose-merge  - Propese merge of current branch."
125.1.1 by Gustav Hartvigsson
* Added merge-trunk command to ./build.sh
43
  echo "            pm"
116.1.2 by Gustav Hartvigsson
* added a build (build.sh)script that later can be used for other things.
44
}
45
46
do_build () {
47
  if ( ! -d "./build" )
48
  then
49
    exe mkdir ./build
50
  fi
51
  
52
  cd ./build
53
  
54
  if [ ! -f "Makefile" ]
55
  then
56
    exe cmake ..
57
  fi
58
  
59
  make
60
}
61
62
do_clean () {
63
  if [ -d "./build" ]
64
  then
65
    exe rm -R ./build
66
  fi
67
}
68
123 by Gustav Hartvigsson
* added clean-tree to build.sh
69
do_clean_tree () {
70
  exe bzr revert
71
  exe bzr clean-tree 
72
}
73
124 by Gustav Hartvigsson
* added branch commad to the ./build.sh script.
74
do_commit () {
75
  exe bzr commit
76
}
77
125 by Gustav Hartvigsson
* Added aliases to ./build.sh
78
124 by Gustav Hartvigsson
* added branch commad to the ./build.sh script.
79
do_branch () {
80
  echo ${ARGV[1]}
81
  if [[ -z ${ARGV[1]} ]]
82
  then
83
    echo "Missing branch name."
84
    show_usage
85
    exit
86
  else
87
    #build up the branch name.
88
    NEW_BRANCH_NAME="simpletypesystem_"${ARGV[1]}
89
    CURRENT_WD=$(pwd)
90
    exe cd ..
91
    PARENT_WD=$(pwd)
92
    exe bzr branch $CURRENT_WD $PARENT_WD/$NEW_BRANCH_NAME
125.1.1 by Gustav Hartvigsson
* Added merge-trunk command to ./build.sh
93
    if [[ -z $? ]]
124 by Gustav Hartvigsson
* added branch commad to the ./build.sh script.
94
    then
95
      echo ""
96
      echo "Something went wrong when trying to branch..."
97
    else
98
      echo ""
99
      echo "The directory $PARENT_WD/$NEW_BRANCH_NAME is ready. To go to that"
100
      echo "branch cd to it."
101
      echo ""
102
      echo "Remember to commit often and run"
103
      echo "$ bzr push --remember lp:~<lp-username>/simpletypesystem/${ARGV[1]}"
104
      echo "before you start hacking."
105
    fi
106
  fi
107
}
108
125 by Gustav Hartvigsson
* Added aliases to ./build.sh
109
do_merge_trunk () {
110
  exe bzr commit
111
  exe bzr merge lp:simpletypesystem
125.1.1 by Gustav Hartvigsson
* Added merge-trunk command to ./build.sh
112
  if [[ -z $? ]]
125 by Gustav Hartvigsson
* Added aliases to ./build.sh
113
  then
114
    echo "Something went wrong with the merge! Plese solve these problems"
115
    echo "before you procide to commit again!"
116
  else
117
    exe commit -m "* Merged with trunk."
118
  fi
119
}
120
125.1.1 by Gustav Hartvigsson
* Added merge-trunk command to ./build.sh
121
do_propose_merge () {
125.1.3 by Gustav Hartvigsson
* errr...
122
  exe bzr lp-propose-merge
125.1.1 by Gustav Hartvigsson
* Added merge-trunk command to ./build.sh
123
}
124
124 by Gustav Hartvigsson
* added branch commad to the ./build.sh script.
125
case ${ARGV[0]} in
116.1.2 by Gustav Hartvigsson
* added a build (build.sh)script that later can be used for other things.
126
     "help"|"-h") show_usage ;;
125 by Gustav Hartvigsson
* Added aliases to ./build.sh
127
     "clean"|"cl") do_clean ;;
128
     "build"|"bl") do_build ;;
129
     "clean-tree"|"ct") do_clean_tree ;;
130
     "commit"|"cm") do_commit ;;
131
     "branch"|"br") do_branch ;;
132
     "merge-trunk"|"mt") do_merge_trunk ;;
125.1.2 by Gustav Hartvigsson
* deerrr.
133
     "propose-merge"|"pm") do_propose_merge ;;
116.1.2 by Gustav Hartvigsson
* added a build (build.sh)script that later can be used for other things.
134
     *) show_usage ;;
135
esac
136
137
138