made the error message more explicit for missing gffs variables.
[feisty_meow.git] / scripts / buildor / gffs_builders.sh
1 #!/bin/bash
2
3 source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
4
5 #hmmm: if this works well, we can use it in lots of places.
6 define_yeti_alias BAIL_ON_FAIL='if [ $? -ne 0 ]; then echo "A problem occurred.  $msg"; return 1; fi'
7
8 function zapem()
9 {
10   bash $GFFS_TOOLKIT_ROOT/library/zap_genesis_javas.sh 
11 }
12
13 # a macro for testing the configuration.
14 export GFFS_CHECK_VARS='
15   if [ -z "$GENII_INSTALL_DIR" -o -z "$GFFS_TOOLKIT_ROOT" ]; then
16     echo "GENII_INSTALL_DIR or GFFS_TOOLKIT_ROOT is not set.";
17     return 1;
18   fi '
19
20 function build_gffs()
21 {
22   eval $GFFS_CHECK_VARS
23 #  if [ -z "$GENII_INSTALL_DIR" -o -z "$GFFS_TOOLKIT_ROOT" ]; then
24 #    echo GENII_INSTALL_DIR is not set.
25 #    return 1
26 #  fi
27   #zapem
28   pushd "$GENII_INSTALL_DIR"
29   if [ $? -ne 0 ]; then
30     error_sound
31     return 1
32   fi
33   echo "Build starting at: $(date)"
34
35   # clean up some things.
36   \rm -rf unit-test-reports
37
38   # build the trunk.
39   ant -Dbuild.targetArch=64 build
40   if [ $? -ne 0 ]; then
41     error_sound
42     return 1
43   fi
44   echo "Build done at: $(date)"
45   popd
46
47   success_sound  
48 }
49
50 function rebuild_gffs()
51 {
52   eval $GFFS_CHECK_VARS
53 #  if [ -z "$GENII_INSTALL_DIR" -o -z "$GFFS_TOOLKIT_ROOT" ]; then
54 #    echo GENII_INSTALL_DIR is not set.
55 #    return 1
56 #  fi
57   #zapem
58   pushd "$GENII_INSTALL_DIR"
59   ant clean
60
61   if [ $? -ne 0 ]; then
62     error_sound
63     return 1
64   fi
65   popd
66   build_gffs
67 }
68
69 # a shortcut for doing a new build and creating a bootstrap container with it.
70 function rebu_bootstrap()
71 {
72   eval $GFFS_CHECK_VARS
73   rebuild_gffs 
74   if [ $? -ne 0 ]; then echo "failed to rebuild gffs code"; return 1; fi
75
76   quickstarter="$GENII_INSTALL_DIR/toolkit/library/bootstrap_quick_start.sh"
77   if [ ! -f "$quickstarter" ]; then
78     quickstarter="$GFFS_TOOLKIT_ROOT/library/bootstrap_quick_start.sh"
79   fi
80
81   bash "$quickstarter"
82   if [ $? -ne 0 ]; then
83     echo "failed to bootstrap a container."
84     error_sound
85     return 1
86   fi
87
88   success_sound  
89 }
90
91 # a shortcut for building without a clean, and creating a bootstrap container with the code.
92 function bu_bootstrap()
93 {
94   eval $GFFS_CHECK_VARS
95   build_gffs 
96   if [ $? -ne 0 ]; then echo "failed to rebuild gffs code"; return 1; fi
97
98   quickstarter="$GENII_INSTALL_DIR/toolkit/library/bootstrap_quick_start.sh"
99   if [ ! -f "$quickstarter" ]; then
100     quickstarter="$GFFS_TOOLKIT_ROOT/library/bootstrap_quick_start.sh"
101   fi
102
103   bash "$quickstarter"
104   if [ $? -ne 0 ]; then
105     echo "failed to bootstrap a container."
106     error_sound
107     return 1
108   fi
109
110   success_sound  
111 }
112
113 # a shortcut for doing a quick build and then creating an installer.
114 function fast_install_build()
115 {
116   eval $GFFS_CHECK_VARS
117   bash "$GFFS_TOOLKIT_ROOT/tools/installer/fast_installer_build.sh" $*
118   if [ $? -ne 0 ]; then
119     echo "failed to create the installer."
120     error_sound
121     return 1
122   fi
123
124   success_sound  
125 }
126
127