root/release-kits/shared/greenstone3/ant-scripts/rk3-targets.xml @ 19979

Revision 19979, 8.0 KB (checked in by oranfry, 11 years ago)

generalised targets for preparing and compressing components

Line 
1<?xml version="1.0" encoding="utf-8" ?>
2<!--
3        ..........................................................
4        August 2008
5        Targets for Greenstone3 release kits
6        Oran Fry
7        ..........................................................
8-->
9
10<project name="rk3-targets">
11
12    <property name="version.major" value="3"/>
13
14    <!-- create the property set to be forwarded to greenstone3 -->
15    <propertyset id="forward.properties">
16        <propertyref prefix="forward."/>
17        <mapper type="glob" from="forward.*" to="*"/>
18        <propertyref name="app.version"/>
19        <propertyref name="branch.path"/>
20        <propertyref name="branch.revision"/>
21    </propertyset>
22
23    <target name="greenstone3-set-version-numbers">
24        <rsr
25            file="${greenstone3basedir}/resources/java/global.properties.in"
26            pattern="@gsdl3version@"
27            replacement="${version}" />
28    </target>
29
30    <target name="gs3-init">
31
32        <!-- don't let greenstone3 block and wait for user input to accept
33            the properties for the build -->
34        <property name="forward.properties.accepted" value="true"/>
35
36        <!-- make sure all c++ compilation is done statically -->
37        <property name="forward.compile.static" value="true"/>
38
39        <!-- show the property set to be forwarded to greenstone3 -->
40        <echo>Properties to be forwarded to greenstone3 build</echo>
41        <echoproperties><propertyset refid="forward.properties"/></echoproperties>
42
43    </target>
44
45    <target name="insert-uninstaller-jar">
46        <copy file="compiled/uninst.jar" tofile="distributions/web/uninst.jar"/>
47    </target>
48
49    <!--
50        inserts a copy of the release kit's own ant into the greenstone3
51        installation. the ant from the release kit is minified so is a good choice.
52    -->
53    <target name="insert-ant">
54
55        <!-- remove any existing ant -->
56        <delete dir="compiled/packages/ant"/>
57
58        <!-- windows copy -->
59        <if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
60            <copy todir="compiled/packages">
61                <fileset dir="${rk.home}/core" includes="ant/**/*"/>
62            </copy>
63
64        <!-- linux, mac copy-->
65        <else><if><bool><or><equals arg1="${rk.os}" arg2="linux"/><equals arg1="${rk.os}" arg2="mac"/></or></bool>
66            <exec executable="cp">
67                <arg    value="-r"/>
68                <arg value="${rk.home}/core/ant"/>
69                <arg value="compiled/packages"/>
70            </exec>
71
72        <!-- otherwise fail -->
73        <else>
74            <fail>this target does not support the current os</fail>
75
76        </else></if></else></if>
77
78    </target>
79   
80    <target name="generate-build-properties">
81        <copy file="${greenstone3.basedir}/build.properties.in" tofile="${greenstone3.basedir}/build.properties"/>
82        <if><bool><istrue value="${install.flax}"/></bool>
83            <rsr file="${greenstone3.basedir}/build.properties" pattern="^#install.flax\s*[=:].*" replacement="install.flax=true"/>
84        </if>
85        <if><bool><isset property="server.default.servlet"/></bool>
86            <rsr file="${greenstone3.basedir}/build.properties" pattern="^#?server.default.servlet\s*[=:].*" replacement="server.default.servlet=${server.default.servlet}"/>
87        </if>
88    </target>
89
90    <target name="checkout-greenstone3">
91        <svn>
92            <checkout url="${svn.root}/greenstone3/${branch.path}" destPath="compiled" revision="${branch.revision}"/>
93        <!--    <checkout url="${svn.root}/gli/${branch.path}" destPath="compiled/gli" revision="${branch.revision}"/> -->
94        </svn>
95    </target>
96
97    <target name="export-greenstone3">
98        <svn>
99            <export srcUrl="${svn.root}/greenstone3/${branch.path}" destPath="${dest}" revision="${branch.revision}"/>
100        </svn>
101    </target>
102
103    <target name="insert-xml-parser">
104        <copy todir="compiled/gs2build/perllib/cpan">
105            <fileset dir="${rk.home}/greenstone3" includes="XML-Parser/**/*"/>
106        </copy>
107    </target>
108
109    <target name="insert-documented-examples">
110        <echo>NOT IMPLEMENTED: Remember to put code in this target to grab and install the documented examples.</echo>
111        <!-- copy the doc eg colls from /home/nzdl - note we don't include the formatting ones -->
112    </target>
113
114    <target name="prepare-documentation">
115
116        <mkdir dir="compiled/gsdl-manuals"/>
117        <svn>
118            <checkout url="${svn.root}/documentation/${branch.path}/manuals" destPath="compiled/gsdl-manuals/manuals"/>
119            <checkout url="${svn.root}/documentation/${branch.path}/shared" destPath="compiled/gsdl-manuals/shared"/>
120        </svn>
121        <path id="documentation.compile.classpath">
122            <fileset dir="compiled/gsdl-manuals">
123                <include name="**/*.jar"/>
124            </fileset>
125            <pathelement path="compiled/gsdl-manuals/shared"/>
126            <pathelement path="compiled/gsdl-manuals/manuals"/>
127        </path>
128        <javac srcdir="compiled/gsdl-manuals/shared"
129            destdir="compiled/gsdl-manuals/shared"
130            debug="on"
131            classpathref="documentation.compile.classpath">
132            <include name="*.java"/>
133        </javac>
134        <unzip src="compiled/gsdl-manuals/shared/fop.zip" dest="compiled/gsdl-manuals/shared"/>
135
136        <java classname="ApplyXSLT" classpathref="documentation.compile.classpath" output="compiled/gsdl-manuals/manuals/xml-source/en/help-en.xml">
137            <arg value="compiled/gsdl-manuals/manuals/processing/gen-gli-help-to-manual-chapter.xsl" />
138            <arg value="compiled/gli/help/en/help.xml" />
139            <arg value="compiled" />
140        </java>
141
142        <chmod perm="a+x" file="compiled/gsdl-manuals/shared/fop/fop.sh"/>
143        <echo>Run generate-pdf script</echo>
144        <if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
145            <exec dir="compiled/gsdl-manuals/manuals" executable="cmd">
146                <arg value="/C" />
147                <arg file="${basedir}/compiled/gsdl-manuals/manuals/generate-pdf.bat" />
148                <arg value="u" />
149                <arg value="en" />
150            </exec>
151        <else>
152            <exec dir="compiled/gsdl-manuals/manuals" executable="/bin/bash">
153                <arg line="generate-pdf.sh u en" />
154            </exec>
155        </else></if>
156    </target>
157
158    <target name="clean">
159        <antcall target="clean-compiled"/>
160        <antcall target="clean-distributions"/>
161        <antcall target="clean-components"/>
162        <antcall target="clean-installer"/>
163        <antcall target="clean-wrapped-installer"/>
164    </target>
165
166    <target name="clean-compiled">
167        <delete dir="compiled"/>
168    </target>
169
170    <target name="clean-distribution">
171        <delete dir="distributions"/>
172    </target>
173
174    <target name="clean-components">
175        <delete dir="components"/>
176    </target>
177
178    <target name="clean-installer">
179        <delete dir="installer"/>
180    </target>
181
182    <target name="clean-wrapped-installer">
183        <delete dir="wrapped-installer"/>
184    </target>
185
186    <target name="copy-greenstone3-installer-files">
187
188        <!-- the installer descriptors -->
189        <copy todir="installer" file="${rk.home}/greenstone3/installer/antinstall-config.xml" overwrite="true"/>
190        <copy todir="installer" file="${rk.home}/greenstone3/installer/build.xml" overwrite="true"/>
191
192    </target>
193
194    <target name="clean-user-manual">
195        <copy file="distributions/web/gsdl-manuals/manuals/build/en/pdf/User_en.pdf" tofile="distributions/web/docs/manual/gs2_user_en.pdf"/>
196        <delete dir="distributions/web/gsdl-manuals"/>
197    </target>
198
199    <target name="clean-uninstaller">
200        <delete dir="distributions/web/uninstaller"/>
201    </target>
202
203
204    <!-- prepare the component named in ${component} -->
205    <target name="prepare-component">
206        <!-- delete old stuff to create new components
207        <delete dir="components/tmp/${component}" quiet="true"/>
208        <mkdir dir="components/tmp/${component}"/>
209       
210        <copy todir="components/tmp/${component}" overwrite="true">
211            <fileset dir="distributions/web">
212                <patternset refid="greenstone3.${component}.component"/>
213            </fileset>
214        </copy>
215        -->
216
217        <zip destfile="components/${component}.comp" compress="false">
218                        <zipfileset dir="distributions/web">
219                                <patternset refid="greenstone3.${component}.component"/>
220                        </zipfileset>
221        </zip>
222    </target>   
223
224    <target name="compress-component">
225        <!-- windows -->
226        <if><bool><equals arg1="${rk.os}" arg2="windows"/></bool>
227            <exec executable="${rk.home}/windows/7za/7za.exe" dir="components"><arg line="a -t7z -mx=9 ${component}.lzma ${component}.comp"/></exec>
228       
229        <!-- linux, mac -->
230        <else><if><bool><or><equals arg1="${rk.os}" arg2="linux"/><equals arg1="${rk.os}" arg2="mac"/></or></bool>
231            <sevenzip task="encode" input="components/${component}.comp" output="components/${component}.lzma" dictionnary="26"/>
232
233        <!-- else warn -->
234        <else>
235            <fail>this target does not support this os (was a new release-kit os added?)</fail>
236
237        </else></if></else></if>
238    </target>
239   
240
241</project>
Note: See TracBrowser for help on using the browser.