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

Revision 19006, 19.6 KB (checked in by oranfry, 11 years ago)

changed the release kits to use the new shared code structure

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}/core">
55            <include name="ant-tasks/antelope/AntelopeTasks_3.4.2.jar"/>
56            <include name="ant-tasks/orangevolt/roxes-win32forjava-1.1.1.jar"/>
57            <include name="ant-tasks/orangevolt/orangevolt-ant-tasks-1.3.8.jar"/>
58            <include name="ant-tasks/svnant/lib/ganymed.jar"/>
59            <include name="ant-tasks/svnant/lib/svnClientAdapter.jar"/>
60            <include name="ant-tasks/svnant/lib/svnant.jar"/>
61            <include name="ant-tasks/svnant/lib/svnjavahl.jar"/>
62            <include name="ant-tasks/svnant/lib/svnkit.jar"/>
63            <include name="ant-tasks/greenstone/anttasks.jar"/>
64            <include name="ant-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="ant-installer/lib/ant-installer-ext.jar"/>
71            <include name="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}/core/lib/dates.properties" propertyName="ar.Dates.${current.month}" outputProperty="month.ar"/>
90    <get-property-value propertiesFile="${rk.home}/core/lib/dates.properties" propertyName="ca.Dates.${current.month}" outputProperty="month.ca"/>
91    <get-property-value propertiesFile="${rk.home}/core/lib/dates.properties" propertyName="el.Dates.${current.month}" outputProperty="month.el"/>
92    <get-property-value propertiesFile="${rk.home}/core/lib/dates.properties" propertyName="es.Dates.${current.month}" outputProperty="month.es"/>
93    <get-property-value propertiesFile="${rk.home}/core/lib/dates.properties" propertyName="fr.Dates.${current.month}" outputProperty="month.fr"/>
94    <get-property-value propertiesFile="${rk.home}/core/lib/dates.properties" propertyName="lv.Dates.${current.month}" outputProperty="month.lv"/>
95    <get-property-value propertiesFile="${rk.home}/core/lib/dates.properties" propertyName="mr.Dates.${current.month}" outputProperty="month.mr"/>
96    <get-property-value propertiesFile="${rk.home}/core/lib/dates.properties" propertyName="ro.Dates.${current.month}" outputProperty="month.ro"/>
97    <get-property-value propertiesFile="${rk.home}/core/lib/dates.properties" propertyName="ru.Dates.${current.month}" outputProperty="month.ru"/>
98    <get-property-value propertiesFile="${rk.home}/core/lib/dates.properties" propertyName="vi.Dates.${current.month}" outputProperty="month.vi"/>
99    <get-property-value propertiesFile="${rk.home}/core/lib/dates.properties" propertyName="zh.Dates.${current.month}" outputProperty="month.zh"/>
100    <get-property-value propertiesFile="${rk.home}/core/lib/dates.properties" propertyName="default.Dates.${current.month}" outputProperty="month.default"/>
101
102    <!--
103    <echo level="info">Current Date</echo>
104    <echo level="info">ar: ${month.ar} ${current.year}</echo>
105    <echo level="info">ca: ${month.el} ${current.year}</echo>
106    <echo level="info">el: ${month.el} ${current.year}</echo>
107    <echo level="info">es: ${month.es} ${current.year}</echo>
108    <echo level="info">fr: ${month.fr} ${current.year}</echo>
109    <echo level="info">lv: ${month.lv} ${current.year}</echo>
110    <echo level="info">mr: ${month.mr} ${current.year}</echo>
111    <echo level="info">ro: ${month.ro} ${current.year}</echo>
112    <echo level="info">ru: ${month.ru} ${current.year}</echo>
113    <echo level="info">vi: ${month.vi} ${current.year}</echo>
114    <echo level="info">zh: ${month.zh} ${current.year}</echo>
115    <echo level="info">default: (${month.default} ${current.year})</echo>
116    -->
117
118    <!-- CHECKS PRE-CONDITIONS  -->
119    <target name="init">
120
121        <!-- version number -->
122        <if>
123            <bool>
124                <not><isset property="version"/></not>
125            </bool>
126            <fail>Version number not set.
127Check that the file '${rk.name}-build.properties' exists and defines property 'version'.</fail>
128        </if>
129        <property name="app.version" value="${version}"/>
130
131        <!-- execute target code or just show the tree -->
132        <if>
133            <bool>
134                <not><isset property="execute"/></not>
135            </bool>
136            <property name="execute" value="true"/>
137            <else>
138                <if>
139                    <bool>
140                        <and>
141                            <not><equals arg1="${execute}" arg2="true"/></not>
142                            <not><equals arg1="${execute}" arg2="false"/></not>
143                        </and>
144                    </bool>
145                    <echo level="error">You have not specified a valid value for execute.</echo>
146                    <echo level="error">Valid values are 'true' and 'false'.</echo>
147                    <fail>You have not specified a valid value for execute.</fail>
148                </if>
149            </else>
150        </if>
151
152        <!-- show important properties -->
153        <echo level="info">Version (version): ${version}</echo>
154        <echo level="info">Branch Path (branch.path): ${branch.path}</echo>
155        <echo level="info">Current Month (current.month): ${current.month}</echo>
156        <echo level="info">Current Year (current.year): ${current.year}</echo>
157
158    </target>
159
160    <target name="strip-svn-dirs">
161        <delete includeemptydirs="true">
162            <fileset dir="${dir}" defaultexcludes="false">
163                <include name="**/.svn/**" />
164                <include name="**/.svn/" />
165                <include name=".svn/**" />
166                <include name=".svn/" />
167            </fileset>
168        </delete>
169    </target>
170
171    <target name="compile-binary-installer">
172
173        <copy file="${basedir}/installer/antinstall-config.xml" tofile="${basedir}/installer/antinstall-config-binary.xml"/>
174        <dcff file="${basedir}/installer/antinstall-config-binary.xml" startTag=".*&lt;!-- start source release --&gt;.*" endTag=".*&lt;!-- end source release --&gt;.*" />
175        <installer file="${basedir}/installer/Greenstone-${version}-${os.suffix}.jar"
176            compress="true"
177            extractType="NonExtractor"
178            installConfig="${basedir}/installer/antinstall-config-binary.xml"
179            buildFile="${basedir}/installer/build.xml"
180            antInstallLib="${rk.home}/core/ant-installer/lib"
181            antLib="${rk.home}/core/ant/lib"
182            validateConfig="true"
183            icons="bluecurve">
184
185            <zipfileset dir="${basedir}/installer/classes" includes="**/*" />
186            <zipfileset dir="${basedir}/components" includes="*.lzma" excludes="source-release.lzma" />
187
188        </installer>
189       
190    </target>
191
192    <target name="compile-minimal-installer">
193   
194        <copy file="${basedir}/installer/antinstall-config.xml" tofile="${basedir}/installer/antinstall-config-minimal.xml"/>
195        <dcff file="${basedir}/installer/antinstall-config-minimal.xml" startTag=".*&lt;!-- start source release --&gt;.*" endTag=".*&lt;!-- end source release --&gt;.*" />
196        <dcff file="${basedir}/installer/antinstall-config-minimal.xml" startTag=".*&lt;!-- start bundled components --&gt;.*" endTag=".*&lt;!-- end bundled components --&gt;.*" />
197        <installer file="${basedir}/installer/Greenstone-${version}-${os.suffix}-minimal.jar"
198            compress="true"
199            extractType="NonExtractor"
200            installConfig="${basedir}/installer/antinstall-config-minimal.xml"
201            buildFile="${basedir}/installer/build.xml"
202            antInstallLib="${rk.home}/core/ant-installer/lib"
203            antLib="${rk.home}/core/ant/lib"
204            validateConfig="true"
205            icons="bluecurve">
206           
207            <zipfileset dir="${basedir}/installer/classes" includes="**/*" />
208            <zipfileset dir="${basedir}/components" includes="core.lzma" />
209        </installer>
210       
211    </target>
212
213    <target name="compile-source-installer">
214
215        <copy file="${basedir}/installer/antinstall-config.xml" tofile="${basedir}/installer/antinstall-config-source.xml"/>
216        <dcff file="${basedir}/installer/antinstall-config-source.xml" startTag=".*&lt;!-- start binary release --&gt;.*" endTag=".*&lt;!-- end binary release --&gt;.*" />
217        <installer file="${basedir}/installer/Greenstone-${version}-${os.suffix}-source.jar"
218            compress="true"
219            extractType="NonExtractor"
220            installConfig="${basedir}/installer/antinstall-config-source.xml"
221            buildFile="${basedir}/installer/build.xml"
222            antInstallLib="${rk.home}/core/ant-installer/lib"
223            antLib="${rk.home}/core/ant/lib"
224            validateConfig="true"
225            icons="bluecurve">
226           
227            <zipfileset dir="${basedir}/installer/classes" includes="**/*" />
228            <zipfileset dir="${basedir}/components" includes="source-release.lzma" />
229        </installer>
230
231    </target>
232
233    <!-- fork the web distribution to preserve a source release -->
234    <target name="copy-web-to-source">
235        <copy todir="distributions/source"><fileset dir="distributions/web"/></copy>
236    </target>
237
238    <target name="copy-main-installer-files">
239
240        <mkdir dir="${basedir}/installer/classes"/>
241
242        <!-- the installer descriptors -->
243        <copy todir="${basedir}/installer" file="${rk.home}/installer/antinstall-config.xml" overwrite="true" />
244        <copy todir="${basedir}/installer" file="${rk.home}/installer/build.xml" overwrite="true" />
245
246        <!-- the language bundle -->
247        <native2ascii
248            implementation="sun"
249            encoding="UTF-8"
250            src="${rk.home}/core/language-strings"
251            dest="${basedir}/installer/classes/resources"/>
252
253        <!-- os- and major version-specific files -->
254        <copy todir="${basedir}/installer/classes" overwrite="true">
255            <fileset dir="${rk.home}/linux/installer-classes" erroronmissingdir="false"/>
256            <fileset dir="${rk.home}/windows/installer-classes"  erroronmissingdir="false"/>
257            <fileset dir="${rk.home}/greenstone3/installer-classes" erroronmissingdir="false"/>
258            <fileset dir="${rk.home}/greenstone2/installer-classes" erroronmissingdir="false"/>
259        </copy>
260
261    </target>
262
263    <target name="make-installer-files-concrete">
264
265        <!-- calculate the size of components -->
266        <echo>Calculating the size of some components</echo>
267
268        <!-- core -->
269        <length property="component.bytesize.core-without-jre" mode="all"><fileset file="${basedir}/components/core.comp"/></length>
270        <if><bool><equals arg1="${java.os}" arg2="windows"/></bool>
271            <math result="component.bytesize.core" operand1="${component.bytesize.core-without-jre}" operation="+" operand2="${component.bytesize.windows-java}" datatype="int"/>
272        <else><if><bool><equals arg1="${java.os}" arg2="linux"/></bool>
273            <math result="component.bytesize.core" operand1="${component.bytesize.core-without-jre}" operation="+" operand2="${component.bytesize.linux-java}" datatype="int"/>
274        <else>
275            <property name="component.bytesize.core" value="${component.bytesize.core-without-jre}"/>
276        </else></if></else></if>
277        <math result="component.megabytesize.core" operand1="${component.bytesize.core}" operation="/" operand2="1048576" datatype="int"/>
278        <property name="component.size.core" value="${component.megabytesize.core} MB"/>
279
280        <!-- sourcecode core -->
281        <length property="component.bytesize.sourcecode-core" mode="all"><fileset file="${basedir}/components/sourcecode-core.comp"/></length>
282        <math result="component.megabytesize.sourcecode-core" operand1="${component.bytesize.sourcecode-core}" operation="/" operand2="1048576" datatype="int"/>
283        <property name="component.size.sourcecode-core" value="${component.megabytesize.sourcecode-core} MB"/>
284
285        <!-- sourcecode -->
286        <length property="component.bytesize.sourcecode" mode="all"><fileset file="${basedir}/components/sourcecode.comp"/></length>
287        <math result="component.megabytesize.sourcecode" operand1="${component.bytesize.sourcecode}" operation="/" operand2="1048576" datatype="int"/>
288        <property name="component.size.sourcecode" value="${component.megabytesize.sourcecode} MB"/>
289
290        <!-- imagemagick -->
291        <length property="component.bytesize.imagemagick" mode="all"><fileset file="${basedir}/components/imagemagick.comp"/></length>
292        <math result="component.megabytesize.imagemagick" operand1="${component.bytesize.imagemagick}" operation="/" operand2="1048576" datatype="int"/>
293        <property name="component.size.imagemagick" value="${component.megabytesize.imagemagick} MB"/>
294
295        <!-- ghostscript -->
296        <length property="component.bytesize.ghostscript" mode="all"><fileset file="${basedir}/components/ghostscript.comp"/></length>
297        <math result="component.megabytesize.ghostscript" operand1="${component.bytesize.ghostscript}" operation="/" operand2="1048576" datatype="int"/>
298        <property name="component.size.ghostscript" value="${component.megabytesize.ghostscript} MB"/>
299
300        <!-- tomcat -->
301        <length property="component.bytesize.tomcat" mode="all"><fileset file="${basedir}/components/tomcat.comp"/></length>
302        <math result="component.megabytesize.tomcat" operand1="${component.bytesize.tomcat}" operation="/" operand2="1048576" datatype="int"/>
303        <property name="component.size.tomcat" value="${component.megabytesize.tomcat} MB"/>
304
305        <!-- ant -->
306        <length property="component.bytesize.ant" mode="all"><fileset file="${basedir}/components/ant.comp"/></length>
307        <math result="component.megabytesize.ant" operand1="${component.bytesize.ant}" operation="/" operand2="1048576" datatype="int"/>
308        <property name="component.size.ant" value="${component.megabytesize.ant} MB"/>
309       
310        <!-- put the concrete values of things in the config -->
311        <rsr>
312            <fileset dir="${basedir}/installer" includes="*.xml"/>
313            <job pattern="@version@" replacement="${version}"/>
314            <job pattern="@component.size.core@" replacement="${component.size.core}"/>
315            <job pattern="@component.size.sourcecode-core@" replacement="${component.size.sourcecode-core}"/>
316            <job pattern="@component.size.sourcecode@" replacement="${component.size.sourcecode}"/>
317            <job pattern="@component.size.tomcat@" replacement="${component.size.tomcat}"/>
318            <job pattern="@component.size.ant@" replacement="${component.size.ant}"/>
319            <job pattern="@component.size.imagemagick@" replacement="${component.size.imagemagick}"/>
320            <job pattern="@component.size.ghostscript@" replacement="${component.size.ghostscript}"/>
321            <job pattern="@java.min.version@" replacement="${java.min.version}"/>
322            <job pattern="@windows-java.extracted@" replacement="${windows-java.extracted}"/>
323            <job pattern="@linux-java.extracted@" replacement="${linux-java.extracted}"/>
324        </rsr>
325
326        <!-- put the concrete values of things in the text -->
327        <rsr>
328            <fileset dir="${basedir}/installer/classes/resources" includes="*.properties"/>
329            <job pattern="@version@" replacement="${version}"/>
330            <job pattern="@version.major@" replacement="${version.major}"/>
331            <job pattern="@java.min.version@" replacement="${java.min.version}"/>
332            <job pattern="@bundled.version.imagemagick@" replacement="${bundled.version.imagemagick}"/>
333            <job pattern="@bundled.version.ghostscript@" replacement="${bundled.version.ghostscript}"/>
334            <job pattern="@bundled.version.tomcat@" replacement="${bundled.version.tomcat}"/>
335            <job pattern="@bundled.version.ant@" replacement="${bundled.version.ant}"/>
336            <job pattern="@bundled.version.windows-java@" replacement="${bundled.version.windows-java}"/>
337            <job pattern="@bundled.version.linux-java@" replacement="${bundled.version.linux-java}"/>
338        </rsr>
339
340    </target>
341
342    <!-- shared target to compile the uninstaller -->
343    <target name="compile-uninstaller">
344        <echo>Compiling Uninstaller</echo>
345
346        <!-- create working build directory -->
347        <mkdir dir="${basedir}/compiled/uninstaller/build/resources" />
348
349        <!-- copile to build -->
350        <javac
351            srcdir="${rk.home}/core/uninstaller"
352            destdir="${basedir}/compiled/uninstaller/build" />
353
354        <!-- copy language bundle into place -->
355        <native2ascii
356            implementation="sun"
357            src="${rk.home}/core/language-strings"
358            dest="${basedir}/compiled/uninstaller/build/resources"/>
359
360        <!-- jar it all up -->
361        <jar
362            destfile="${basedir}/compiled/uninst.jar"
363            manifest="${rk.home}/core/uninstaller/manifest.mf"
364            basedir="${basedir}/compiled/uninstaller/build" />
365
366    </target>
367
368    <!-- copy the uninstaller script from the rk to web distribution -->
369    <target name="insert-uninstaller">
370        <copy file="${rk.home}/core/uninstaller/Uninstall.${script-format}" todir="distributions/web" />
371    </target>
372
373    <!-- create the zipped up binary release from the web distribution -->
374    <target name="compress-zipped-binary-release">
375        <mkdir dir="products"/>
376        <if>
377            <bool><equals arg1="zip" arg2="${format}"/></bool>
378            <zip destfile="products/Greenstone-${version}-${os.suffix}-binary.zip" basedir="distributions" includes="Greenstone-${version}-${os.suffix}-binary/**/*" compress="true"/>
379            <else>
380                <exec dir="distributions" executable="tar">
381                    <arg line="-czf ../products/Greenstone-${version}-${os.suffix}-binary.tar.gz Greenstone-${version}-${os.suffix}-binary"/>
382                </exec>
383            </else>
384        </if>
385    </target>
386
387    <!-- unzip windows perl into bin/windows of the given gsdl or gs2build -->
388    <target name="insert-windows-perl">
389        <mkdir dir="${gsdl.basedir}/bin/windows"/>
390        <delete dir="${gsdl.basedir}/bin/windows/perl"/>
391        <unzip src="${rk.home}/windows/perl.zip" dest="${gsdl.basedir}/bin/windows"/>
392    </target>
393    <target name="copy-compiled-to-dist">
394        <delete dir="distributions/web"/>
395        <mkdir dir="distributions"/>
396        <exec executable="cp"><arg line="-r compiled distributions/web"/></exec>
397    </target>
398
399</project>
Note: See TracBrowser for help on using the browser.