root/releases/bedework-3.6/build/quickstart/windows/bw.bat

Revision 2752 (checked in by johnsa, 3 years ago)

DONE 496: Port bw and runjboss script to Windows
http://www.bedework.org/trac/bedework/ticket/496

  • 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 SET CLASSPATH=%CLASSPATH%;"%QUICKSTART_HOME%\bedework\applib\log4j-1.2.8.jar"
23
24 :: Default some parameters
25 SET BWCONFIGS=
26 SET bwc=default
27 SET BWCONFIG=
28 SET offline=
29 SET quickstart=
30
31 :: Projects we will build
32 SET pkgdefault=yes
33 SET bedework=
34 SET carddav=
35 SET caldav=
36 SET client=
37 SET monitor=
38 SET naming=
39 SET tzsvr=
40 SET webdav=
41
42 SET action=
43
44 :: check for command-line arguments and branch on them
45 IF "%1noargs" == "noargs" GOTO usage
46 GOTO branch
47
48 :quickstart
49   ECHO     Preparing quickstart build ...
50   SET quickstart="yes"
51   SHIFT
52   GOTO branch
53
54 :bwchome
55   :: Define location of configs
56   SHIFT
57   SET BWCONFIGS=%1
58   SHIFT
59   GOTO branch
60
61 :bwc
62   SHIFT
63   SET bwc=%1
64   SHIFT
65   GOTO branch
66
67 :offline
68   ECHO     Setting to offline mode; libraries will not be downloaded ...
69   SET offline="-Dorg.bedework.offline.build=yes"
70   SHIFT
71   GOTO branch
72  
73
74 :: PROJECTS
75
76 :carddav
77   SET carddav="yes"
78   SET pkgdefault=
79   SHIFT
80   GOTO branch
81  
82 :caldav
83   SET caldav="yes"
84   SET pkgdefault=
85   SHIFT
86   GOTO branch
87  
88 :client
89   SET client="yes"
90   SET pkgdefault=
91   SHIFT
92   GOTO branch
93  
94 :webdav
95   SET webdav="yes"
96   SET pkgdefault=
97   SHIFT
98   GOTO branch
99  
100 :monitor
101   SET monitor="yes"
102   SET pkgdefault=
103   SHIFT
104   GOTO branch
105
106 :naming
107   SET naming="yes"
108   SET pkgdefault=
109   SHIFT
110   GOTO branch
111  
112 :tzsvr
113   SET tzsvr="yes"
114   SET pkgdefault=
115   SHIFT
116   GOTO branch
117
118 :reindex
119   ECHO     Calling the reindexer
120   SET INDEXER=%QUICKSTART_HOME%\bedework\dist\temp\shellscr\indexer
121
122   if exist %INDEXER% goto indexerok
123     ECHO The indexer directory %INDEXER% does not exist. You probably need to do a rebuild.
124     GOTO:EOF
125
126   :indexerok
127   cd %INDEXER%
128   bwrun.bat reindex-nostart -user admin -indexlocprefix ..\..\..\..\..\
129
130   GOTO:EOF
131
132 :zoneinfo
133    ECHO    zoneinfo target is not supported on Windows
134    GOTO:EOF
135
136 :doneWithArgs
137
138 IF NOT "%quickstart%empty" == "empty" GOTO checkBwConfig
139 IF NOT "%BWCONFIGS%empty" == "empty" GOTO DoneQB
140 SET BWCONFIGS=%HOMEPATH%\bwbuild
141 GOTO doneQB
142
143 :checkBwConfig
144 REM  IF "%BWCONFIGS%empty" == "empty" GOTO doneQB
145 REM    ECHO *******************************************************
146 REM    ECHO Error: Cannot specify both -quickstart and -bwchome
147 REM    ECHO *******************************************************
148 REM    GOTO:EOF
149
150   SET BWCONFIGS=%QUICKSTART_HOME%\bedework\config\bwbuild
151
152 :doneQB
153   SET BEDEWORK_CONFIGS_HOME=%BWCONFIGS%
154   SET BEDEWORK_CONFIG=%BWCONFIGS%\%bwc%
155
156   IF EXIST "%BEDEWORK_CONFIG%\build.properties" GOTO foundBuildProperties
157   ECHO *******************************************************
158   ECHO Error: Configuration %BEDEWORK_CONFIG%
159   ECHO does not exist or is not a Bedework configuration.
160   ECHO *******************************************************
161   GOTO:EOF
162 :foundBuildProperties
163
164   IF NOT "%JAVA_HOME%empty"=="empty" GOTO javaOk
165   ECHO *******************************************************
166   ECHO Error: JAVA_HOME is not defined correctly for Bedework.
167   ECHO *******************************************************
168   GOTO:EOF
169 :javaOk
170
171 :runBedework
172   :: Make available for ant
173   SET BWCONFIG=-Dorg.bedework.user.build.properties=%BEDEWORK_CONFIG%\build.properties
174
175   ECHO.
176   ECHO     BWCONFIGS = %BWCONFIGS%
177   ECHO     BWCONFIG = %BWCONFIG%
178   ECHO.
179
180   IF NOT "%caldav%empty" == "empty"  cd %QUICKSTART_HOME%\bedework\projects\caldav
181   IF NOT "%carddav%empty" == "empty" cd %QUICKSTART_HOME%\bedework-carddav
182   IF NOT "%client%empty" == "empty"  cd %QUICKSTART_HOME%\bwclient
183   IF NOT "%monitor%empty" == "empty" cd %QUICKSTART_HOME%\MonitorApp
184   IF NOT "%naming%empty" == "empty"  cd %QUICKSTART_HOME%\bwnaming
185   IF NOT "%tzsvr%empty" == "empty"   cd %QUICKSTART_HOME%\bwtzsvr
186   IF NOT "%webdav%empty" == "empty"  cd %QUICKSTART_HOME%\bedework\projects\webdav
187
188   "%JAVA_HOME%\bin\java.exe" -classpath %CLASSPATH% %offline% -Dant.home="%ANT_HOME%" org.apache.tools.ant.launch.Launcher "%BWCONFIG%" %1
189
190   GOTO:EOF
191
192
193 :: Iterate over the command line arguments;
194 :: DOS Batch labels can't contain hyphens, so convert them
195 :: (otherwise, we could just "GOTO %1")
196 :branch
197 IF "%1" == "-quickstart" GOTO quickstart
198 IF "%1" == "-bwchome" GOTO bwchome
199 IF "%1" == "-bwc" GOTO bwc
200 IF "%1" == "-offline" GOTO offline
201 IF "%1" == "-reindex" GOTO reindex
202 IF "%1" == "-zoneinfo" GOTO zoneinfo
203 IF "%1" == "-carddav" GOTO carddav
204 IF "%1" == "-caldav" GOTO caldav
205 IF "%1" == "-client" GOTO client
206 IF "%1" == "-webdav" GOTO webdav
207 IF "%1" == "-monitor" GOTO monitor
208 IF "%1" == "-naming" GOTO naming
209 IF "%1" == "-tzsvr" GOTO tzsvr
210 GOTO doneWithArgs
211
212 :usage
213   ECHO    Usage:
214   ECHO.
215   ECHO    bw [CONFIG-SOURCE] [CONFIG] [PROJECT] [ -offline ] [ target ]
216   ECHO    bw ACTION
217   ECHO.
218   ECHO    Where:
219   ECHO.
220   ECHO    CONFIG-SOURCE optionally defines the location of configurations and is one or none of
221   ECHO     -quickstart      to use the configurations within the quickstart
222   ECHO                      e.g. "bw -quickstart start"
223   ECHO     -bwchome path    to specify the location of the bwbuild directory
224   ECHO.
225   ECHO     The default is to look in the user home for the "bwbuild" directory.
226   ECHO.
227   ECHO    CONFIG optionally defines the configuration to build
228   ECHO      -bwc configname      e.g. "-bwc mysql"
229   ECHO.
230   ECHO    -offline     Build without attempting to retrieve library jars
231   ECHO    target       Ant target to execute (e.g. "start")
232   ECHO.
233   ECHO.
234   ECHO.
235   ECHO    PROJECT optionally defines the package to build and is none or more of
236   ECHO     -carddav     Target is for the CardDAV build
237   ECHO     -monitor     Target is for the bedework monitor application
238   ECHO     -naming      Target is for the abstract naming api
239   ECHO     The default is a calendar build
240   ECHO.
241   ECHO    Invokes ant to build or deploy the Bedework system. Uses a configuration
242   ECHO    directory which contains one directory per configuration.
243   ECHO.
244   ECHO    Within each configuration directory we expect a file called
245   ECHO    build.properties which should point to the property and options file
246   ECHO    needed for the deploy process.
247   ECHO.
248   ECHO    In general these files will be in the same directory as build.properties.
249   ECHO    The environment variable BEDEWORK_CONFIG contains the path to the current
250   ECHO    configuration directory and can be used to build a path to the other files.
251   ECHO.
252   ECHO   ACTION defines an action to take usually in the context of the quickstart.
253   ECHO    In a deployed system many of these actions are handled directly by a
254   ECHO    deployed application. ACTION may be one of
255   ECHO      -reindex - runs the indexer directly out of the quickstart bedework
256   ECHO                 dist directory to rebuild the lucene indexes
257 REM   Don't support zoneinfo command on Windows for now
258 REM   ECHO      -zoneinfo - builds zoneinfo data for the timezones server
259 REM   ECHO                  requires -version and -tzdata parameters
260   ECHO.
261   ECHO.
262   ECHO.
Note: See TracBrowser for help on using the browser.