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

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

got properties target working for all kits, plus some fixes

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 <!-- 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>version (required) the version string for the release</echo>
196 <echo>branch.path (optional) the branch of Greenstone to make a release of. Eg: tags/2.81. Default: trunk.</echo>
197 <echo>branch.revision (optional) the revision of Greenstone to make a release of. Eg: 18273. Default: HEAD.</echo>
198 </target>
199
200 <!-- a target to strip any directory of .svn folders -->
201 <target name="strip-svn-dirs">
202 <delete includeemptydirs="true">
203 <fileset dir="${dir}" defaultexcludes="false">
204 <include name="**/.svn/**" />
205 <include name="**/.svn/" />
206 <include name=".svn/**" />
207 <include name=".svn/" />
208 </fileset>
209 </delete>
210 </target>
211
212 <!-- target to insert the uninstaller into 'compiled' and compile it -->
213 <target name="insert-and-compile-uninstaller">
214
215 <!-- create working build directory -->
216 <mkdir dir="compiled/uninstaller/build/resources" />
217
218 <!-- copile to build -->
219 <javac
220 srcdir="${rk.home}/shared/core/uninstaller"
221 destdir="compiled/uninstaller/build" />
222
223 <!-- copy language bundle into place -->
224 <native2ascii
225 implementation="sun"
226 src="${rk.home}/shared/core/language-strings"
227 dest="compiled/uninstaller/build/resources"/>
228
229 <!-- jar it all up -->
230 <jar
231 destfile="compiled/uninst.jar"
232 manifest="${rk.home}/shared/core/uninstaller/manifest.mf"
233 basedir="compiled/uninstaller/build" />
234
235 <!-- clean up build directory -->
236 <delete dir="compiled/uninstaller"/>
237
238 <!-- put the associated script in place -->
239 <copy file="${rk.home}/shared/core/uninstaller/Uninstall.${os.script.format}" todir="compiled"/>
240
241 </target>
242
243 <!-- target to set all the version numbers in a greenstone2 or gs2build directory -->
244 <target name="gsdl-set-version-numbers">
245
246 <if><bool><available file="${gsdl.basedir}/common-src/src/lib/gsdlconf.h"/></bool>
247 <rsr file="${gsdl.basedir}/common-src/src/lib/gsdlconf.h" pattern="(#define GSDL_VERSION) &quot;.*&quot;" replacement="$1 &quot;${version}&quot;" />
248 </if>
249
250 <if><bool><available file="${gsdl.basedir}/etc/VERSION"/></bool>
251 <rsr file="${gsdl.basedir}/etc/VERSION" pattern="(gsdl version: ).*" replacement="$1${version}" />
252 </if>
253
254 <if><bool><available file="${gsdl.basedir}/lib/java/server.properties"/></bool>
255 <rsr file="${gsdl.basedir}/lib/java/server.properties" pattern="^(Server2Control.Version[:=]).*" replacement="$1${version}" />
256 </if>
257
258 <if><bool><available file="${gsdl.basedir}/lib/java/log4j.properties.in"/></bool>
259 <rsr file="${gsdl.basedir}/lib/java/log4j.properties.in" pattern="^(log4j.category.org.greenstone.server[:=].*)INFO(.*)" replacement="$1WARN$2" />
260 </if>
261
262 <antcall target="gsdl-set-dates-in-readmes"><param name="gsdl.basedir" value="${gsdl.basedir}"/></antcall>
263
264 </target>
265
266 <!-- target to set dates in readme files -->
267 <target name="gsdl-set-dates-in-readmes">
268
269 <!-- en -->
270 <if><bool><available file="${gsdl.basedir}/READMEen.txt"/></bool>
271 <rsr file="${gsdl.basedir}/READMEen.txt">
272 <job pattern="^(Date\s*)(.*)" replacement="$1${month.default} ${current.year}" />
273 <job pattern="^(Version\s*)(.*)" replacement="$1${version}" />
274 </rsr>
275 </if>
276
277 <!-- ar -->
278 <if><bool><available file="${gsdl.basedir}/READMEar.txt"/></bool>
279 <rsr file="${gsdl.basedir}/READMEar.txt">
280 <job pattern="(التاريخ : \s*)(.*)" replacement="$1${month.ar} ${current.year}"/>
281 <job pattern="(النسخه : \s*)(.*)" replacement="$1${version}"/>
282 </rsr>
283 </if>
284
285 <!-- es -->
286 <if><bool><available file="${gsdl.basedir}/READMEes.txt"/></bool>
287 <rsr file="${gsdl.basedir}/READMEes.txt">
288 <job pattern="^(Fecha\s*)(.*)" replacement="$1${month.es} de ${current.year}"/>
289 <job pattern="^(Versi.?n\s*)(.*)" replacement="$1${version}"/>
290 </rsr>
291 </if>
292
293 <!-- fr -->
294 <if><bool><available file="${gsdl.basedir}/READMEfr.txt"/></bool>
295 <rsr file="${gsdl.basedir}/READMEfr.txt">
296 <job pattern="^(Date\s*)(.*)" replacement="$1${month.fr} ${current.year}"/>
297 <job pattern="^(Version\s*)(.*)" replacement="$1${version}"/>
298 </rsr>
299 </if>
300
301 <!-- ru -->
302 <if><bool><available file="${gsdl.basedir}/READMEru.txt"/></bool>
303 <rsr file="${gsdl.basedir}/READMEru.txt">
304 <job pattern="^(Дата\s*)(.*)" replacement="$1${month.ru} ${current.year}"/>
305 <job pattern="^(ВерсОя\s*)(.*)" replacement="$1${version}"/>
306 </rsr>
307 </if>
308
309 </target>
310
311 <!-- target to set version numbers in gli -->
312 <target name="gli-set-version-numbers">
313
314 <!-- DICTIOANRY FILES (AboutDialog.Date) -->
315 <echo level="info">Changing AboutDialog.Date in all dictionaries</echo>
316
317 <rsr file="${glibasedir}/classes/dictionary_ar.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.ar} ${current.year})" />
318 <rsr file="${glibasedir}/classes/dictionary_ca.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.ca} de ${current.year})" />
319 <rsr file="${glibasedir}/classes/dictionary_el.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.el} ${current.year})" />
320 <rsr file="${glibasedir}/classes/dictionary_es.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.es} ${current.year})" />
321 <rsr file="${glibasedir}/classes/dictionary_fr.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.fr} ${current.year})" />
322 <rsr file="${glibasedir}/classes/dictionary_lv.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.lv} ${current.year})" />
323 <rsr file="${glibasedir}/classes/dictionary_mr.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.mr} ${current.year})" />
324 <rsr file="${glibasedir}/classes/dictionary_ro.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.ro} ${current.year})" />
325 <rsr file="${glibasedir}/classes/dictionary_ru.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.ru} ${current.year})" />
326 <rsr file="${glibasedir}/classes/dictionary_vi.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.vi} ${current.year})" />
327 <rsr file="${glibasedir}/classes/dictionary_zh.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.zh} ${current.year})" />
328 <rsr file="${glibasedir}/classes/dictionary.properties" pattern="AboutDialog.Date:.*" replacement="AboutDialog.Date:(${month.default} ${current.year})" />
329
330 <!-- GLI GATHERER -->
331 <echo level="info">Changing version number in gli Gatherer</echo>
332 <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;"/>
333
334 <!-- CONFIG XML FILES -->
335 <echo level="info">Changing configuration version in classes/xml/config.xml</echo>
336 <rsr file="${glibasedir}/classes/xml/config.xml" pattern="^(\s*&lt;Configuration.* version=&quot;)[^&quot;]*(&quot;.*&gt;)" replacement="$1${version}$2"/>
337
338 <echo level="info">Changing configuration version in gli/classes/xml/configRemote.xml</echo>
339 <rsr file="${glibasedir}/classes/xml/configRemote.xml" pattern="^(\s*&lt;Configuration.* version=&quot;)[^&quot;]*(&quot;.*&gt;)" replacement="$1${version}$2"/>
340
341 </target>
342
343 <!-- target to tidy gli up for distribution -->
344 <target name="gli-tidy-for-dist">
345 <!-- delete unneeded things -->
346 <delete file="${glibasedir}/.greenstonestore"/>
347 <delete dir="${glibasedir}/classes/META-INF"/>
348 <delete dir="${glibasedir}/classes/org"/>
349 <delete dir="${glibasedir}/classes/xml"/>
350 <delete dir="${glibasedir}/classes/images"/>
351 <delete dir="${glibasedir}/metadata"/>
352 <delete dir="${glibasedir}/help"/>
353 <delete dir="${glibasedir}/jar"/>
354 <delete dir="${glibasedir}/lib"/>
355 <if><bool><not><equals arg1="windows" arg2="${rk.os}"/></not></bool>
356 <delete dir="${glibasedir}/winutil"/>
357 </if>
358 </target>
359
360
361 <!-- target to archive and compress a given component -->
362 <target name="create-component">
363 <mkdir dir="components"/>
364 <zip destfile="components/${component}.comp" compress="false">
365 <zipfileset dir="compiled">
366 <patternset refid="greenstone${version.major}.${component}.component"/>
367 </zipfileset>
368 </zip>
369 <!-- windows -->
370 <if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
371 <exec executable="${rk.home}/shared/windows/7za/7za.exe" dir="components"><arg line="a -t7z -mx=9 ${component}.lzma ${component}.comp"/></exec>
372
373 <!-- linux, mac -->
374 <else><if><bool><or><equals arg1="${rk.os}" arg2="linux"/><equals arg1="${rk.os}" arg2="mac"/></or></bool>
375 <sevenzip task="encode" input="components/${component}.comp" output="components/${component}.lzma" dictionnary="26"/>
376
377 <!-- else warn -->
378 <else>
379 <fail>this target does not support this os (was a new release-kit os added?)</fail>
380
381 </else></if></else></if>
382 </target>
383
384</project>
Note: See TracBrowser for help on using the repository browser.