root/main/trunk/release-kits/shared/core/ant-scripts/shared.xml @ 23210

Revision 23210, 19.3 KB (checked in by sjm84, 10 years ago)

The uninstaller has been modified so that it no longer will delete files or folders in the top-level directory that do not belong to Greenstone

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