source: release-kits/shared/core/ant-scripts/init.xml@ 19152

Last change on this file since 19152 was 19152, checked in by oranfry, 15 years ago

added a new 'date' property, and got rid of the linuxy copy-compiled-to-dist target from init.xml

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