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

Last change on this file since 30131 was 30131, checked in by ak19, 7 years ago

Changes specific to 64 bit MacOS with which we now bundle a JRE.

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