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

Last change on this file since 21867 was 21867, checked in by ak19, 11 years ago

Don't want to delete the gli\lib folder since it contains the jar files needed by GLI: gli.bat gets launched with these jar files in the classpath.

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