root/trunk/build/quickstart/windows/bw.bat

Revision 3197 (checked in by johnsa, 2 years ago)

updating Windows bw scripts to keep in line with trunk/3.7 needs

  • Property svn:mergeinfo set to
Line 
1 ::  This file is included by the quickstart script file "..\..\bw.bat" so that
2 ::  we may keep this script under version control in the svn repository.
3
4 @ECHO off
5 SETLOCAL
6
7 ECHO.
8 ECHO.
9 ECHO   Bedework Calendar System
10 ECHO   ------------------------
11 ECHO.
12
13
14 SET PRG=%0
15 SET saveddir=%CD%
16 SET QUICKSTART_HOME=%saveddir%
17
18 SET ANT_HOME=%QUICKSTART_HOME%\apache-ant-1.7.0
19
20 SET CLASSPATH="%ANT_HOME%\lib\ant-launcher.jar"
21 SET CLASSPATH=%CLASSPATH%;"%QUICKSTART_HOME%\bedework\build\quickstart\antlib"
22
23 :: Default some parameters
24 SET BWCONFIGS=
25 SET bwc=default
26 SET BWCONFIG=
27 SET offline=
28 SET quickstart=
29
30 SET ant_listener=
31 SET ant_xmllogfile=
32 SET ant_logger=
33
34 SET ant_loglevel="-quiet"
35 SET bw_loglevel=""
36
37 :: Projects we need to update
38 SET updateProjects="bwxml bedework bedework-carddav bwtzsvr cachedfeeder"
39
40 :: Projects we will build
41 SET pkgdefault=yes
42 SET bedework=
43 SET carddav=
44 SET caldav=
45 SET client=
46 SET monitor=
47 SET naming=
48 SET tzsvr=
49 SET webdav=
50
51 SET action=
52
53 :: check for command-line arguments and branch on them
54 IF "%1noargs" == "noargs" GOTO usage
55 GOTO branch
56
57 :quickstart
58   ECHO     Preparing quickstart build ...
59   SET quickstart="yes"
60   SHIFT
61   GOTO branch
62
63 :bwchome
64   :: Define location of configs
65   SHIFT
66   SET BWCONFIGS=%1
67   SHIFT
68   GOTO branch
69
70 :bwc
71   SHIFT
72   SET bwc=%1
73   SHIFT
74   GOTO branch
75
76 :offline
77   ECHO     Setting to offline mode; libraries will not be downloaded ...
78   SET offline="-Dorg.bedework.offline.build=yes"
79   SHIFT
80   GOTO branch
81  
82
83 :: ----------------------- Log level       
84
85 :log-silent
86   SET ant_loglevel="-quiet"
87   SET bw_loglevel="-Dorg.bedework.build.silent=true"
88   SHIFT
89   GOTO branch
90
91 :log-quiet
92   SET ant_loglevel="-quiet"
93   SET bw_loglevel=""
94   SHIFT
95   GOTO branch
96
97 :log-inform
98   SET ant_loglevel=""
99   SET bw_loglevel="-Dorg.bedework.build.inform=true"
100   SHIFT
101   GOTO branch
102
103 :log-verbose
104   SET ant_loglevel="-verbose"
105   SET bw_loglevel="-Dorg.bedework.build.inform=true -Dorg.bedework.build.noisy=true"
106   SHIFT
107   GOTO branch
108
109 :ant-debug
110   SET ant_loglevel="-debug"
111   SHIFT
112   GOTO branch
113
114 :build-debug
115   SET bw_loglevel="-Dorg.bedework.build.inform=true -Dorg.bedework.build.noisy=true -Dorg.bedework.build.debug=true "
116   SHIFT
117   GOTO branch
118      
119 :: PROJECTS
120
121 :carddav
122   SET carddav="yes"
123   SET pkgdefault=
124   SHIFT
125   GOTO branch
126  
127 :caldav
128   SET caldav="yes"
129   SET pkgdefault=
130   SHIFT
131   GOTO branch
132  
133 :client
134   SET client="yes"
135   SET pkgdefault=
136   SHIFT
137   GOTO branch
138  
139 :webdav
140   SET webdav="yes"
141   SET pkgdefault=
142   SHIFT
143   GOTO branch
144  
145 :monitor
146   SET monitor="yes"
147   SET pkgdefault=
148   SHIFT
149   GOTO branch
150
151 :naming
152   SET naming="yes"
153   SET pkgdefault=
154   SHIFT
155   GOTO branch
156  
157 :tzsvr
158   SET tzsvr="yes"
159   SET pkgdefault=
160   SHIFT
161   GOTO branch
162
163 :updateall
164   for %%p in ("%updateProjects%") do (
165     ECHO *************************************************************
166     ECHO Updating project %%p
167     ECHO *************************************************************
168    
169     svn update %%p
170   )
171
172   GOTO:EOF
173  
174 :reindex
175   ECHO     Calling the reindexer
176   SET INDEXER=%QUICKSTART_HOME%\bedework\dist\temp\shellscr\indexer
177
178   if exist %INDEXER% goto indexerok
179     ECHO The indexer directory %INDEXER% does not exist. You probably need to do a rebuild.
180     GOTO:EOF
181
182   :indexerok
183   cd %INDEXER%
184   bwrun.bat reindex-nostart -user admin -indexlocprefix ..\..\..\..\..\
185
186   GOTO:EOF
187
188 :zoneinfo
189    ECHO    zoneinfo target is not supported on Windows
190    GOTO:EOF
191    
192 :buildwebcache
193    cd %QUICKSTART_HOME%\cachedfeeder
194    buildWebCache.bat
195    GOTO:EOF
196
197 :deploywebcache
198   cd %QUICKSTART_HOME%\cachedfeeder
199   "%JAVA_HOME%\bin\java.exe" -classpath %CLASSPATH% -Dant.home="%ANT_HOME%" org.apache.tools.ant.launch.Launcher "%BWCONFIG%" deploy-webcache
200    GOTO:EOF
201    
202 :deployurlbuilder
203   cd %QUICKSTART_HOME%\cachedfeeder
204   "%JAVA_HOME%\bin\java.exe" -classpath %CLASSPATH% -Dant.home="%ANT_HOME%" org.apache.tools.ant.launch.Launcher "%BWCONFIG%" deploy-urlbuilder
205    GOTO:EOF
206    
207 :jbossNotice
208   ECHO *************************************************************
209   ECHO The jboss configuration has been removed from the quickstart.
210   ECHO It is now the default.  Remove the '-bwc jboss' option.
211   ECHO *************************************************************
212   GOTO:EOF
213
214 :doneWithArgs
215
216 IF "%bwc%" == "jboss" GOTO jbossNotice
217
218 IF NOT "%quickstart%empty" == "empty" GOTO checkBwConfig
219 IF NOT "%BWCONFIGS%empty" == "empty" GOTO DoneQB
220 SET BWCONFIGS=%HOMEPATH%\bwbuild
221 GOTO doneQB
222
223 :checkBwConfig
224
225   SET BWCONFIGS=%QUICKSTART_HOME%\bedework\config\bwbuild
226
227 :doneQB
228   SET BEDEWORK_CONFIGS_HOME=%BWCONFIGS%
229   SET BEDEWORK_CONFIG=%BWCONFIGS%\%bwc%
230
231   IF EXIST "%BEDEWORK_CONFIGS_HOME%\.platform" GOTO foundDotPlatform
232   ECHO *******************************************************
233   ECHO Error: Configurations directory %BEDEWORK_CONFIGS_HOME%
234   ECHO is missing directory '.platform'.
235   ECHO *******************************************************
236   GOTO:EOF
237 :foundDotPlatform
238
239   IF EXIST "%BEDEWORK_CONFIG%\build.properties" GOTO foundBuildProperties
240   ECHO *******************************************************
241   ECHO Error: Configuration %BEDEWORK_CONFIG%
242   ECHO does not exist or is not a Bedework configuration.
243   ECHO *******************************************************
244   GOTO:EOF
245 :foundBuildProperties
246
247   IF NOT "%JAVA_HOME%empty"=="empty" GOTO javaOk
248   ECHO *******************************************************
249   ECHO Error: JAVA_HOME is not defined correctly for Bedework.
250   ECHO *******************************************************
251   GOTO:EOF
252 :javaOk
253
254 :runBedework
255   :: Make available for ant
256   SET BWCONFIG=-Dorg.bedework.user.build.properties=%BEDEWORK_CONFIG%\build.properties
257
258   ECHO.
259   ECHO     BWCONFIGS = %BWCONFIGS%
260   ECHO     BWCONFIG = %BWCONFIG%
261
262   IF NOT "%caldav%empty" == "empty"  cd %QUICKSTART_HOME%\bedework\projects\caldav
263   IF NOT "%carddav%empty" == "empty" cd %QUICKSTART_HOME%\bedework-carddav
264   IF NOT "%client%empty" == "empty"  cd %QUICKSTART_HOME%\bwclient
265   IF NOT "%monitor%empty" == "empty" cd %QUICKSTART_HOME%\MonitorApp
266   IF NOT "%naming%empty" == "empty"  cd %QUICKSTART_HOME%\bwnaming
267   IF NOT "%tzsvr%empty" == "empty"   cd %QUICKSTART_HOME%\bwtzsvr
268   IF NOT "%webdav%empty" == "empty"  cd %QUICKSTART_HOME%\bedework\projects\webdav
269
270   ECHO     WORKING DIRECTORY = %cd%
271   ECHO     COMMAND =  "%JAVA_HOME%\bin\java.exe" -classpath %CLASSPATH% %offline% -Dant.home="%ANT_HOME%" org.apache.tools.ant.launch.Launcher "%BWCONFIG%" %ant_listener% %ant_logger% %ant_loglevel% %bw_loglevel% %1
272   ECHO.
273   ECHO.
274   "%JAVA_HOME%\bin\java.exe" -classpath %CLASSPATH% %offline% -Dant.home="%ANT_HOME%" org.apache.tools.ant.launch.Launcher "%BWCONFIG%" %ant_listener% %ant_logger% %ant_loglevel% %bw_loglevel% %1
275
276   GOTO:EOF
277
278
279 :: Iterate over the command line arguments;
280 :: DOS Batch labels can't contain hyphens, so convert them
281 :: (otherwise, we could just "GOTO %1")
282 :branch
283 IF "%1" == "-quickstart" GOTO quickstart
284 IF "%1" == "-bwchome" GOTO bwchome
285 IF "%1" == "-bwc" GOTO bwc
286 IF "%1" == "-offline" GOTO offline
287 IF "%1" == "-updateall" GOTO updateall
288 IF "%1" == "-reindex" GOTO reindex
289 IF "%1" == "-zoneinfo" GOTO zoneinfo
290 IF "%1" == "-buildwebcache" GOTO buildwebcache
291 IF "%1" == "-deploywebcache" GOTO deploywebcache
292 IF "%1" == "-deployurlbuilder" GOTO deployurlbuilder
293
294 IF "%1" == "-log-silent" GOTO log-silent
295 IF "%1" == "-log-quiet" GOTO log-quiet
296 IF "%1" == "-log-inform" GOTO log-inform
297 IF "%1" == "-log-verbose" GOTO log-verbose
298 IF "%1" == "-ant-debug" GOTO ant-debug
299 IF "%1" == "-build-debug" GOTO build-debug
300
301 IF "%1" == "-carddav" GOTO carddav
302 IF "%1" == "-caldav" GOTO caldav
303 IF "%1" == "-client" GOTO client
304 IF "%1" == "-webdav" GOTO webdav
305 IF "%1" == "-monitor" GOTO monitor
306 IF "%1" == "-naming" GOTO naming
307 IF "%1" == "-tzsvr" GOTO tzsvr
308 GOTO doneWithArgs
309
310 :usage
311   ECHO    Usage:
312   ECHO.
313   ECHO    bw ACTION
314   ECHO    bw [CONFIG-SOURCE] [CONFIG] [PROJECT] [ -offline ] [ target ]
315   ECHO.
316   ECHO    Where:
317   ECHO.
318   ECHO   ACTION defines an action to take usually in the context of the quickstart.
319   ECHO    In a deployed system many of these actions are handled directly by a
320   ECHO    deployed application. ACTION may be one of
321   ECHO      -updateall  Does an svn update of all projects"
322   ECHO      -reindex    runs the indexer directly out of the quickstart bedework
323   ECHO                  dist directory to rebuild the lucene indexes
324 REM   Don't support zoneinfo command on Windows for now
325 REM   ECHO      -zoneinfo - builds zoneinfo data for the timezones server
326 REM   ECHO                  requires -version and -tzdata parameters
327   ECHO      -buildwebcache    builds webcache
328   ECHO      -deploywebcache   deploys webcache
329   ECHO      -deployurlbuilder deploys url/widget builder
330   ECHO.
331   ECHO    CONFIG-SOURCE optionally defines the location of configurations and is one or none of
332   ECHO     -quickstart      to use the configurations within the quickstart
333   ECHO                      e.g. "bw -quickstart start"
334   ECHO     -bwchome path    to specify the location of the bwbuild directory
335   ECHO.
336   ECHO     The default is to look in the user home for the "bwbuild" directory.
337   ECHO.
338   ECHO    CONFIG optionally defines the configuration to build
339   ECHO      -bwc configname      e.g. "-bwc mysql"
340   ECHO.
341   ECHO    -offline     Build without attempting to retrieve library jars
342   ECHO    target       Ant target to execute (e.g. "start")
343   ECHO.
344   ECHO.
345   ECHO.
346   ECHO    PROJECT optionally defines the package to build and is none or more of
347   ECHO     -carddav     Target is for the CardDAV build
348   ECHO     -monitor     Target is for the bedework monitor application
349   ECHO     -naming      Target is for the abstract naming api
350   ECHO     The default is a calendar build
351   ECHO.
352   ECHO    Invokes ant to build or deploy the Bedework system. Uses a configuration
353   ECHO    directory which contains one directory per configuration.
354   ECHO.
355   ECHO    Within each configuration directory we expect a file called
356   ECHO    build.properties which should point to the property and options file
357   ECHO    needed for the deploy process.
358   ECHO.
359   ECHO    In general these files will be in the same directory as build.properties.
360   ECHO    The environment variable BEDEWORK_CONFIG contains the path to the current
361   ECHO    configuration directory and can be used to build a path to the other files.
362   ECHO.
363   ECHO.
364   ECHO.
Note: See TracBrowser for help on using the browser.