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

Revision 17781, 20.8 KB (checked in by oranfry, 11 years ago)

explicitly specify the source encoding

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="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}/ant-scripts/tasks">
55            <include name="**/*.jar"/>
56        </fileset>
57
58        <!-- jars in lib directory -->
59        <fileset dir="${rk.home}/lib">
60            <include name="*.jar"/>
61        </fileset>
62
63        <!-- a few ant-installer jars -->
64        <fileset dir="${rk.home}/packages/ant-installer/lib">
65            <include name="ant-installer-ext.jar"/>
66            <include name="ant-installer.jar"/>
67        </fileset>
68
69    </path>
70
71    <!-- SELF DEFINED TASKS AND TYPES -->
72    <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="project.classpath"/>
73    <taskdef name="try" classname="ise.antelope.tasks.TryTask" classpathref="project.classpath"/>
74    <taskdef name="math" classname="ise.antelope.tasks.MathTask" classpathref="project.classpath"/>
75    <taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" classpathref="project.classpath"/>
76    <taskdef name="sevenzip" classname="org.apache.tools.ant.SevenZip" classpathref="project.classpath"/>
77    <taskdef name="installer" classname="org.tp23.antinstaller.taskdefs.Installer" classpathref="project.classpath"/>
78    <typedef name="rsr" classname="org.greenstone.anttasks.RegexSearchReplace" classpathref="project.classpath"/>
79    <typedef name="dcff" classname="org.greenstone.anttasks.DeleteChunkFromFile" classpathref="project.classpath"/>
80    <typedef name="rsplit" classname="org.greenstone.anttasks.SplitResource" classpathref="project.classpath"/>
81    <typedef name="get-property-value" classname="org.greenstone.anttasks.GetPropertyValue" classpathref="project.classpath"/>
82   
83    <!-- DATES IN DIFFERENT LANGUAGES -->
84    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="ar.Dates.${current.month}" outputProperty="month.ar"/>
85    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="ca.Dates.${current.month}" outputProperty="month.ca"/>
86    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="el.Dates.${current.month}" outputProperty="month.el"/>
87    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="es.Dates.${current.month}" outputProperty="month.es"/>
88    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="fr.Dates.${current.month}" outputProperty="month.fr"/>
89    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="lv.Dates.${current.month}" outputProperty="month.lv"/>
90    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="mr.Dates.${current.month}" outputProperty="month.mr"/>
91    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="ro.Dates.${current.month}" outputProperty="month.ro"/>
92    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="ru.Dates.${current.month}" outputProperty="month.ru"/>
93    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="vi.Dates.${current.month}" outputProperty="month.vi"/>
94    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="zh.Dates.${current.month}" outputProperty="month.zh"/>
95    <get-property-value propertiesFile="${rk.home}/lib/dates.properties" propertyName="default.Dates.${current.month}" outputProperty="month.default"/>
96    <!--
97    <echo level="info">Current Date</echo>
98    <echo level="info">ar: ${month.ar} ${current.year}</echo>
99    <echo level="info">ca: ${month.el} ${current.year}</echo>
100    <echo level="info">el: ${month.el} ${current.year}</echo>
101    <echo level="info">es: ${month.es} ${current.year}</echo>
102    <echo level="info">fr: ${month.fr} ${current.year}</echo>
103    <echo level="info">lv: ${month.lv} ${current.year}</echo>
104    <echo level="info">mr: ${month.mr} ${current.year}</echo>
105    <echo level="info">ro: ${month.ro} ${current.year}</echo>
106    <echo level="info">ru: ${month.ru} ${current.year}</echo>
107    <echo level="info">vi: ${month.vi} ${current.year}</echo>
108    <echo level="info">zh: ${month.zh} ${current.year}</echo>
109    <echo level="info">default: (${month.default} ${current.year})</echo>
110    -->
111
112    <!-- CHECKS PRE-CONDITIONS  -->
113    <target name="init">
114
115        <!-- version number -->
116        <if>
117            <bool>
118                <not><isset property="version"/></not>
119            </bool>
120            <fail>Version number not set</fail>
121        </if>
122        <property name="app.version" value="${version}"/>
123
124        <!-- execute target code or just show the tree -->
125        <if>
126            <bool>
127                <not><isset property="execute"/></not>
128            </bool>
129            <property name="execute" value="true"/>
130            <else>
131                <if>
132                    <bool>
133                        <and>
134                            <not><equals arg1="${execute}" arg2="true"/></not>
135                            <not><equals arg1="${execute}" arg2="false"/></not>
136                        </and>
137                    </bool>
138                    <echo level="error">You have not specified a valid value for execute.</echo>
139                    <echo level="error">Valid values are 'true' and 'false'.</echo>
140                    <fail>You have not specified a valid value for execute.</fail>
141                </if>
142            </else>
143        </if>
144
145        <!-- show important properties -->
146        <echo level="info">Version (version): ${version}</echo>
147        <echo level="info">Branch Path (branch.path): ${branch.path}</echo>
148        <echo level="info">Current Month (current.month): ${current.month}</echo>
149        <echo level="info">Current Year (current.year): ${current.year}</echo>
150
151    </target>
152
153    <target name="strip-svn-dirs">
154        <delete includeemptydirs="true">
155            <fileset dir="${dir}" defaultexcludes="false">
156                <include name="**/.svn/**" />
157                <include name="**/.svn/" />
158                <include name=".svn/**" />
159                <include name=".svn/" />
160            </fileset>
161        </delete>
162    </target>
163
164    <target name="compile-binary-installer">
165
166        <copy file="${basedir}/installer/antinstall-config.xml" tofile="${basedir}/installer/antinstall-config-binary.xml"/>
167        <dcff file="${basedir}/installer/antinstall-config-binary.xml" startTag=".*&lt;!-- start source release core --&gt;.*" endTag=".*&lt;!-- end source release core --&gt;.*" />
168        <dcff file="${basedir}/installer/antinstall-config-binary.xml" startTag=".*&lt;!-- start sourcecode --&gt;.*" endTag=".*&lt;!-- end sourcecode --&gt;.*" />
169        <installer file="${basedir}/installer/Greenstone-${version}-${os.suffix}.jar"
170            compress="true"
171            extractType="NonExtractor"
172            installConfig="${basedir}/installer/antinstall-config-binary.xml"
173            buildFile="${basedir}/installer/build.xml"
174            antInstallLib="${rk.home}/packages/ant-installer/lib"
175            antLib="${rk.home}/packages/ant/lib"
176            validateConfig="true"
177            icons="bluecurve">
178
179            <zipfileset dir="${basedir}/installer/classes" includes="**/*" />
180            <zipfileset dir="${basedir}/components" includes="*.lzma" excludes="sourcecode.lzma,sourcecode-core.lzma" />
181
182        </installer>
183       
184    </target>
185
186    <target name="compile-minimal-installer">
187   
188        <copy file="${basedir}/installer/antinstall-config.xml" tofile="${basedir}/installer/antinstall-config-minimal.xml"/>
189        <dcff file="${basedir}/installer/antinstall-config-minimal.xml" startTag=".*&lt;!-- start source release core --&gt;.*" endTag=".*&lt;!-- end source release core --&gt;.*" />
190        <dcff file="${basedir}/installer/antinstall-config-minimal.xml" startTag=".*&lt;!-- start sourcecode --&gt;.*" endTag=".*&lt;!-- end sourcecode --&gt;.*" />
191        <dcff file="${basedir}/installer/antinstall-config-minimal.xml" startTag=".*&lt;!-- start bundled components --&gt;.*" endTag=".*&lt;!-- end bundled components --&gt;.*" />
192        <installer file="${basedir}/installer/Greenstone-${version}-${os.suffix}-minimal.jar"
193            compress="true"
194            extractType="NonExtractor"
195            installConfig="${basedir}/installer/antinstall-config-minimal.xml"
196            buildFile="${basedir}/installer/build.xml"
197            antInstallLib="${rk.home}/packages/ant-installer/lib"
198            antLib="${rk.home}/packages/ant/lib"
199            validateConfig="true"
200            icons="bluecurve">
201           
202            <zipfileset dir="${basedir}/installer/classes" includes="**/*" />
203            <zipfileset dir="${basedir}/components" includes="core.lzma" />
204        </installer>
205       
206    </target>
207
208    <target name="compile-source-installer">
209
210        <copy file="${basedir}/installer/antinstall-config.xml" tofile="${basedir}/installer/antinstall-config-source.xml"/>
211        <dcff file="${basedir}/installer/antinstall-config-source.xml" startTag=".*&lt;!-- start binary release core --&gt;.*" endTag=".*&lt;!-- end binary release core --&gt;.*" />
212        <dcff file="${basedir}/installer/antinstall-config-source.xml" startTag=".*&lt;!-- start bundled components --&gt;.*" endTag=".*&lt;!-- end bundled components --&gt;.*" />
213        <installer file="${basedir}/installer/Greenstone-${version}-${os.suffix}-source.jar"
214            compress="true"
215            extractType="NonExtractor"
216            installConfig="${basedir}/installer/antinstall-config-source.xml"
217            buildFile="${basedir}/installer/build.xml"
218            antInstallLib="${rk.home}/packages/ant-installer/lib"
219            antLib="${rk.home}/packages/ant/lib"
220            validateConfig="true"
221            icons="bluecurve">
222           
223            <zipfileset dir="${basedir}/installer/classes" includes="**/*" />
224            <zipfileset dir="${basedir}/components" includes="sourcecode-core.lzma,sourcecode.lzma" />
225        </installer>
226
227    </target>
228
229    <target name="copy-web-to-source">
230        <copy todir="distributions/source"><fileset dir="distributions/web"/></copy>
231    </target>
232
233    <target name="copy-main-installer-files">
234
235        <mkdir dir="${basedir}/installer/classes"/>
236
237        <!-- the installer descriptors -->
238        <copy todir="${basedir}/installer" file="${rk.home}/installer/antinstall-config.xml" overwrite="true" />
239        <copy todir="${basedir}/installer" file="${rk.home}/installer/build.xml" overwrite="true" />
240
241        <!-- the language bundle -->
242        <native2ascii
243            implementation="sun"
244            encoding="UTF-8"
245            src="${rk.home}/language-strings"
246            dest="${basedir}/installer/classes/resources"/>
247
248        <!-- os- and major version-specific files -->
249        <copy todir="${basedir}/installer/classes" overwrite="true">
250            <fileset dir="${rk.home}/linux/installer-classes" erroronmissingdir="false"/>
251            <fileset dir="${rk.home}/windows/installer-classes"  erroronmissingdir="false"/>
252            <fileset dir="${rk.home}/greenstone3/installer-classes" erroronmissingdir="false"/>
253            <fileset dir="${rk.home}/greenstone2/installer-classes" erroronmissingdir="false"/>
254        </copy>
255
256    </target>
257
258    <target name="make-installer-files-concrete">
259
260        <!-- calculate the size of components -->
261        <echo>Calculating the size of some components</echo>
262
263        <!-- core -->
264        <length property="component.bytesize.core-without-jre" mode="all"><fileset file="${basedir}/components/core.comp"/></length>
265        <if><bool><equals arg1="${java.os}" arg2="windows"/></bool>
266            <math result="component.bytesize.core" operand1="${component.bytesize.core-without-jre}" operation="+" operand2="${component.bytesize.windows-java}" datatype="int"/>
267        <else><if><bool><equals arg1="${java.os}" arg2="linux"/></bool>
268            <math result="component.bytesize.core" operand1="${component.bytesize.core-without-jre}" operation="+" operand2="${component.bytesize.linux-java}" datatype="int"/>
269        <else>
270            <property name="component.bytesize.core" value="${component.bytesize.core-without-jre}"/>
271        </else></if></else></if>
272        <math result="component.megabytesize.core" operand1="${component.bytesize.core}" operation="/" operand2="1048576" datatype="int"/>
273        <property name="component.size.core" value="${component.megabytesize.core} MB"/>
274
275        <!-- sourcecode core -->
276        <length property="component.bytesize.sourcecode-core" mode="all"><fileset file="${basedir}/components/sourcecode-core.comp"/></length>
277        <math result="component.megabytesize.sourcecode-core" operand1="${component.bytesize.sourcecode-core}" operation="/" operand2="1048576" datatype="int"/>
278        <property name="component.size.sourcecode-core" value="${component.megabytesize.sourcecode-core} MB"/>
279
280        <!-- sourcecode -->
281        <length property="component.bytesize.sourcecode" mode="all"><fileset file="${basedir}/components/sourcecode.comp"/></length>
282        <math result="component.megabytesize.sourcecode" operand1="${component.bytesize.sourcecode}" operation="/" operand2="1048576" datatype="int"/>
283        <property name="component.size.sourcecode" value="${component.megabytesize.sourcecode} MB"/>
284
285        <!-- imagemagick -->
286        <length property="component.bytesize.imagemagick" mode="all"><fileset file="${basedir}/components/imagemagick.comp"/></length>
287        <math result="component.megabytesize.imagemagick" operand1="${component.bytesize.imagemagick}" operation="/" operand2="1048576" datatype="int"/>
288        <property name="component.size.imagemagick" value="${component.megabytesize.imagemagick} MB"/>
289
290        <!-- ghostscript -->
291        <length property="component.bytesize.ghostscript" mode="all"><fileset file="${basedir}/components/ghostscript.comp"/></length>
292        <math result="component.megabytesize.ghostscript" operand1="${component.bytesize.ghostscript}" operation="/" operand2="1048576" datatype="int"/>
293        <property name="component.size.ghostscript" value="${component.megabytesize.ghostscript} MB"/>
294
295        <!-- tomcat -->
296        <length property="component.bytesize.tomcat" mode="all"><fileset file="${basedir}/components/tomcat.comp"/></length>
297        <math result="component.megabytesize.tomcat" operand1="${component.bytesize.tomcat}" operation="/" operand2="1048576" datatype="int"/>
298        <property name="component.size.tomcat" value="${component.megabytesize.tomcat} MB"/>
299
300        <!-- ant -->
301        <length property="component.bytesize.ant" mode="all"><fileset file="${basedir}/components/ant.comp"/></length>
302        <math result="component.megabytesize.ant" operand1="${component.bytesize.ant}" operation="/" operand2="1048576" datatype="int"/>
303        <property name="component.size.ant" value="${component.megabytesize.ant} MB"/>
304       
305        <!-- put the concrete values of things in the config -->
306        <rsr file="${basedir}/installer/antinstall-config.xml">
307            <job pattern="@version@" replacement="${version}"/>
308            <job pattern="@component.size.core@" replacement="${component.size.core}"/>
309            <job pattern="@component.size.sourcecode-core@" replacement="${component.size.sourcecode-core}"/>
310            <job pattern="@component.size.sourcecode@" replacement="${component.size.sourcecode}"/>
311            <job pattern="@component.size.tomcat@" replacement="${component.size.tomcat}"/>
312            <job pattern="@component.size.ant@" replacement="${component.size.ant}"/>
313            <job pattern="@component.size.imagemagick@" replacement="${component.size.imagemagick}"/>
314            <job pattern="@component.size.ghostscript@" replacement="${component.size.ghostscript}"/>
315        </rsr>
316
317        <rsr file="${basedir}/installer/build.xml">
318            <job pattern="@version@" replacement="${version}"/>
319            <job pattern="@java.min.version@" replacement="${java.min.version}"/>
320            <job pattern="@windows-java.extracted@" replacement="${windows-java.extracted}"/>
321            <job pattern="@linux-java.extracted@" replacement="${linux-java.extracted}"/>
322        </rsr>
323
324        <!-- put the concrete values of things in the text -->
325
326        <!-- default -->
327        <rsr file="${basedir}/installer/classes/resources/LanguagePack.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        <!-- es -->
340        <rsr file="${basedir}/installer/classes/resources/LanguagePack_es.properties">
341            <job pattern="@version@" replacement="${version}"/>
342            <job pattern="@version.major@" replacement="${version.major}"/>
343            <job pattern="@java.min.version@" replacement="${java.min.version}"/>
344            <job pattern="@bundled.version.imagemagick@" replacement="${bundled.version.imagemagick}"/>
345            <job pattern="@bundled.version.ghostscript@" replacement="${bundled.version.ghostscript}"/>
346            <job pattern="@bundled.version.tomcat@" replacement="${bundled.version.tomcat}"/>
347            <job pattern="@bundled.version.ant@" replacement="${bundled.version.ant}"/>
348            <job pattern="@bundled.version.windows-java@" replacement="${bundled.version.windows-java}"/>
349            <job pattern="@bundled.version.linux-java@" replacement="${bundled.version.linux-java}"/>
350        </rsr>
351
352        <!-- es_EU -->
353        <rsr file="${basedir}/installer/classes/resources/LanguagePack_es_EU.properties">
354            <job pattern="@version@" replacement="${version}"/>
355            <job pattern="@version.major@" replacement="${version.major}"/>
356            <job pattern="@java.min.version@" replacement="${java.min.version}"/>
357            <job pattern="@bundled.version.imagemagick@" replacement="${bundled.version.imagemagick}"/>
358            <job pattern="@bundled.version.ghostscript@" replacement="${bundled.version.ghostscript}"/>
359            <job pattern="@bundled.version.tomcat@" replacement="${bundled.version.tomcat}"/>
360            <job pattern="@bundled.version.ant@" replacement="${bundled.version.ant}"/>
361            <job pattern="@bundled.version.windows-java@" replacement="${bundled.version.windows-java}"/>
362            <job pattern="@bundled.version.linux-java@" replacement="${bundled.version.linux-java}"/>
363        </rsr>
364
365        <!-- de -->
366        <rsr file="${basedir}/installer/classes/resources/LanguagePack_de.properties">
367            <job pattern="@version@" replacement="${version}"/>
368            <job pattern="@version.major@" replacement="${version.major}"/>
369            <job pattern="@java.min.version@" replacement="${java.min.version}"/>
370            <job pattern="@bundled.version.imagemagick@" replacement="${bundled.version.imagemagick}"/>
371            <job pattern="@bundled.version.ghostscript@" replacement="${bundled.version.ghostscript}"/>
372            <job pattern="@bundled.version.tomcat@" replacement="${bundled.version.tomcat}"/>
373            <job pattern="@bundled.version.ant@" replacement="${bundled.version.ant}"/>
374            <job pattern="@bundled.version.windows-java@" replacement="${bundled.version.windows-java}"/>
375            <job pattern="@bundled.version.linux-java@" replacement="${bundled.version.linux-java}"/>
376        </rsr>
377
378        <!-- fr -->
379        <rsr file="${basedir}/installer/classes/resources/LanguagePack_fr.properties">
380            <job pattern="@version@" replacement="${version}"/>
381            <job pattern="@version.major@" replacement="${version.major}"/>
382            <job pattern="@java.min.version@" replacement="${java.min.version}"/>
383            <job pattern="@bundled.version.imagemagick@" replacement="${bundled.version.imagemagick}"/>
384            <job pattern="@bundled.version.ghostscript@" replacement="${bundled.version.ghostscript}"/>
385            <job pattern="@bundled.version.tomcat@" replacement="${bundled.version.tomcat}"/>
386            <job pattern="@bundled.version.ant@" replacement="${bundled.version.ant}"/>
387            <job pattern="@bundled.version.windows-java@" replacement="${bundled.version.windows-java}"/>
388            <job pattern="@bundled.version.linux-java@" replacement="${bundled.version.linux-java}"/>
389        </rsr>
390
391
392    </target>
393
394</project>
Note: See TracBrowser for help on using the browser.