source: release-kits/lirk3/ant-scripts/init.xml@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 14 years ago

initial import of LiRK3

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