source: main/trunk/release-kits/shared/core/ant-scripts/shared.xml@ 21648

Last change on this file since 21648 was 21648, checked in by oranfry, 13 years ago

tidy-ups

File size: 18.5 KB
Line 
1<?xml version="1.0" encoding="utf-8" ?>
2<project name="rk-init">
3
4 <!-- CHECK PRE-CONDITIONS -->
5 <target name="init">
6
7 <!-- load in static properties from build.properties -->
8 <property file="${rk.name}-build.properties" />
9
10 <!-- CONSTANTS (overridable in build.properties) -->
11
12 <!-- svn root -->
13 <property name="svn.root" value="http://svn.greenstone.org" />
14
15 <!-- default revision and branch path -->
16 <property name="branch.path" value="trunk" />
17 <property name="branch.revision" value="HEAD" />
18
19 <!-- the minimum version of java which the installer should be run with (this gets used in search4j) -->
20 <property name="java.min.version" value="1.4.0_00"/>
21
22 <!-- create a localised basedir property -->
23 <path id="basedir.path"><pathelement location="${basedir}"/></path>
24 <property name="basedir.local" refid="basedir.path"/>
25
26 <!-- size of resource chunks (windows wrapper) -->
27 <property name="resources.chunksize" value="8388608"/>
28
29 <!-- the extra space for the dmg image in KB (mac wrapper) -->
30 <property name="dmg.overhead" value="2048"/>
31
32 <!-- current date and time -->
33 <tstamp>
34 <format property="current.month" pattern="MMM"/>
35 <format property="current.year" pattern="yyyy"/>
36 <format property="date" pattern="yyyy.MM.dd"/>
37 </tstamp>
38
39 <!-- BUNDLED JAVA INFO -->
40 <!-- the bundled javas are kept in shared/linux/wrapper and shared/windows/wrapper in the repository -->
41 <!-- change this info when the bundled version changes -->
42 <property name="java.extracted" value="jre"/> <!-- set this to the name of the top level directory in the above archive -->
43
44 <!-- linux -->
45 <property name="linux-java.installer" value="jre_bin"/>
46 <property name="bundled.version.linux-java" value="1.6.0_05"/> <!-- set this to the version number of java in the above archive -->
47 <property name="component.bytesize.linux-java" value="101245987"/> <!-- set this to the size of the extract archive -->
48
49 <!-- windows -->
50 <property name="windows-java.installer" value="jre.exe"/>
51 <property name="bundled.version.windows-java" value="1.6.0_07"/> <!-- set this to the version number of java in the above archive -->
52 <property name="component.bytesize.windows-java" value="75000000"/> <!-- set this to the size of the extract archive -->
53
54 <!-- version numbers of other bundled things -->
55 <property name="bundled.version.imagemagick" value="6.4.3"/>
56 <property name="bundled.version.ghostscript" value="8.63"/>
57 <property name="bundled.version.tomcat" value="6.0.20"/>
58
59 <!-- CLASSPATH -->
60 <path id="project.classpath">
61
62 <!-- our classes -->
63 <fileset dir="${rk.home}/shared/core">
64 <include name="ant-tasks/antelope/AntelopeTasks_3.4.2.jar"/>
65 <include name="ant-tasks/orangevolt/roxes-win32forjava-1.1.1.jar"/>
66 <include name="ant-tasks/orangevolt/orangevolt-ant-tasks-1.3.8.jar"/>
67 <include name="ant-tasks/greenstone/anttasks.jar"/>
68 <include name="ant-tasks/7z-ant/7z.jar"/>
69 <include name="lib/crypt.jar"/>
70 <include name="lib/serializer.jar"/>
71 <include name="lib/xalan.jar"/>
72 <include name="lib/xercesImpl.jar"/>
73 <include name="lib/xml-apis.jar"/>
74 <include name="ant-installer/lib/ant-installer-ext.jar"/>
75 <include name="ant-installer/lib/ant-installer.jar"/>
76 </fileset>
77
78 </path>
79
80 <!-- SELF DEFINED TASKS AND TYPES -->
81 <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="project.classpath"/>
82 <taskdef name="try" classname="ise.antelope.tasks.TryTask" classpathref="project.classpath"/>
83 <taskdef name="math" classname="ise.antelope.tasks.MathTask" classpathref="project.classpath"/>
84 <taskdef name="sevenzip" classname="org.apache.tools.ant.SevenZip" classpathref="project.classpath"/>
85 <taskdef name="installer" classname="org.tp23.antinstaller.taskdefs.Installer" classpathref="project.classpath"/>
86 <typedef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="project.classpath"/>
87 <typedef name="dcff" classname="org.greenstone.anttasks.DeleteChunkFromFile" classpathref="project.classpath"/>
88 <typedef name="rsplit" classname="org.greenstone.anttasks.SplitResource" classpathref="project.classpath"/>
89 <typedef name="get-property-value" classname="org.greenstone.anttasks.GetPropertyValue" classpathref="project.classpath"/>
90
91 <!-- DATES IN DIFFERENT LANGUAGES -->
92 <get-property-value propertiesFile="${rk.home}/shared/core/lib/dates.properties" propertyName="ar.Dates.${current.month}" outputProperty="month.ar"/>
93 <get-property-value propertiesFile="${rk.home}/shared/core/lib/dates.properties" propertyName="ca.Dates.${current.month}" outputProperty="month.ca"/>
94 <get-property-value propertiesFile="${rk.home}/shared/core/lib/dates.properties" propertyName="el.Dates.${current.month}" outputProperty="month.el"/>
95 <get-property-value propertiesFile="${rk.home}/shared/core/lib/dates.properties" propertyName="es.Dates.${current.month}" outputProperty="month.es"/>
96 <get-property-value propertiesFile="${rk.home}/shared/core/lib/dates.properties" propertyName="fr.Dates.${current.month}" outputProperty="month.fr"/>
97 <get-property-value propertiesFile="${rk.home}/shared/core/lib/dates.properties" propertyName="lv.Dates.${current.month}" outputProperty="month.lv"/>
98 <get-property-value propertiesFile="${rk.home}/shared/core/lib/dates.properties" propertyName="mr.Dates.${current.month}" outputProperty="month.mr"/>
99 <get-property-value propertiesFile="${rk.home}/shared/core/lib/dates.properties" propertyName="ro.Dates.${current.month}" outputProperty="month.ro"/>
100 <get-property-value propertiesFile="${rk.home}/shared/core/lib/dates.properties" propertyName="ru.Dates.${current.month}" outputProperty="month.ru"/>
101 <get-property-value propertiesFile="${rk.home}/shared/core/lib/dates.properties" propertyName="vi.Dates.${current.month}" outputProperty="month.vi"/>
102 <get-property-value propertiesFile="${rk.home}/shared/core/lib/dates.properties" propertyName="zh.Dates.${current.month}" outputProperty="month.zh"/>
103 <get-property-value propertiesFile="${rk.home}/shared/core/lib/dates.properties" propertyName="default.Dates.${current.month}" outputProperty="month.default"/>
104
105
106 <!-- version number -->
107 <if><bool><not><isset property="version"/></not></bool>
108 <fail>Version number not set. Check that the file '${rk.name}-build.properties' exists and defines property 'version'.</fail>
109 </if>
110 <property name="app.version" value="${version}"/>
111
112 <!-- work out rk.os -->
113 <if>
114 <bool>
115 <or>
116 <equals arg1="${rk.os}" arg2="linux"/>
117 <equals arg1="${rk.os}" arg2="mac"/>
118 <equals arg1="${rk.os}" arg2="windows"/>
119 </or>
120 </bool>
121 <echo>Using user-specified value for rk.os: '${rk.os}'</echo>
122
123 <else><if>
124 <bool><equals arg1="${os.name}" arg2="Linux"/></bool>
125 <property name="rk.os" value="linux"/>
126
127 <else><if>
128 <bool><equals arg1="${os.name}" arg2="Mac OS X"/></bool>
129 <property name="rk.os" value="mac"/>
130
131 <else><if>
132 <bool>
133 <or>
134 <equals arg1="${os.name}" arg2="Windows 95"/>
135 <equals arg1="${os.name}" arg2="Windows 98"/>
136 <equals arg1="${os.name}" arg2="Windows 2000"/>
137 <equals arg1="${os.name}" arg2="Windows XP"/>
138 <equals arg1="${os.name}" arg2="Windows NT"/>
139 <equals arg1="${os.name}" arg2="Windows ME"/>
140 <equals arg1="${os.name}" arg2="Windows Vista"/>
141 </or>
142 </bool>
143 <property name="rk.os" value="windows"/>
144
145 <else>
146 <fail>Can't work out what to set rk.os to. Please report this to greenstone_team@cs.waikato.ac.nz . In the mean time, manually set rk.os to 'windows', 'mac', or 'linux' by reinvoking the release kit with, for example, '-Drk.os=windows'</fail>
147
148 </else></if></else></if></else></if></else></if>
149
150 <!-- set os.suffix and os.shell -->
151 <if><bool><equals arg1="${rk.os}" arg2="mac"/></bool>
152 <property name="os.suffix" value="MacOS-intel"/>
153 <property name="os.shell" value="darwin"/>
154 </if>
155 <property name="os.suffix" value="${rk.os}"/>
156 <property name="os.shell" value="${rk.os}"/>
157
158 <!-- set os.script.format -->
159 <if><bool><or><equals arg1="${rk.os}" arg2="linux"/><equals arg1="${rk.os}" arg2="mac"/></or></bool>
160 <property name="os.script.format" value="sh"/>
161 <else><if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
162 <property name="os.script.format" value="bat"/>
163 </if></else></if>
164
165 <!-- show important properties -->
166 <echo level="info">Version (version): ${version}</echo>
167 <echo level="info">Major Version (version.major): ${version.major}</echo>
168 <echo level="info">Branch Path (branch.path): ${branch.path}</echo>
169 <echo level="info">Date (date): ${date}</echo>
170 <echo level="info">Current Month (current.month): ${current.month}</echo>
171 <echo level="info">Current Year (current.year): ${current.year}</echo>
172 <echo level="info">Operating System (rk.os): ${rk.os}</echo>
173 <echo level="info">Operating System Suffix (os.suffix): ${os.suffix}</echo>
174 <echo level="info">Operating System Script format (os.script.format): ${os.script.format}</echo>
175 <echo level="info">Operating System Shell (os.shell): ${os.shell}</echo>
176 <!--
177 <echo level="info">Current Date</echo>
178 <echo level="info">ar: ${month.ar} ${current.year}</echo>
179 <echo level="info">ca: ${month.el} ${current.year}</echo>
180 <echo level="info">el: ${month.el} ${current.year}</echo>
181 <echo level="info">es: ${month.es} ${current.year}</echo>
182 <echo level="info">fr: ${month.fr} ${current.year}</echo>
183 <echo level="info">lv: ${month.lv} ${current.year}</echo>
184 <echo level="info">mr: ${month.mr} ${current.year}</echo>
185 <echo level="info">ro: ${month.ro} ${current.year}</echo>
186 <echo level="info">ru: ${month.ru} ${current.year}</echo>
187 <echo level="info">vi: ${month.vi} ${current.year}</echo>
188 <echo level="info">zh: ${month.zh} ${current.year}</echo>
189 <echo level="info">default: (${month.default} ${current.year})</echo>
190 -->
191 </target>
192
193 <!-- show the core properties of all release-kits -->
194 <target name="core-properties">
195 <echo>Required Properties:</echo>
196 <echo>version the version string for the release</echo>
197 <echo/>
198 <echo>Optional Properties:</echo>
199 <echo>branch.path the branch of Greenstone to make a release of. Eg: tags/2.81. Default: trunk.</echo>
200 <echo>branch.revision the revision of Greenstone to make a release of. Eg: 18273. Default: HEAD.</echo>
201 <echo/>
202 </target>
203
204 <!-- a target to strip any directory of .svn folders -->
205 <target name="strip-svn-dirs">
206 <delete includeemptydirs="true">
207 <fileset dir="${dir}" defaultexcludes="false">
208 <include name="**/.svn/**" />
209 <include name="**/.svn/" />
210 <include name=".svn/**" />
211 <include name=".svn/" />
212 </fileset>
213 </delete>
214 </target>
215
216 <!-- target to insert the uninstaller into 'compiled' and compile it -->
217 <target name="insert-and-compile-uninstaller">
218
219 <!-- create working build directory -->
220 <mkdir dir="compiled/uninstaller/build/resources" />
221
222 <!-- copile to build -->
223 <javac
224 srcdir="${rk.home}/shared/core/uninstaller"
225 destdir="compiled/uninstaller/build" />
226
227 <!-- copy language bundle into place -->
228 <native2ascii
229 implementation="sun"
230 src="${rk.home}/shared/core/language-strings"
231 dest="compiled/uninstaller/build/resources"/>
232
233 <!-- jar it all up -->
234 <jar
235 destfile="compiled/uninst.jar"
236 manifest="${rk.home}/shared/core/uninstaller/manifest.mf"
237 basedir="compiled/uninstaller/build" />
238
239 <!-- clean up build directory -->
240 <delete dir="compiled/uninstaller"/>
241
242 <!-- put the associated script in place -->
243 <copy file="${rk.home}/shared/core/uninstaller/Uninstall.${os.script.format}" todir="compiled"/>
244
245 </target>
246
247 <!-- target to set all the version numbers in a greenstone2 or gs2build directory -->
248 <target name="gsdl-set-version-numbers">
249
250 <if><bool><available file="${gsdl.basedir}/common-src/src/lib/gsdlconf.h"/></bool>
251 <rsr file="${gsdl.basedir}/common-src/src/lib/gsdlconf.h" pattern="(#define GSDL_VERSION) &quot;.*&quot;" replacement="$1 &quot;${version}&quot;" />
252 </if>
253
254 <if><bool><available file="${gsdl.basedir}/etc/VERSION"/></bool>
255 <rsr file="${gsdl.basedir}/etc/VERSION" pattern="(gsdl version: ).*" replacement="$1${version}" />
256 </if>
257
258 <if><bool><available file="${gsdl.basedir}/lib/java/server.properties"/></bool>
259 <rsr file="${gsdl.basedir}/lib/java/server.properties" pattern="^(Server2Control.Version[:=]).*" replacement="$1${version}" />
260 </if>
261
262 <if><bool><available file="${gsdl.basedir}/lib/java/log4j.properties.in"/></bool>
263 <rsr file="${gsdl.basedir}/lib/java/log4j.properties.in" pattern="^(log4j.category.org.greenstone.server[:=].*)INFO(.*)" replacement="$1WARN$2" />
264 </if>
265
266 <antcall target="gsdl-set-dates-in-readmes"><param name="gsdl.basedir" value="${gsdl.basedir}"/></antcall>
267
268 </target>
269
270 <!-- target to set dates in readme files -->
271 <target name="gsdl-set-dates-in-readmes">
272
273 <!-- en -->
274 <if><bool><available file="${gsdl.basedir}/READMEen.txt"/></bool>
275 <rsr file="${gsdl.basedir}/READMEen.txt">
276 <job pattern="^(Date\s*)(.*)" replacement="$1${month.default} ${current.year}" />
277 <job pattern="^(Version\s*)(.*)" replacement="$1${version}" />
278 </rsr>
279 </if>
280
281 <!-- ar -->
282 <if><bool><available file="${gsdl.basedir}/READMEar.txt"/></bool>
283 <rsr file="${gsdl.basedir}/READMEar.txt">
284 <job pattern="(التاريخ : \s*)(.*)" replacement="$1${month.ar} ${current.year}"/>
285 <job pattern="(النسخه : \s*)(.*)" replacement="$1${version}"/>
286 </rsr>
287 </if>
288
289 <!-- es -->
290 <if><bool><available file="${gsdl.basedir}/READMEes.txt"/></bool>
291 <rsr file="${gsdl.basedir}/READMEes.txt">
292 <job pattern="^(Fecha\s*)(.*)" replacement="$1${month.es} de ${current.year}"/>
293 <job pattern="^(Versi.?n\s*)(.*)" replacement="$1${version}"/>
294 </rsr>
295 </if>
296
297 <!-- fr -->
298 <if><bool><available file="${gsdl.basedir}/READMEfr.txt"/></bool>
299 <rsr file="${gsdl.basedir}/READMEfr.txt">
300 <job pattern="^(Date\s*)(.*)" replacement="$1${month.fr} ${current.year}"/>
301 <job pattern="^(Version\s*)(.*)" replacement="$1${version}"/>
302 </rsr>
303 </if>
304
305 <!-- ru -->
306 <if><bool><available file="${gsdl.basedir}/READMEru.txt"/></bool>
307 <rsr file="${gsdl.basedir}/READMEru.txt">
308 <job pattern="^(Дата\s*)(.*)" replacement="$1${month.ru} ${current.year}"/>
309 <job pattern="^(ВерсОя\s*)(.*)" replacement="$1${version}"/>
310 </rsr>
311 </if>
312
313 </target>
314
315 <!-- target to set version numbers in gli -->
316 <target name="gli-set-version-numbers">
317
318 <!-- DICTIOANRY FILES (AboutDialog.Date) -->
319 <echo level="info">Changing AboutDialog.Date in all dictionaries</echo>
320
321 <rsr file="${glibasedir}/classes/dictionary_ar.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.ar} ${current.year})" />
322 <rsr file="${glibasedir}/classes/dictionary_ca.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.ca} de ${current.year})" />
323 <rsr file="${glibasedir}/classes/dictionary_el.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.el} ${current.year})" />
324 <rsr file="${glibasedir}/classes/dictionary_es.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.es} ${current.year})" />
325 <rsr file="${glibasedir}/classes/dictionary_fr.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.fr} ${current.year})" />
326 <rsr file="${glibasedir}/classes/dictionary_lv.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.lv} ${current.year})" />
327 <rsr file="${glibasedir}/classes/dictionary_mr.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.mr} ${current.year})" />
328 <rsr file="${glibasedir}/classes/dictionary_ro.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.ro} ${current.year})" />
329 <rsr file="${glibasedir}/classes/dictionary_ru.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.ru} ${current.year})" />
330 <rsr file="${glibasedir}/classes/dictionary_vi.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.vi} ${current.year})" />
331 <rsr file="${glibasedir}/classes/dictionary_zh.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.zh} ${current.year})" />
332 <rsr file="${glibasedir}/classes/dictionary.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.default} ${current.year})" />
333
334 <!-- GLI GATHERER -->
335 <echo level="info">Changing version number in gli Gatherer</echo>
336 <rsr file="${glibasedir}/src/org/greenstone/gatherer/Gatherer.java" pattern="^(.*)String\s*PROGRAM_VERSION\s*=\s*&quot;(.*)&quot;" replacement="$1String PROGRAM_VERSION = &quot;${version}&quot;"/>
337
338 <!-- CONFIG XML FILES -->
339 <echo level="info">Changing configuration version in classes/xml/config.xml</echo>
340 <rsr file="${glibasedir}/classes/xml/config.xml" pattern="^(\s*&lt;Configuration.* version=&quot;)[^&quot;]*(&quot;.*&gt;)" replacement="$1${version}$2"/>
341
342 <echo level="info">Changing configuration version in gli/classes/xml/configRemote.xml</echo>
343 <rsr file="${glibasedir}/classes/xml/configRemote.xml" pattern="^(\s*&lt;Configuration.* version=&quot;)[^&quot;]*(&quot;.*&gt;)" replacement="$1${version}$2"/>
344
345 </target>
346
347 <!-- target to tidy gli up for distribution -->
348 <target name="gli-tidy-for-dist">
349 <!-- delete unneeded things -->
350 <delete file="${glibasedir}/.greenstonestore"/>
351 <delete dir="${glibasedir}/classes/META-INF"/>
352 <delete dir="${glibasedir}/classes/org"/>
353 <delete dir="${glibasedir}/classes/xml"/>
354 <delete dir="${glibasedir}/classes/images"/>
355 <delete dir="${glibasedir}/metadata"/>
356 <delete dir="${glibasedir}/help"/>
357 <delete dir="${glibasedir}/jar"/>
358 <delete dir="${glibasedir}/lib"/>
359 <if><bool><not><equals arg1="windows" arg2="${rk.os}"/></not></bool>
360 <delete dir="${glibasedir}/winutil"/>
361 </if>
362 </target>
363
364
365 <!-- target to archive and compress a given component -->
366 <target name="create-component">
367 <mkdir dir="components"/>
368 <zip destfile="components/${component}.comp" compress="false">
369 <zipfileset dir="compiled">
370 <patternset refid="greenstone${version.major}.${component}.component"/>
371 </zipfileset>
372 </zip>
373 <!-- windows -->
374 <if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
375 <exec executable="${rk.home}/shared/windows/7za/7za.exe" dir="components"><arg line="a -t7z -mx=9 ${component}.lzma ${component}.comp"/></exec>
376
377 <!-- linux, mac -->
378 <else><if><bool><or><equals arg1="${rk.os}" arg2="linux"/><equals arg1="${rk.os}" arg2="mac"/></or></bool>
379 <sevenzip task="encode" input="components/${component}.comp" output="components/${component}.lzma" dictionnary="26"/>
380
381 <!-- else warn -->
382 <else>
383 <fail>this target does not support this os (was a new release-kit os added?)</fail>
384
385 </else></if></else></if>
386 </target>
387
388</project>
Note: See TracBrowser for help on using the repository browser.