1 | <?xml version="1.0" encoding="utf-8" ?>
|
---|
2 |
|
---|
3 | <!--
|
---|
4 | ..........................................................
|
---|
5 | September 2007
|
---|
6 | Greenstone3 'release maker' script
|
---|
7 | Oran Fry
|
---|
8 | ..........................................................
|
---|
9 | -->
|
---|
10 |
|
---|
11 | <project name="wirk3-init">
|
---|
12 |
|
---|
13 | <!-- classpath -->
|
---|
14 | <path id="project.classpath">
|
---|
15 | <fileset dir="${wirk3.home}/ant-scripts/tasks">
|
---|
16 | <include name="**/*.jar"/>
|
---|
17 | </fileset>
|
---|
18 | <fileset dir="${wirk3.home}/lib">
|
---|
19 | <include name="*.jar"/>
|
---|
20 | </fileset>
|
---|
21 |
|
---|
22 | <pathelement path="${wirk3.home}/ant-scripts/tasks/orans"/>
|
---|
23 |
|
---|
24 | <!-- antinstaller -->
|
---|
25 | <pathelement path="${wirk3.home}/bin/ant-installer/lib/ant-installer-ext.jar"/>
|
---|
26 |
|
---|
27 | <!-- launch4j -->
|
---|
28 | <pathelement path="${wirk3.home}/bin/launch4j/launch4j.jar"/>
|
---|
29 | <pathelement path="${wirk3.home}/bin/launch4j/lib/xstream.jar"/>
|
---|
30 |
|
---|
31 | </path>
|
---|
32 |
|
---|
33 | <!-- create a localised basedir property -->
|
---|
34 | <path id="basedir.path">
|
---|
35 | <pathelement location="${basedir}"/>
|
---|
36 | </path>
|
---|
37 | <property name="basedir.local" refid="basedir.path"/>
|
---|
38 |
|
---|
39 | <!-- svn root -->
|
---|
40 | <property name="svn.root" value="http://svn.greenstone.org"/>
|
---|
41 |
|
---|
42 | <!-- self defined tasks -->
|
---|
43 | <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="project.classpath"/>
|
---|
44 | <taskdef name="try" classname="ise.antelope.tasks.TryTask" classpathref="project.classpath"/>
|
---|
45 | <taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" classpathref="project.classpath"/>
|
---|
46 | <taskdef name="setloglevel" classname="SetLogLevel" classpathref="project.classpath"/>
|
---|
47 | <typedef name="addressedcall" classname="TreeCallTarget" classpathref="project.classpath"/>
|
---|
48 | <typedef name="rsr" classname="RegexSearchReplace" classpathref="project.classpath"/>
|
---|
49 | <taskdef name="installer" classname="org.tp23.antinstaller.taskdefs.Installer" classpathref="project.classpath"/>
|
---|
50 | <taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask" classpathref="project.classpath"/>
|
---|
51 |
|
---|
52 | <!-- load in static properties from build.properties -->
|
---|
53 | <property file="build.properties" />
|
---|
54 |
|
---|
55 | <!-- project details (for ant-installer) -->
|
---|
56 | <property name="project.name" value="Greenstone3"/>
|
---|
57 | <property name="project.short.name" value="greenstone3"/>
|
---|
58 | <property name="project.path" value="${basedir}/distribution/greenstone3"/>
|
---|
59 | <property name="project.installer.path" value="${wirk3.home}/installer"/>
|
---|
60 | <property name="project.version" value="${version}"/>
|
---|
61 | <property name="ant.installer.home" value="${wirk3.home}/bin/ant-installer"/>
|
---|
62 |
|
---|
63 | <!-- somewhere to store temporary text -->
|
---|
64 | <tempfile property="temp.file" destdir="${java.io.tmpdir}" prefix="delete" suffix=".tmp"/>
|
---|
65 |
|
---|
66 | <!-- stuff to do before all tasks -->
|
---|
67 | <target name="init">
|
---|
68 |
|
---|
69 | <echo level="info">CHECKING PRE-CONDITIONS</echo>
|
---|
70 | <echo level="info"/>
|
---|
71 |
|
---|
72 | <!-- version number -->
|
---|
73 | <echo level="info">Version number...</echo>
|
---|
74 | <if>
|
---|
75 | <bool>
|
---|
76 | <not><isset property="version"/></not>
|
---|
77 | </bool>
|
---|
78 |
|
---|
79 | <!-- version not set in build.properties, try get from repository -->
|
---|
80 | <setloglevel level="error"/>
|
---|
81 | <try>
|
---|
82 | <get src="${svn.root}/greenstone3/${branch.path}/version.properties" dest="${temp.file}"/>
|
---|
83 | <catch>
|
---|
84 | <echo level="error">Not set in build.properties or repository version.properties</echo>
|
---|
85 | <fail>Version number not set</fail>
|
---|
86 | </catch>
|
---|
87 | </try>
|
---|
88 | <setloglevel level="info"/>
|
---|
89 |
|
---|
90 | <property file="${temp.file}"/>
|
---|
91 |
|
---|
92 | <if>
|
---|
93 | <bool>
|
---|
94 | <not><isset property="version"/></not>
|
---|
95 | </bool>
|
---|
96 | <echo level="error">version.properties exists, but doesn't set version string</echo>
|
---|
97 | <fail>Version number not set</fail>
|
---|
98 | </if>
|
---|
99 |
|
---|
100 | <echo level="info">Taken from repository version.properties</echo>
|
---|
101 |
|
---|
102 | <else>
|
---|
103 | <echo level="info">Taken from build.properties</echo>
|
---|
104 | </else>
|
---|
105 |
|
---|
106 | </if>
|
---|
107 |
|
---|
108 | <echo level="info">Version number: ${version}</echo>
|
---|
109 | <property name="app.version" value="${version}"/>
|
---|
110 | <echo level="info"/>
|
---|
111 |
|
---|
112 |
|
---|
113 | <!-- check resume from -->
|
---|
114 | <echo level="info">Checking if we are resuming from a given target...</echo>
|
---|
115 | <if>
|
---|
116 | <bool><not><isset property="resume.from"/></not></bool>
|
---|
117 | <echo level="info">No, start from the beginning</echo>
|
---|
118 | <else>
|
---|
119 | <echo level="info">Yes, resuming from ${resume.from}</echo>
|
---|
120 | </else>
|
---|
121 | </if>
|
---|
122 | <echo level="info"/>
|
---|
123 |
|
---|
124 | <!-- check resume to -->
|
---|
125 | <echo level="info">Checking if we are resuming up to a given target...</echo>
|
---|
126 | <if>
|
---|
127 | <bool><not><isset property="resume.to"/></not></bool>
|
---|
128 | <echo level="info">No, stop at the end</echo>
|
---|
129 | <else>
|
---|
130 | <echo level="info">Yes, resuming from ${resume.to}</echo>
|
---|
131 | </else>
|
---|
132 | </if>
|
---|
133 | <echo level="info"/>
|
---|
134 |
|
---|
135 |
|
---|
136 | <!-- check resume mode-->
|
---|
137 | <echo level="info">Determining resume mode...</echo>
|
---|
138 | <if>
|
---|
139 | <bool>
|
---|
140 | <not><isset property="resume.mode"/></not>
|
---|
141 | </bool>
|
---|
142 | <echo level="info">Mode not set, just fall through</echo>
|
---|
143 | <else>
|
---|
144 | <echo level="info">Mode set to ${resume.mode}</echo>
|
---|
145 | <if>
|
---|
146 | <bool>
|
---|
147 | <not><equals arg1="${resume.mode}" arg2="descend"/></not>
|
---|
148 | </bool>
|
---|
149 | <echo level="error">You have not specified a valid resume mode.</echo>
|
---|
150 | <echo level="error">Valid modes are 'descend' and null.</echo>
|
---|
151 | <fail>You have not specified a valid resume mode.</fail>
|
---|
152 | </if>
|
---|
153 | </else>
|
---|
154 | </if>
|
---|
155 | <echo level="info"/>
|
---|
156 |
|
---|
157 | <!-- execute target code or just traverse tree -->
|
---|
158 | <echo level="info">Determining execute mode...</echo>
|
---|
159 | <if>
|
---|
160 | <bool>
|
---|
161 | <not><isset property="execute"/></not>
|
---|
162 | </bool>
|
---|
163 | <echo level="info">Execute not set, defaulting to 'true'</echo>
|
---|
164 | <property name="execute" value="true"/>
|
---|
165 | <else>
|
---|
166 | <echo level="info">Execute set to ${execute}</echo>
|
---|
167 | <if>
|
---|
168 | <bool>
|
---|
169 | <and>
|
---|
170 | <not><equals arg1="${execute}" arg2="true"/></not>
|
---|
171 | <not><equals arg1="${execute}" arg2="false"/></not>
|
---|
172 | </and>
|
---|
173 | </bool>
|
---|
174 | <echo level="error">You have not specified a valid value for execute.</echo>
|
---|
175 | <echo level="error">Valid values are 'true' and 'false'.</echo>
|
---|
176 | <fail>You have not specified a valid value for execute.</fail>
|
---|
177 | </if>
|
---|
178 | </else>
|
---|
179 | </if>
|
---|
180 |
|
---|
181 | <echo level="info"/>
|
---|
182 |
|
---|
183 |
|
---|
184 | <!-- check branch.path -->
|
---|
185 | <echo level="info">Determining the branch path...</echo>
|
---|
186 | <if>
|
---|
187 | <bool><equals arg1="trunk" arg2="${version}"/></bool>
|
---|
188 | <property name="branch.path" value="trunk"/>
|
---|
189 | </if>
|
---|
190 |
|
---|
191 | <if>
|
---|
192 | <bool><not><isset property="branch.path"/></not></bool>
|
---|
193 | <fail>You have not specified a branch path where code will come from in the repository</fail>
|
---|
194 | </if>
|
---|
195 |
|
---|
196 | <echo level="info">Branch Path: ${branch.path}</echo>
|
---|
197 | <echo level="info"/>
|
---|
198 |
|
---|
199 | <!-- check branches exist -->
|
---|
200 | <property name="svn.greenstone3" value="${svn.root}/greenstone3/${branch.path}"/>
|
---|
201 | <property name="svn.gsdl" value="${svn.root}/gsdl/${branch.path}"/>
|
---|
202 | <property name="svn.gli" value="${svn.root}/gli/${branch.path}"/>
|
---|
203 | <property name="svn.indexers" value="${svn.root}/indexers/${branch.path}"/>
|
---|
204 | <property name="svn.documentation" value="${svn.root}/documentation/${branch.path}"/>
|
---|
205 |
|
---|
206 | <!-- greenstone3 branch -->
|
---|
207 | <echo level="info">Checking that ${svn.greenstone3} exists...</echo>
|
---|
208 |
|
---|
209 | <!-- try to put the html index of the location into the temp file -->
|
---|
210 | <setloglevel level="error"/>
|
---|
211 | <try>
|
---|
212 | <get src="${svn.greenstone3}" dest="${temp.file}"/>
|
---|
213 | <catch>
|
---|
214 | <echo level="error">No, it does not exist</echo>
|
---|
215 | <property name="svn.greenstone3.unavailable" value="true"/>
|
---|
216 | </catch>
|
---|
217 | </try>
|
---|
218 | <setloglevel level="info"/>
|
---|
219 | <if>
|
---|
220 | <bool><not><istrue value="${svn.greenstone3.unavailable}"/></not></bool>
|
---|
221 | <echo level="info">Yes, it exists</echo>
|
---|
222 | </if>
|
---|
223 |
|
---|
224 | <!-- gsdl branch -->
|
---|
225 | <echo level="info">Checking that ${svn.gsdl} exists...</echo>
|
---|
226 | <setloglevel level="error"/>
|
---|
227 | <try>
|
---|
228 | <get src="${svn.gsdl}" dest="${temp.file}"/>
|
---|
229 | <catch>
|
---|
230 | <echo level="error">No, it does not exist</echo>
|
---|
231 | <property name="svn.gsdl.unavailable" value="true"/>
|
---|
232 | </catch>
|
---|
233 | </try>
|
---|
234 | <setloglevel level="info"/>
|
---|
235 | <if>
|
---|
236 | <bool><not><istrue value="${svn.gsdl.unavailable}"/></not></bool>
|
---|
237 | <echo level="info">Yes, it exists</echo>
|
---|
238 | </if>
|
---|
239 |
|
---|
240 |
|
---|
241 | <!-- gli branch -->
|
---|
242 | <echo level="info">Checking that ${svn.gli} exists...</echo>
|
---|
243 | <!-- try to put the html index of the location into the temp file -->
|
---|
244 | <setloglevel level="error"/>
|
---|
245 | <try>
|
---|
246 | <get src="${svn.gli}" dest="${temp.file}"/>
|
---|
247 | <catch>
|
---|
248 | <echo level="error">No, does not exist</echo>
|
---|
249 | <property name="svn.gli.unavailable" value="true"/>
|
---|
250 | </catch>
|
---|
251 | </try>
|
---|
252 | <setloglevel level="info"/>
|
---|
253 | <if>
|
---|
254 | <bool><not><istrue value="${svn.gli.unavailable}"/></not></bool>
|
---|
255 | <echo level="info">Yes, it exists</echo>
|
---|
256 | </if>
|
---|
257 |
|
---|
258 |
|
---|
259 | <!-- indexers branch -->
|
---|
260 | <echo level="info">Checking that ${svn.indexers} exists...</echo>
|
---|
261 | <!-- try to put the html index of the location into the temp file -->
|
---|
262 | <setloglevel level="error"/>
|
---|
263 | <try>
|
---|
264 | <get src="${svn.indexers}" dest="${temp.file}"/>
|
---|
265 | <catch>
|
---|
266 | <echo level="error">No, it does not exist</echo>
|
---|
267 | <property name="svn.indexers.unavailable" value="true"/>
|
---|
268 | </catch>
|
---|
269 | </try>
|
---|
270 | <setloglevel level="info"/>
|
---|
271 | <if>
|
---|
272 | <bool><not><istrue value="${svn.indexers.unavailable}"/></not></bool>
|
---|
273 | <echo level="info">Yes, it exists</echo>
|
---|
274 | </if>
|
---|
275 |
|
---|
276 | <!-- documentation branch -->
|
---|
277 | <echo level="info">Checking that ${svn.documentation} exists...</echo>
|
---|
278 | <!-- try to put the html index of the location into the temp file -->
|
---|
279 | <setloglevel level="error"/>
|
---|
280 | <try>
|
---|
281 | <get src="${svn.documentation}" dest="${temp.file}"/>
|
---|
282 | <catch>
|
---|
283 | <echo level="error">No, it does not exist</echo>
|
---|
284 | <property name="svn.documentation.unavailable" value="true"/>
|
---|
285 | </catch>
|
---|
286 | </try>
|
---|
287 | <setloglevel level="info"/>
|
---|
288 | <if>
|
---|
289 | <bool><not><istrue value="${svn.documentation.unavailable}"/></not></bool>
|
---|
290 | <echo level="info">Yes, it exists</echo>
|
---|
291 | </if>
|
---|
292 |
|
---|
293 |
|
---|
294 | <!-- clean up the temp file -->
|
---|
295 | <setloglevel level="error"/>
|
---|
296 | <delete file="${temp.file}"/>
|
---|
297 | <setloglevel level="info"/>
|
---|
298 |
|
---|
299 |
|
---|
300 | <!-- fail if some branches were missing -->
|
---|
301 | <if>
|
---|
302 | <bool>
|
---|
303 | <or>
|
---|
304 | <istrue value="${svn.greenstone3.unavailable}"/>
|
---|
305 | <istrue value="${svn.gsdl.unavailable}"/>
|
---|
306 | <istrue value="${svn.gli.unavailable}"/>
|
---|
307 | <istrue value="${svn.indexers.unavailable}"/>
|
---|
308 | <istrue value="${svn.documentation.unavailable}"/>
|
---|
309 | </or>
|
---|
310 | </bool>
|
---|
311 | <fail>Some branches do not exist, or you are unable to access them from where you are. Please review the list above and create any branches that are missing, or run this script from somewhere with access to the repository.</fail>
|
---|
312 | <else>
|
---|
313 | <echo level="info">All exist</echo>
|
---|
314 | </else>
|
---|
315 | </if>
|
---|
316 |
|
---|
317 | </target>
|
---|
318 |
|
---|
319 | </project>
|
---|