root/trunk/build/quickstart/linux/bw

Revision 3229 (checked in by douglm, 2 years ago)

Add caldavtest as separate build

  • Property svn:mergeinfo set to
  • Property svn:executable set to *
Line 
1 #! /bin/sh
2
3 #
4 # This file is included by the quickstart script file "bw" so that it can live
5 # within the svn repository.
6 #
7
8 ANT_HOME=`dirname "$PRG"`/apache-ant-1.7.0
9 ANT_HOME=`cd "$ANT_HOME" && pwd`
10
11 #ant_listener="-listener org.apache.tools.ant.listener.Log4jListener"
12 #ant_xmllogfile="-DXmlLogger.file=log.xml"
13 #ant_logger="-logger org.apache.tools.ant.XmlLogger"
14
15 ant_listener=
16 ant_xmllogfile=
17 ant_logger=
18
19 ant_loglevel="-quiet"
20 bw_loglevel=""
21
22 # Projects we need to update
23 updateProjects="bwxml bedework bedework-carddav bwtzsvr cachedfeeder"
24
25 echo ""
26 echo "  Bedework Calendar System"
27 echo "  ------------------------"
28 echo ""
29
30 PRG="$0"
31
32 usage() {
33   echo "  $PRG ACTION"
34   echo "  $PRG [CONFIG-SOURCE] [CONFIG] [PROJECT] [ -offline ] [LOG_LEVEL] [ target ] "
35   echo ""
36   echo " where:"
37   echo ""
38   echo "   ACTION defines an action to take usually in the context of the quickstart."
39   echo "    In a deployed system many of these actions are handled directly by a"
40   echo "    deployed application. ACTION may be one of"
41   echo "      -updateall  Does an svn update of all projects"
42   echo "      -reindex    runs the indexer directly out of the quickstart bedework"
43   echo "                  dist directory to rebuild the lucene indexes"
44   echo "      -zoneinfo   builds zoneinfo data for the timezones server"
45   echo "                  requires -version and -tzdata parameters.   NOTE: build depends on glib2"
46   echo "      -buildwebcache     builds webcache"
47   echo "      -deploywebcache    deploys webcache"
48   echo "      -deployurlbuilder  deploys url/widget builder"
49   echo ""
50   echo "   CONFIG-SOURCE optionally defines the location of configurations and"
51   echo "                 is one or none of  "
52   echo "     -quickstart    to use the configurations within the quickstart"
53   echo "     -bwchome path  to specify the location of the bwbuild directory"
54   echo "   The default is to look in the user home for the bwbuild directory."
55   echo ""
56   echo "   CONFIG optionally defines the configuration to build"
57   echo "      -bwc configname"
58   echo ""
59   echo "   -offline     Build without attempting to retrieve library jars"
60   echo ""
61   echo "   LOG_LEVEL sets the level of logging and can be"
62   echo "      -log-silent   Nearly silent"
63   echo "      -log-quiet    The default"
64   echo "      -log-inform   A little more noisy"
65   echo "      -log-verbose  Noisier"
66   echo "      -ant-debug    Vast amounts of ant output"
67   echo "      -build-debug  Some bedework build debug output"
68   echo ""
69   echo "   target       Ant target to execute"
70   echo ""
71   echo "   PROJECT optionally defines the package to build and is none or more of"
72   echo "     -bwxml       Target is for the Bedework XML schemas build"
73   echo "     -caldavTest  Target is for the CalDAV Test build"
74   echo "     -carddav     Target is for the CardDAV build"
75   echo "     -exsynch     Target is for the Exchange synch build"
76   echo "     -client      Target is for the bedework client application build"
77   echo "     -monitor     Target is for the bedework monitor application"
78   echo "     -naming      Target is for the abstract naming api"
79   echo "     -tzsvr       Target is for the timezones server build"
80   echo "     The default is a calendar build"
81   echo ""
82   echo "     -carddav deploy-addrbook    To deploy the Javascript Addressbook client."
83   echo ""
84   echo "   Invokes ant to build or deploy the Bedework system. Uses a configuration"
85   echo "   directory which contains one directory per configuration."
86   echo ""
87   echo "   Within each configuration directory we expect a file called build.properties"
88   echo "   which should point to the property and options file needed for the deploy process"
89   echo ""
90   echo "   In general these files will be in the same directory as build.properties."
91   echo "   The environment variable BEDEWORK_CONFIG contains the path to the current"
92   echo "   configuration directory and can be used to build a path to the other files."
93   echo ""
94 }
95
96 errorUsage() {
97   echo "*******************************************************************************************"
98   echo "Error: $1"
99   echo "*******************************************************************************************"
100   echo
101   echo "Sleeping 5 seconds before displaying usage. Safe to ctrl-C."
102   sleep 5
103   echo ""
104   usage
105   exit 1
106 }
107
108 # ----------------------------------------------------------------------------
109 # Update the projects
110 # ----------------------------------------------------------------------------
111 actionUpdateall() {
112   for project in $updateProjects
113   do
114     echo "*********************************************************************"
115     echo "Updating project $project"
116     echo "*********************************************************************"
117     svn update $project
118   done
119  
120   exit 0
121 }
122
123 # ----------------------------------------------------------------------------
124 # Reindex the data
125 # ----------------------------------------------------------------------------
126 actionReindex() {
127   INDEXER=$QUICKSTART_HOME/bedework/dist/temp/shellscr/indexer
128  
129         if [ ! -d "$INDEXER" ] ; then
130           errorUsage "The indexer directory $INDEXER does not exist. You probably need to do a rebuild."
131         fi
132
133   cd $INDEXER
134   chmod +x bwrun
135   ./bwrun reindex-nostart -user admin -indexlocprefix ../../../../../
136  
137   exit 0
138 }
139
140 usageZoneinfo() {
141   echo ""
142   echo "$PRG -zoneinfo -version VERSION -tzdata path-to-data"
143   echo "for example:"
144   echo "$PRG -zoneinfo -version 2010m -tzdata /data/olson/tzdata2010m.tar.gz"
145   exit 1
146 }
147
148 # ----------------------------------------------------------------------------
149 # Build zoneinfo - require -version -tzdata
150 # tzdata file can be obtained via http://www.twinsun.com/tz/tz-link.htm or
151 # more directly from ftp://elsie.nci.nih.gov/pub/
152 # The version parameter value should be the version code from the tzdata name
153 # ----------------------------------------------------------------------------
154 actionZoneinfo() {
155   bwtzsvr="$QUICKSTART_HOME/bwtzsvr"
156   bwresources="$bwtzsvr/resources"
157
158   shift
159  
160   if [ "$1" != "-version" ] ; then
161     echo "got $1"
162     echo "Must supply -version parameter for -zoneinfo"
163     usageZoneinfo
164   fi
165  
166   shift
167     echo "got $1"
168 #  version="-Dorg.bedework.timezones.version=$1"
169   version=$1
170   shift
171  
172   if [ "$1" != "-tzdata" ] ; then
173     echo "Must supply -tzdata parameter for -zoneinfo"
174     usageZoneinfo
175   fi
176  
177   shift
178 #  tzdata="-Dorg.bedework.timezones.data=$1"
179   tzdata=$1
180   shift
181  
182   rm -rf /tmp/bedework
183   mkdir /tmp/bedework
184   mkdir /tmp/bedework/timezones
185  
186   cd /tmp/bedework/timezones
187  
188   wget http://bedework.org/downloads/lib/vzic-1.3.tgz
189   gunzip vzic-1.3.tgz
190   tar -xf vzic-1.3.tar
191
192 # copy and unpack the data
193   mkdir olsondata
194   cd olsondata
195   cp $tzdata tzdata.tar.gz
196   gunzip tzdata.tar.gz
197   tar -xf tzdata.tar
198   rm tzdata.tar
199   cd ..
200  
201 # Replace lines in the makefile. Sure real unix types can do better 
202  
203   cd vzic-1.3
204  
205   sed "s/\(^OLSON_DIR = \)\(..*$\)/\1\/tmp\/bedework\/timezones\/olsondata/" Makefile > Makefile1
206
207   sed "s/\(^PRODUCT_ID = \)\(..*$\)/\1\/bedework.org\/\/NONSGML Bedework\/\/EN/" Makefile1 > Makefile2
208
209   sed "s/\(^TZID_PREFIX = \)\(..*$\)/\1/" Makefile2 > Makefile
210  
211   make
212  
213 # omit the pure for allegedly better outlook compatability -
214 # but not altogether correct timezones 
215   ./vzic --pure
216
217   cd ..
218  
219   mkdir tzdata
220   cp -r vzic-1.3/zoneinfo tzdata
221   cp $bwresources/aliases.txt tzdata
222  
223   cd tzdata
224  
225   echo "version=$version" > info.txt
226   date +buildTime=%D-%T-%N >> info.txt
227  
228   zip -r tzdata *
229  
230   cp tzdata.zip $bwtzsvr/
231  
232   echo ""
233   echo "------------------------------------------------------------------------------"
234   echo "tzdata.zip has been built and is at $bwtzsvr/tzdata.zip"
235   echo "------------------------------------------------------------------------------"
236   echo ""
237  
238   exit 0
239 }
240
241 if [ -z "$JAVA_HOME" -o ! -d "$JAVA_HOME" ] ; then
242   errorUsage "JAVA_HOME is not defined correctly for bedework."
243 fi
244
245 saveddir=`pwd`
246
247 trap 'cd $saveddir' 0
248 trap "exit 2" 1 2 3 15
249
250 export QUICKSTART_HOME=$saveddir
251
252 CLASSPATH=$ANT_HOME/lib/ant-launcher.jar
253 CLASSPATH=$CLASSPATH:$QUICKSTART_HOME/bedework/build/quickstart/antlib
254
255 # Default some parameters
256
257 BWCONFIGS=
258 bwc=default
259 BWCONFIG=
260 offline=
261 quickstart=
262
263 # Projects we will build
264 pkgdefault=yes
265 bedework=
266 bwxml=
267 carddav=
268 caldavTest=
269 caldav=
270 client=
271 exsynch=
272 monitor=
273 naming=
274 tzsvr=
275 webdav=
276
277 action=
278
279 if [ "$1" = "" ] ; then
280   usage
281   exit 1
282 fi
283
284 # look for actions first
285
286 if [ "$1" = "-updateall" ] ; then
287   actionUpdateall
288 fi
289
290 if [ "$1" = "-reindex" ] ; then
291   actionReindex
292 fi
293
294 if [ "$1" = "-zoneinfo" ] ; then
295   actionZoneinfo $*
296 fi
297
298 if [ "$1" = "-buildwebcache" ] ; then
299   cd $QUICKSTART_HOME/cachedfeeder
300   ./buildWebCache
301   exit
302 fi
303
304 if [ "$1" = "-deploywebcache" ] ; then
305   cd $QUICKSTART_HOME/cachedfeeder
306   $JAVA_HOME/bin/java -classpath $CLASSPATH $ant_xmllogfile -Dant.home=$ANT_HOME org.apache.tools.ant.launch.Launcher \
307                  $BWCONFIG $ant_listener $ant_logger $ant_loglevel $bw_loglevel deploy-webcache
308   exit
309 fi
310
311 if [ "$1" = "-deployurlbuilder" ] ; then
312   cd $QUICKSTART_HOME/cachedfeeder
313   $JAVA_HOME/bin/java -classpath $CLASSPATH $ant_xmllogfile -Dant.home=$ANT_HOME org.apache.tools.ant.launch.Launcher \
314                  $BWCONFIG $ant_listener $ant_logger $ant_loglevel $bw_loglevel deploy-urlbuilder
315   exit
316 fi
317
318 while [ "$1" != "" ]
319 do
320   # Process the next arg
321   case $1       # Look at $1
322   in
323     -bwchome)         # Define location of configs
324       shift
325       BWCONFIGS="$1"
326       shift
327       ;;
328     -quickstart)
329       quickstart="yes"
330       shift
331       ;;
332     -usage | -help | -? | ?)
333       usage
334       exit
335       shift
336       ;;
337     -bwc)
338       shift
339       bwc="$1"
340       shift
341       ;;
342     -offline)
343       offline="-Dorg.bedework.offline.build=yes"
344       shift
345       ;;
346 # ----------------------- Log level       
347     -log-silent)
348       ant_loglevel="-quiet"
349       bw_loglevel="-Dorg.bedework.build.silent=true"
350       shift
351       ;;
352     -log-quiet)
353       ant_loglevel="-quiet"
354       bw_loglevel=""
355       shift
356       ;;
357     -log-inform)
358       ant_loglevel=""
359       bw_loglevel="-Dorg.bedework.build.inform=true"
360       shift
361       ;;
362     -log-verbose)
363       ant_loglevel="-verbose"
364       bw_loglevel="-Dorg.bedework.build.inform=true -Dorg.bedework.build.noisy=true"
365       shift
366       ;;
367     -ant-debug)
368       ant_loglevel="-debug"
369       shift
370       ;;
371     -build-debug)
372       bw_loglevel="-Dorg.bedework.build.inform=true -Dorg.bedework.build.noisy=true -Dorg.bedework.build.debug=true "
373       shift
374       ;;
375 # ------------------------Projects
376     -bwxml)
377       bwxml="yes"
378       pkgdefault=
379       shift
380       ;;
381     -carddav)
382       carddav="yes"
383       pkgdefault=
384       shift
385       ;;
386     -caldav)
387       caldav="yes"
388       pkgdefault=
389       shift
390       ;;
391     -caldavTest)
392       caldavTest="yes"
393       pkgdefault=
394       shift
395       ;;
396     -client)
397       client="yes"
398       pkgdefault=
399       shift
400       ;;
401     -exsynch)
402       exsynch="yes"
403       pkgdefault=
404       shift
405       ;;
406     -webdav)
407       webdav="yes"
408       pkgdefault=
409       shift
410       ;;
411     -monitor)
412       monitor="yes"
413       pkgdefault=
414       shift
415       ;;
416     -naming)
417       naming="yes"
418       pkgdefault=
419       shift
420       ;;
421     -tzsvr)
422       tzsvr="yes"
423       pkgdefault=
424       shift
425       ;;
426     -*)
427       usage
428       exit 1
429       ;;
430     *)
431       # Assume we've reached the target(s)
432       break
433       ;;
434   esac
435 done
436
437 if [ "$quickstart" != "" ] ; then
438   if [ "$BWCONFIGS" != "" ] ; then
439     errorUsage "Cannot specify both -quickstart and -bwchome"
440   fi
441   if [ "$bwc" = "jboss" ] ; then
442         errorUsage "The jboss configuration has been removed from the quickstart.  It is now the default.  Remove the '-bwc jboss' option."
443   fi
444
445   BWCONFIGS=$QUICKSTART_HOME/bedework/config/bwbuild
446 elif [ "$BWCONFIGS" = "" ] ; then
447   BWCONFIGS=$HOME/bwbuild
448 fi
449
450 export BEDEWORK_CONFIGS_HOME=$BWCONFIGS
451 export BEDEWORK_CONFIG=$BWCONFIGS/$bwc
452
453 if [ ! -d "$BEDEWORK_CONFIGS_HOME/.platform" ] ; then
454   errorUsage "Configurations directory $BEDEWORK_CONFIGS_HOME is missing directory '.platform'."
455 fi
456
457 if [ ! -f "$BEDEWORK_CONFIG/build.properties" ] ; then
458   errorUsage "Configuration $BEDEWORK_CONFIG does not exist or is not a bedework configuration."
459 fi
460
461 # Make available for ant
462 export BWCONFIG="-Dorg.bedework.user.build.properties=$BEDEWORK_CONFIG/build.properties"
463
464 echo "BWCONFIGS=$BWCONFIGS"
465 echo "BWCONFIG=$BWCONFIG"
466
467 if [ "$bwxml" != "" ] ; then
468   cd $QUICKSTART_HOME/bwxml
469 fi
470
471 if [ "$caldav" != "" ] ; then
472   cd $QUICKSTART_HOME/bedework/projects/caldav
473 fi
474
475 if [ "$caldavTest" != "" ] ; then
476   cd $QUICKSTART_HOME/caldavTest
477 fi
478
479 if [ "$carddav" != "" ] ; then
480   cd $QUICKSTART_HOME/bedework-carddav
481 fi
482
483 if [ "$client" != "" ] ; then
484   cd $QUICKSTART_HOME/bwclient
485 fi
486
487 if [ "$exsynch" != "" ] ; then
488   cd $QUICKSTART_HOME/exchgsynch
489 fi
490
491 if [ "$monitor" != "" ] ; then
492   cd $QUICKSTART_HOME/MonitorApp
493 fi
494
495 if [ "$naming" != "" ] ; then
496   cd $QUICKSTART_HOME/bwnaming
497 fi
498
499 if [ "$tzsvr" != "" ] ; then
500   cd $QUICKSTART_HOME/bwtzsvr
501 fi
502
503 if [ "$webdav" != "" ] ; then
504   cd $QUICKSTART_HOME/bedework/projects/webdav
505 fi
506
507 $JAVA_HOME/bin/java -classpath $CLASSPATH $ant_xmllogfile $offline -Dant.home=$ANT_HOME org.apache.tools.ant.launch.Launcher $BWCONFIG $ant_listener $ant_logger $ant_loglevel $bw_loglevel $*
Note: See TracBrowser for help on using the browser.