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

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

fixed the regex in the dcff call which makes the installer files concrete

File size: 16.9 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 <!-- show important properties -->
133 <echo level="info">Version (version): ${version}</echo>
134 <echo level="info">Branch Path (branch.path): ${branch.path}</echo>
135 <echo level="info">Date (date): ${date}</echo>
136 <echo level="info">Current Month (current.month): ${current.month}</echo>
137 <echo level="info">Current Year (current.year): ${current.year}</echo>
138
139 </target>
140
141 <target name="strip-svn-dirs">
142 <delete includeemptydirs="true">
143 <fileset dir="${dir}" defaultexcludes="false">
144 <include name="**/.svn/**" />
145 <include name="**/.svn/" />
146 <include name=".svn/**" />
147 <include name=".svn/" />
148 </fileset>
149 </delete>
150 </target>
151
152 <target name="compile-binary-installer">
153
154 <copy file="installer/antinstall-config.xml" tofile="installer/antinstall-config-binary.xml" overwrite="true"/>
155 <dcff file="installer/antinstall-config-binary.xml" startTag=".*&lt;!-- start cdrom --&gt;.*" endTag=".*&lt;!-- end cdrom --&gt;.*" />
156
157 <copy file="installer/build.xml" tofile="installer/build-binary.xml" overwrite="true"/>
158 <dcff file="installer/build-binary.xml" startTag=".*&lt;!-- start cdrom --&gt;.*" endTag=".*&lt;!-- end cdrom --&gt;.*" />
159
160 <installer file="installer/Greenstone-${version}-${os.suffix}.jar"
161 compress="true"
162 extractType="NonExtractor"
163 installConfig="installer/antinstall-config-binary.xml"
164 buildFile="installer/build-binary.xml"
165 antInstallLib="${rk.home}/core/ant-installer/lib"
166 antLib="${rk.home}/core/ant/lib"
167 validateConfig="true"
168 icons="bluecurve">
169
170 <zipfileset dir="installer/classes" includes="**/*" />
171 <zipfileset dir="components" includes="*.lzma"/>
172
173 </installer>
174
175 </target>
176
177 <target name="compile-cdrom-installer">
178
179 <copy file="installer/antinstall-config.xml" tofile="installer/antinstall-config-cdrom.xml"/>
180 <dcff file="installer/antinstall-config-cdrom.xml" startTag=".*&lt;!-- start web --&gt;.*" endTag=".*&lt;!-- end web --&gt;.*" />
181
182 <copy file="installer/build.xml" tofile="installer/build-cdrom.xml"/>
183 <dcff file="installer/build-cdrom.xml" startTag=".*&lt;!-- start web --&gt;.*" endTag=".*&lt;!-- end web --&gt;.*" />
184
185 <installer file="installer/cdrom.jar"
186 compress="true"
187 extractType="NonExtractor"
188 installConfig="installer/antinstall-config-cdrom.xml"
189 buildFile="installer/build-cdrom.xml"
190 antInstallLib="${rk.home}/core/ant-installer/lib"
191 antLib="${rk.home}/core/ant/lib"
192 validateConfig="true"
193 icons="bluecurve">
194 <zipfileset dir="installer/classes" includes="**/*" />
195 </installer>
196
197 </target>
198
199 <target name="copy-main-installer-files">
200
201 <mkdir dir="${basedir}/installer/classes"/>
202
203 <!-- the language bundle -->
204 <native2ascii
205 implementation="sun"
206 encoding="UTF-8"
207 src="${rk.home}/core/language-strings"
208 dest="${basedir}/installer/classes/resources"/>
209
210 <!-- os- and major version-specific files -->
211 <copy todir="${basedir}/installer/classes" overwrite="true">
212 <fileset dir="${rk.home}/linux/installer-classes" erroronmissingdir="false"/>
213 <fileset dir="${rk.home}/windows/installer-classes" erroronmissingdir="false"/>
214 <fileset dir="${rk.home}/greenstone3/installer-classes" erroronmissingdir="false"/>
215 <fileset dir="${rk.home}/greenstone2/installer-classes" erroronmissingdir="false"/>
216 </copy>
217
218 </target>
219
220 <target name="make-installer-files-concrete">
221
222 <!-- calculate the size of components -->
223 <echo>Calculating the size of some components</echo>
224
225 <!-- core -->
226 <length property="component.bytesize.core-without-jre" mode="all"><fileset file="${basedir}/components/core.comp"/></length>
227 <if><bool><equals arg1="${java.os}" arg2="windows"/></bool>
228 <math result="component.bytesize.core" operand1="${component.bytesize.core-without-jre}" operation="+" operand2="${component.bytesize.windows-java}" datatype="int"/>
229 <else><if><bool><equals arg1="${java.os}" arg2="linux"/></bool>
230 <math result="component.bytesize.core" operand1="${component.bytesize.core-without-jre}" operation="+" operand2="${component.bytesize.linux-java}" datatype="int"/>
231 <else>
232 <property name="component.bytesize.core" value="${component.bytesize.core-without-jre}"/>
233 </else></if></else></if>
234 <math result="component.megabytesize.core" operand1="${component.bytesize.core}" operation="/" operand2="1048576" datatype="int"/>
235 <property name="component.size.core" value="${component.megabytesize.core} MB"/>
236
237 <!-- imagemagick -->
238 <length property="component.bytesize.imagemagick" mode="all"><fileset file="${basedir}/components/imagemagick.comp"/></length>
239 <math result="component.megabytesize.imagemagick" operand1="${component.bytesize.imagemagick}" operation="/" operand2="1048576" datatype="int"/>
240 <property name="component.size.imagemagick" value="${component.megabytesize.imagemagick} MB"/>
241
242 <!-- ghostscript -->
243 <length property="component.bytesize.ghostscript" mode="all"><fileset file="${basedir}/components/ghostscript.comp"/></length>
244 <math result="component.megabytesize.ghostscript" operand1="${component.bytesize.ghostscript}" operation="/" operand2="1048576" datatype="int"/>
245 <property name="component.size.ghostscript" value="${component.megabytesize.ghostscript} MB"/>
246
247 <!-- tomcat -->
248 <length property="component.bytesize.tomcat" mode="all"><fileset file="${basedir}/components/tomcat.comp"/></length>
249 <math result="component.megabytesize.tomcat" operand1="${component.bytesize.tomcat}" operation="/" operand2="1048576" datatype="int"/>
250 <property name="component.size.tomcat" value="${component.megabytesize.tomcat} MB"/>
251
252 <!-- ant -->
253 <length property="component.bytesize.ant" mode="all"><fileset file="${basedir}/components/ant.comp"/></length>
254 <math result="component.megabytesize.ant" operand1="${component.bytesize.ant}" operation="/" operand2="1048576" datatype="int"/>
255 <property name="component.size.ant" value="${component.megabytesize.ant} MB"/>
256
257 <!-- make the installer descriptors relevant to the current os -->
258 <dcff file="installer/antinstall-config.xml" startTag="&lt;!--\s*if\s*(?!.*${rk.os})[^ ]+\s*--&gt;" endTag="&lt;!--\s*/if\s*--&gt;" />
259 <dcff file="installer/build.xml" startTag="&lt;!--\s*if\s*(?!.*${rk.os})[^ ]+\s*--&gt;" endTag="&lt;!--\s*/if\s*--&gt;" />
260
261 <!-- put the concrete values of things in the config -->
262 <rsr>
263 <fileset dir="${basedir}/installer" includes="*.xml"/>
264 <job pattern="@version@" replacement="${version}"/>
265 <job pattern="@component.size.core@" replacement="${component.size.core}"/>
266 <job pattern="@component.size.tomcat@" replacement="${component.size.tomcat}"/>
267 <job pattern="@component.size.ant@" replacement="${component.size.ant}"/>
268 <job pattern="@component.size.imagemagick@" replacement="${component.size.imagemagick}"/>
269 <job pattern="@component.size.ghostscript@" replacement="${component.size.ghostscript}"/>
270 <job pattern="@java.min.version@" replacement="${java.min.version}"/>
271 <job pattern="@windows-java.extracted@" replacement="${windows-java.extracted}"/>
272 <job pattern="@linux-java.extracted@" replacement="${linux-java.extracted}"/>
273 </rsr>
274
275 <!-- put the concrete values of things in the text -->
276 <rsr>
277 <fileset dir="${basedir}/installer/classes/resources" includes="*.properties"/>
278 <job pattern="@version@" replacement="${version}"/>
279 <job pattern="@version.major@" replacement="${version.major}"/>
280 <job pattern="@java.min.version@" replacement="${java.min.version}"/>
281 <job pattern="@bundled.version.imagemagick@" replacement="${bundled.version.imagemagick}"/>
282 <job pattern="@bundled.version.ghostscript@" replacement="${bundled.version.ghostscript}"/>
283 <job pattern="@bundled.version.tomcat@" replacement="${bundled.version.tomcat}"/>
284 <job pattern="@bundled.version.ant@" replacement="${bundled.version.ant}"/>
285 <job pattern="@bundled.version.windows-java@" replacement="${bundled.version.windows-java}"/>
286 <job pattern="@bundled.version.linux-java@" replacement="${bundled.version.linux-java}"/>
287 </rsr>
288
289 </target>
290
291 <!-- shared target to compile the uninstaller -->
292 <target name="compile-uninstaller">
293 <echo>Compiling Uninstaller</echo>
294
295 <!-- create working build directory -->
296 <mkdir dir="${basedir}/compiled/uninstaller/build/resources" />
297
298 <!-- copile to build -->
299 <javac
300 srcdir="${rk.home}/core/uninstaller"
301 destdir="${basedir}/compiled/uninstaller/build" />
302
303 <!-- copy language bundle into place -->
304 <native2ascii
305 implementation="sun"
306 src="${rk.home}/core/language-strings"
307 dest="${basedir}/compiled/uninstaller/build/resources"/>
308
309 <!-- jar it all up -->
310 <jar
311 destfile="${basedir}/compiled/uninst.jar"
312 manifest="${rk.home}/core/uninstaller/manifest.mf"
313 basedir="${basedir}/compiled/uninstaller/build" />
314
315 </target>
316
317 <!-- copy the uninstaller script from the rk to web distribution -->
318 <target name="insert-uninstaller">
319 <copy file="${rk.home}/core/uninstaller/Uninstall.${script-format}" todir="distributions/web" />
320 </target>
321
322 <!-- unzip windows perl into bin/windows of the given gsdl or gs2build -->
323 <target name="insert-windows-perl">
324 <mkdir dir="${todir}"/>
325 <delete dir="${todir}/perl"/>
326 <unzip src="${rk.home}/windows/perl.zip" dest="${todir}"/>
327 </target>
328
329 <target name="copy-compiled-to-dist">
330
331 <!-- windows -->
332 <if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
333 <delete dir="distributions/web"/>
334 <mkdir dir="distributions"/>
335 <copy todir="distributions/web">
336 <fileset dir="compiled" includes="**/*"/>
337 </copy>
338
339 <!-- linux, mac -->
340 <else><if><bool><or><equals arg1="${rk.os}" arg2="linux"/><equals arg1="${rk.os}" arg2="mac"/></or></bool>
341 <delete dir="distributions/web"/>
342 <mkdir dir="distributions"/>
343 <exec executable="cp"><arg line="-r compiled distributions/web"/></exec>
344
345 <!-- else fail -->
346 <else>
347 <fail>this target does not support the current os</fail>
348
349 </else></if></else></if>
350
351 </target>
352
353
354</project>
Note: See TracBrowser for help on using the repository browser.