root/release-kits/shared/ant-scripts/init.xml @ 17953

Revision 17953, 19.9 KB (checked in by oranfry, 11 years ago)

changes for the source release kit

Line 
1<?xml version="1.0" encoding="utf-8" ?>
2<project name="rk-init">
3
4    <!-- load in static properties from build.properties -->
5    <property file="${rk.name}-build.properties" />
6
7    <!-- CONSTANTS (overridable in build.properties) -->
8
9    <!-- svn root -->
10    <property name="svn.root" value="http://svn.greenstone.org" />
11
12    <!-- default revision and branch path -->
13    <property name="branch.path" value="trunk" />
14    <property name="branch.revision" value="HEAD" />
15   
16    <!-- the minimum version of java which the installer should be run with (this gets used in search4j) -->
17    <property name="java.min.version" value="1.4.0_00"/>
18
19    <!-- create a localised basedir property -->
20    <path id="basedir.path"><pathelement location="${basedir}"/></path>
21    <property name="basedir.local" refid="basedir.path"/>
22
23    <!-- current date and time -->
24    <tstamp>
25        <format property="current.month" pattern="MMM"/>
26        <format property="current.year" pattern="yyyy"/>
27    </tstamp>
28
29    <!-- BUNDLED JAVA INFO -->
30    <!-- the bundled javas are kept in shared/linux/wrapper and shared/windows/wrapper in the repository -->
31    <!-- change this info when the bundled version changes -->
32    <!-- linux -->
33    <property name="linux-java.installer" value="jre_bin"/>
34    <property name="bundled.version.linux-java" value="1.6.0_05"/> <!-- set this to the version number of java in the above archive -->
35    <property name="linux-java.extracted" value="jre"/> <!-- set this to the name of the top level directory in the above archive -->
36    <property name="component.bytesize.linux-java" value="101245987"/> <!-- set this to the size of the extract archive -->
37
38    <!-- windows -->
39    <property name="windows-java.installer" value="jre.exe"/>
40    <property name="bundled.version.windows-java" value="1.6.0_07"/> <!-- set this to the version number of java in the above archive -->
41    <property name="windows-java.extracted" value="jre"/> <!-- set this to the name of the top level directory in the above archive -->
42    <property name="component.bytesize.windows-java" value="75000000"/> <!-- set this to the size of the extract archive -->
43
44    <!-- version numbers of other bundled things -->
45    <property name="bundled.version.imagemagick" value="6.4.3"/>
46    <property name="bundled.version.ghostscript" value="8.63"/>
47    <property name="bundled.version.tomcat" value="5.5.25"/>
48    <property name="bundled.version.ant" value="1.6.5"/>
49   
50    <!-- CLASSPATH -->
51    <path id="project.classpath">
52
53        <!-- our classes -->
54        <fileset dir="${rk.home}">
55            <include name="ant-scripts/tasks/antelope/AntelopeTasks_3.4.2.jar"/>
56            <include name="ant-scripts/tasks/orangevolt/roxes-win32forjava-1.1.1.jar"/>
57            <include name="ant-scripts/tasks/orangevolt/orangevolt-ant-tasks-1.3.8.jar"/>
58            <include name="ant-scripts/tasks/svnant/lib/ganymed.jar"/>
59            <include name="ant-scripts/tasks/svnant/lib/svnClientAdapter.jar"/>
60            <include name="ant-scripts/tasks/svnant/lib/svnant.jar"/>
61            <include name="ant-scripts/tasks/svnant/lib/svnjavahl.jar"/>
62            <include name="ant-scripts/tasks/svnant/lib/svnkit.jar"/>
63            <include name="ant-scripts/tasks/greenstone/anttasks.jar"/>
64            <include name="ant-scripts/tasks/7z-ant/7z.jar"/>
65            <include name="lib/crypt.jar"/>
66            <include name="lib/serializer.jar"/>
67            <include name="lib/xalan.jar"/>
68            <include name="lib/xercesImpl.jar"/>
69            <include name="lib/xml-apis.jar"/>
70            <include name="packages/ant-installer/lib/ant-installer-ext.jar"/>
71            <include name="packages/ant-installer/lib/ant-installer.jar"/>
72        </fileset>
73
74    </path>
75
76    <!-- SELF DEFINED TASKS AND TYPES -->
77    <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="project.classpath"/>
78    <taskdef name="try" classname="ise.antelope.tasks.TryTask" classpathref="project.classpath"/>
79    <taskdef name="math" classname="ise.antelope.tasks.MathTask" classpathref="project.classpath"/>
80    <taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" classpathref="project.classpath"/>
81    <taskdef name="sevenzip" classname="org.apache.tools.ant.SevenZip" classpathref="project.classpath"/>
82    <taskdef name="installer" classname="org.tp23.antinstaller.taskdefs.Installer" classpathref="project.classpath"/>
83    <typedef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="project.classpath"/>
84    <typedef name="dcff" classname="org.greenstone.anttasks.DeleteChunkFromFile" classpathref="project.classpath"/>
85    <typedef name="rsplit" classname="org.greenstone.anttasks.SplitResource" classpathref="project.classpath"/>
86    <typedef name="get-property-value" classname="org.greenstone.anttasks.GetPropertyValue" classpathref="project.classpath"/>
87   
88    <!-- DATES IN DIFFERENT LANGUAGES -->
89    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="ar.Dates.${current.month}" outputProperty="month.ar"/>
90    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="ca.Dates.${current.month}" outputProperty="month.ca"/>
91    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="el.Dates.${current.month}" outputProperty="month.el"/>
92    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="es.Dates.${current.month}" outputProperty="month.es"/>
93    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="fr.Dates.${current.month}" outputProperty="month.fr"/>
94    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="lv.Dates.${current.month}" outputProperty="month.lv"/>
95    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="mr.Dates.${current.month}" outputProperty="month.mr"/>
96    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="ro.Dates.${current.month}" outputProperty="month.ro"/>
97    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="ru.Dates.${current.month}" outputProperty="month.ru"/>
98    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="vi.Dates.${current.month}" outputProperty="month.vi"/>
99    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="zh.Dates.${current.month}" outputProperty="month.zh"/>
100    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="default.Dates.${current.month}" outputProperty="month.default"/>
101    <!--
102    <echo level="info">Current Date</echo>
103    <echo level="info">ar: ${month.ar} ${current.year}</echo>
104    <echo level="info">ca: ${month.el} ${current.year}</echo>
105    <echo level="info">el: ${month.el} ${current.year}</echo>
106    <echo level="info">es: ${month.es} ${current.year}</echo>
107    <echo level="info">fr: ${month.fr} ${current.year}</echo>
108    <echo level="info">lv: ${month.lv} ${current.year}</echo>
109    <echo level="info">mr: ${month.mr} ${current.year}</echo>
110    <echo level="info">ro: ${month.ro} ${current.year}</echo>
111    <echo level="info">ru: ${month.ru} ${current.year}</echo>
112    <echo level="info">vi: ${month.vi} ${current.year}</echo>
113    <echo level="info">zh: ${month.zh} ${current.year}</echo>
114    <echo level="info">default: (${month.default} ${current.year})</echo>
115    -->
116
117    <!-- CHECKS PRE-CONDITIONS  -->
118    <target name="init">
119
120        <!-- version number -->
121        <if>
122            <bool>
123                <not><isset property="version"/></not>
124            </bool>
125            <fail>Version number not set.
126Check that the file '${rk.name}-build.properties' exists and defines property 'version'.</fail>
127        </if>
128        <property name="app.version" value="${version}"/>
129
130        <!-- execute target code or just show the tree -->
131        <if>
132            <bool>
133                <not><isset property="execute"/></not>
134            </bool>
135            <property name="execute" value="true"/>
136            <else>
137                <if>
138                    <bool>
139                        <and>
140                            <not><equals arg1="${execute}" arg2="true"/></not>
141                            <not><equals arg1="${execute}" arg2="false"/></not>
142                        </and>
143                    </bool>
144                    <echo level="error">You have not specified a valid value for execute.</echo>
145                    <echo level="error">Valid values are 'true' and 'false'.</echo>
146                    <fail>You have not specified a valid value for execute.</fail>
147                </if>
148            </else>
149        </if>
150
151        <!-- show important properties -->
152        <echo level="info">Version (version): ${version}</echo>
153        <echo level="info">Branch Path (branch.path): ${branch.path}</echo>
154        <echo level="info">Current Month (current.month): ${current.month}</echo>
155        <echo level="info">Current Year (current.year): ${current.year}</echo>
156
157    </target>
158
159    <target name="strip-svn-dirs">
160        <delete includeemptydirs="true">
161            <fileset dir="${dir}" defaultexcludes="false">
162                <include name="**/.svn/**" />
163                <include name="**/.svn/" />
164                <include name=".svn/**" />
165                <include name=".svn/" />
166            </fileset>
167        </delete>
168    </target>
169
170    <target name="compile-binary-installer">
171
172        <copy file="${basedir}/installer/antinstall-config.xml" tofile="${basedir}/installer/antinstall-config-binary.xml"/>
173        <dcff file="${basedir}/installer/antinstall-config-binary.xml" startTag=".*&lt;!-- start source release --&gt;.*" endTag=".*&lt;!-- end source release --&gt;.*" />
174        <installer file="${basedir}/installer/Greenstone-${version}-${os.suffix}.jar"
175            compress="true"
176            extractType="NonExtractor"
177            installConfig="${basedir}/installer/antinstall-config-binary.xml"
178            buildFile="${basedir}/installer/build.xml"
179            antInstallLib="${rk.home}/packages/ant-installer/lib"
180            antLib="${rk.home}/packages/ant/lib"
181            validateConfig="true"
182            icons="bluecurve">
183
184            <zipfileset dir="${basedir}/installer/classes" includes="**/*" />
185            <zipfileset dir="${basedir}/components" includes="*.lzma" excludes="source-release.lzma" />
186
187        </installer>
188       
189    </target>
190
191    <target name="compile-minimal-installer">
192   
193        <copy file="${basedir}/installer/antinstall-config.xml" tofile="${basedir}/installer/antinstall-config-minimal.xml"/>
194        <dcff file="${basedir}/installer/antinstall-config-minimal.xml" startTag=".*&lt;!-- start source release --&gt;.*" endTag=".*&lt;!-- end source release --&gt;.*" />
195        <dcff file="${basedir}/installer/antinstall-config-minimal.xml" startTag=".*&lt;!-- start bundled components --&gt;.*" endTag=".*&lt;!-- end bundled components --&gt;.*" />
196        <installer file="${basedir}/installer/Greenstone-${version}-${os.suffix}-minimal.jar"
197            compress="true"
198            extractType="NonExtractor"
199            installConfig="${basedir}/installer/antinstall-config-minimal.xml"
200            buildFile="${basedir}/installer/build.xml"
201            antInstallLib="${rk.home}/packages/ant-installer/lib"
202            antLib="${rk.home}/packages/ant/lib"
203            validateConfig="true"
204            icons="bluecurve">
205           
206            <zipfileset dir="${basedir}/installer/classes" includes="**/*" />
207            <zipfileset dir="${basedir}/components" includes="core.lzma" />
208        </installer>
209       
210    </target>
211
212    <target name="compile-source-installer">
213
214        <copy file="${basedir}/installer/antinstall-config.xml" tofile="${basedir}/installer/antinstall-config-source.xml"/>
215        <dcff file="${basedir}/installer/antinstall-config-source.xml" startTag=".*&lt;!-- start binary release --&gt;.*" endTag=".*&lt;!-- end binary release --&gt;.*" />
216        <installer file="${basedir}/installer/Greenstone-${version}-${os.suffix}-source.jar"
217            compress="true"
218            extractType="NonExtractor"
219            installConfig="${basedir}/installer/antinstall-config-source.xml"
220            buildFile="${basedir}/installer/build.xml"
221            antInstallLib="${rk.home}/packages/ant-installer/lib"
222            antLib="${rk.home}/packages/ant/lib"
223            validateConfig="true"
224            icons="bluecurve">
225           
226            <zipfileset dir="${basedir}/installer/classes" includes="**/*" />
227            <zipfileset dir="${basedir}/components" includes="source-release.lzma" />
228        </installer>
229
230    </target>
231
232    <!-- fork the web distribution to preserve a source release -->
233    <target name="copy-web-to-source">
234        <copy todir="distributions/source"><fileset dir="distributions/web"/></copy>
235    </target>
236
237    <target name="copy-main-installer-files">
238
239        <mkdir dir="${basedir}/installer/classes"/>
240
241        <!-- the installer descriptors -->
242        <copy todir="${basedir}/installer" file="${rk.home}/installer/antinstall-config.xml" overwrite="true" />
243        <copy todir="${basedir}/installer" file="${rk.home}/installer/build.xml" overwrite="true" />
244
245        <!-- the language bundle -->
246        <native2ascii
247            implementation="sun"
248            encoding="UTF-8"
249            src="${rk.home}/language-strings"
250            dest="${basedir}/installer/classes/resources"/>
251
252        <!-- os- and major version-specific files -->
253        <copy todir="${basedir}/installer/classes" overwrite="true">
254            <fileset dir="${rk.home}/linux/installer-classes" erroronmissingdir="false"/>
255            <fileset dir="${rk.home}/windows/installer-classes"  erroronmissingdir="false"/>
256            <fileset dir="${rk.home}/greenstone3/installer-classes" erroronmissingdir="false"/>
257            <fileset dir="${rk.home}/greenstone2/installer-classes" erroronmissingdir="false"/>
258        </copy>
259
260    </target>
261
262    <target name="make-installer-files-concrete">
263
264        <!-- calculate the size of components -->
265        <echo>Calculating the size of some components</echo>
266
267        <!-- core -->
268        <length property="component.bytesize.core-without-jre" mode="all"><fileset file="${basedir}/components/core.comp"/></length>
269        <if><bool><equals arg1="${java.os}" arg2="windows"/></bool>
270            <math result="component.bytesize.core" operand1="${component.bytesize.core-without-jre}" operation="+" operand2="${component.bytesize.windows-java}" datatype="int"/>
271        <else><if><bool><equals arg1="${java.os}" arg2="linux"/></bool>
272            <math result="component.bytesize.core" operand1="${component.bytesize.core-without-jre}" operation="+" operand2="${component.bytesize.linux-java}" datatype="int"/>
273        <else>
274            <property name="component.bytesize.core" value="${component.bytesize.core-without-jre}"/>
275        </else></if></else></if>
276        <math result="component.megabytesize.core" operand1="${component.bytesize.core}" operation="/" operand2="1048576" datatype="int"/>
277        <property name="component.size.core" value="${component.megabytesize.core} MB"/>
278
279        <!-- sourcecode core -->
280        <length property="component.bytesize.sourcecode-core" mode="all"><fileset file="${basedir}/components/sourcecode-core.comp"/></length>
281        <math result="component.megabytesize.sourcecode-core" operand1="${component.bytesize.sourcecode-core}" operation="/" operand2="1048576" datatype="int"/>
282        <property name="component.size.sourcecode-core" value="${component.megabytesize.sourcecode-core} MB"/>
283
284        <!-- sourcecode -->
285        <length property="component.bytesize.sourcecode" mode="all"><fileset file="${basedir}/components/sourcecode.comp"/></length>
286        <math result="component.megabytesize.sourcecode" operand1="${component.bytesize.sourcecode}" operation="/" operand2="1048576" datatype="int"/>
287        <property name="component.size.sourcecode" value="${component.megabytesize.sourcecode} MB"/>
288
289        <!-- imagemagick -->
290        <length property="component.bytesize.imagemagick" mode="all"><fileset file="${basedir}/components/imagemagick.comp"/></length>
291        <math result="component.megabytesize.imagemagick" operand1="${component.bytesize.imagemagick}" operation="/" operand2="1048576" datatype="int"/>
292        <property name="component.size.imagemagick" value="${component.megabytesize.imagemagick} MB"/>
293
294        <!-- ghostscript -->
295        <length property="component.bytesize.ghostscript" mode="all"><fileset file="${basedir}/components/ghostscript.comp"/></length>
296        <math result="component.megabytesize.ghostscript" operand1="${component.bytesize.ghostscript}" operation="/" operand2="1048576" datatype="int"/>
297        <property name="component.size.ghostscript" value="${component.megabytesize.ghostscript} MB"/>
298
299        <!-- tomcat -->
300        <length property="component.bytesize.tomcat" mode="all"><fileset file="${basedir}/components/tomcat.comp"/></length>
301        <math result="component.megabytesize.tomcat" operand1="${component.bytesize.tomcat}" operation="/" operand2="1048576" datatype="int"/>
302        <property name="component.size.tomcat" value="${component.megabytesize.tomcat} MB"/>
303
304        <!-- ant -->
305        <length property="component.bytesize.ant" mode="all"><fileset file="${basedir}/components/ant.comp"/></length>
306        <math result="component.megabytesize.ant" operand1="${component.bytesize.ant}" operation="/" operand2="1048576" datatype="int"/>
307        <property name="component.size.ant" value="${component.megabytesize.ant} MB"/>
308       
309        <!-- put the concrete values of things in the config -->
310        <rsr>
311            <fileset dir="${basedir}/installer" includes="*.xml"/>
312            <job pattern="@version@" replacement="${version}"/>
313            <job pattern="@component.size.core@" replacement="${component.size.core}"/>
314            <job pattern="@component.size.sourcecode-core@" replacement="${component.size.sourcecode-core}"/>
315            <job pattern="@component.size.sourcecode@" replacement="${component.size.sourcecode}"/>
316            <job pattern="@component.size.tomcat@" replacement="${component.size.tomcat}"/>
317            <job pattern="@component.size.ant@" replacement="${component.size.ant}"/>
318            <job pattern="@component.size.imagemagick@" replacement="${component.size.imagemagick}"/>
319            <job pattern="@component.size.ghostscript@" replacement="${component.size.ghostscript}"/>
320            <job pattern="@java.min.version@" replacement="${java.min.version}"/>
321            <job pattern="@windows-java.extracted@" replacement="${windows-java.extracted}"/>
322            <job pattern="@linux-java.extracted@" replacement="${linux-java.extracted}"/>
323        </rsr>
324
325        <!-- put the concrete values of things in the text -->
326        <rsr>
327            <fileset dir="${basedir}/installer/classes/resources" includes="*.properties"/>
328            <job pattern="@version@" replacement="${version}"/>
329            <job pattern="@version.major@" replacement="${version.major}"/>
330            <job pattern="@java.min.version@" replacement="${java.min.version}"/>
331            <job pattern="@bundled.version.imagemagick@" replacement="${bundled.version.imagemagick}"/>
332            <job pattern="@bundled.version.ghostscript@" replacement="${bundled.version.ghostscript}"/>
333            <job pattern="@bundled.version.tomcat@" replacement="${bundled.version.tomcat}"/>
334            <job pattern="@bundled.version.ant@" replacement="${bundled.version.ant}"/>
335            <job pattern="@bundled.version.windows-java@" replacement="${bundled.version.windows-java}"/>
336            <job pattern="@bundled.version.linux-java@" replacement="${bundled.version.linux-java}"/>
337        </rsr>
338
339    </target>
340
341    <!-- shared target to compile the uninstaller -->
342    <target name="compile-uninstaller">
343        <echo>Compiling Uninstaller</echo>
344
345        <!-- create working build directory -->
346        <mkdir dir="${basedir}/compiled/uninstaller/build/resources" />
347
348        <!-- copile to build -->
349        <javac
350            srcdir="${rk.home}/uninstaller"
351            destdir="${basedir}/compiled/uninstaller/build" />
352
353        <!-- copy language bundle into place -->
354        <native2ascii
355            implementation="sun"
356            src="${rk.home}/language-strings"
357            dest="${basedir}/compiled/uninstaller/build/resources"/>
358
359        <!-- jar it all up -->
360        <jar
361            destfile="${basedir}/compiled/uninstaller/uninst.jar"
362            manifest="${rk.home}/uninstaller/manifest.mf"
363            basedir="${basedir}/compiled/uninstaller/build" />
364
365    </target>
366
367    <!-- copy the uninstaller from the compiled directory to web distribution -->
368    <target name="insert-uninstaller">
369        <copy file="compiled/uninstaller/uninst.jar" todir="distributions/web" />
370        <copy file="${rk.home}/uninstaller/Uninstall.${script-format}" todir="distributions/web" />
371        <copy file="${rk.home}/uninstaller/Uninst.${script-format}" todir="distributions/web" />
372    </target>
373
374    <!-- creates the comp for the source release, works for all release kits -->
375    <target name="prepare-source-release">
376        <delete dir="components/tmp/source-release"/>
377        <mkdir dir="components/tmp/source-release"/>
378
379        <copy todir="components/tmp/source-release" overwrite="true">
380            <fileset dir="distributions/source"/>
381        </copy>
382        <zip destfile="components/source-release.comp" basedir="components/tmp/source-release" compress="false"/>
383    </target>
384
385    <!-- create the zipped up binary release from the web distribution -->
386    <target name="compress-zipped-binary-release">
387        <mkdir dir="products"/>
388        <if>
389            <bool><equals arg1="zip" arg2="${format}"/></bool>
390            <zip destfile="products/Greenstone-${version}-${os.suffix}-binary.zip" basedir="distributions/web" compress="true"/>
391            <else>
392            <tar destfile="products/Greenstone-${version}-${os.suffix}-binary.tar.gz" basedir="distributions/web" compression="gzip"/>
393            </else>
394        </if>
395    </target>
396
397    <target name="export-gsdl-gli">
398        <delete dir="${dest}"/>
399        <svn>
400            <export srcurl="${svn.root}/gsdl/${branch.path}" destPath="${dest}"/>
401            <export srcurl="${svn.root}/gli/${branch.path}" destPath="${dest}/gli"/>
402        </svn>
403    </target>
404
405</project>
Note: See TracBrowser for help on using the browser.