root/release-kits/wirk3/ant-scripts/init.xml @ 15181

Revision 15181, 6.3 KB (checked in by oranfry, 12 years ago)

adding the ant installer task back into wirk3

Line 
1<?xml version="1.0" encoding="utf-8" ?>
2
3<!--
4        ..........................................................
5        September 2007
6        Greenstone3 'release maker' script
7        Oran Fry
8        ..........................................................
9-->
10
11<project name="wirk3-init">
12
13    <!-- classpath -->
14    <path id="project.classpath">
15        <fileset dir="${wirk3.home}/ant-scripts/tasks">
16            <include name="**/*.jar"/>
17        </fileset>
18        <fileset dir="${wirk3.home}/lib">
19            <include name="*.jar"/>
20        </fileset>
21       
22        <pathelement path="${wirk3.home}/ant-scripts/tasks/orans"/>
23
24        <!-- antinstaller -->
25        <pathelement path="${wirk3.home}/bin/ant-installer/lib/ant-installer-ext.jar"/>
26       
27    </path>
28   
29    <!-- create a localised basedir property -->
30    <path id="basedir.path">
31        <pathelement location="${basedir}"/>
32    </path>
33    <property name="basedir.local" refid="basedir.path"/>
34
35    <!-- svn root -->
36    <property name="svn.root" value="http://svn.greenstone.org"/>
37
38    <!-- self defined tasks and types-->
39    <taskdef name="if" classname="ise.antelope.tasks.IfTask" classpathref="project.classpath"/>
40    <taskdef name="try" classname="ise.antelope.tasks.TryTask" classpathref="project.classpath"/>
41    <taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" classpathref="project.classpath"/>
42    <taskdef name="setloglevel" classname="SetLogLevel" classpathref="project.classpath"/>
43    <taskdef name="installer" classname="org.tp23.antinstaller.taskdefs.Installer" classpathref="project.classpath"/>
44   
45    <typedef name="addressedcall" classname="TreeCallTarget" classpathref="project.classpath"/>
46    <typedef name="rsr" classname="RegexSearchReplace" classpathref="project.classpath"/>
47
48
49    <!-- load in static properties from build.properties -->
50    <property file="build.properties" />
51
52    <!-- project details (for ant-installer) -->
53    <property name="project.name"                   value="Greenstone3"/>
54    <property name="project.short.name"         value="greenstone3"/>
55    <property name="project.path"                   value="${basedir}/distribution/greenstone3"/>
56    <property name="project.installer.path" value="${wirk3.home}/installer"/>
57    <property name="project.version"                value="${version}"/>
58    <property name="ant.installer.home"         value="${wirk3.home}/bin/ant-installer"/>
59
60    <!-- somewhere to store temporary text -->
61    <tempfile property="temp.file" destdir="${java.io.tmpdir}" prefix="delete" suffix=".tmp"/>
62
63    <!-- stuff to do before all tasks -->
64    <target name="init">
65
66        <echo level="info">CHECKING PRE-CONDITIONS</echo>
67        <echo level="info"/>
68
69        <!-- version number -->
70        <echo level="info">Version number...</echo>
71        <if>
72            <bool>
73                <not><isset property="version"/></not>
74            </bool>
75
76            <!-- version not set in build.properties, try get from repository -->
77            <setloglevel level="error"/>
78            <try>
79                <get src="${svn.root}/greenstone3/${branch.path}/version.properties" dest="${temp.file}"/>
80                <catch>
81                    <echo level="error">Not set in build.properties or repository version.properties</echo>
82                    <fail>Version number not set</fail>
83                </catch>
84            </try>
85            <setloglevel level="info"/>
86
87            <property file="${temp.file}"/>
88
89            <if>
90                <bool>
91                    <not><isset property="version"/></not>
92                </bool>
93                <echo level="error">version.properties exists, but doesn't set version string</echo>
94                <fail>Version number not set</fail>
95            </if>
96
97            <echo level="info">Taken from repository version.properties</echo>
98
99            <else>
100                <echo level="info">Taken from build.properties</echo>
101            </else>
102
103        </if>
104
105        <echo level="info">Version number: ${version}</echo>
106        <property name="app.version" value="${version}"/>
107        <echo level="info"/>
108
109
110        <!-- check resume from -->
111        <echo level="info">Checking if we are resuming from a given target...</echo>
112        <if>
113            <bool><not><isset property="resume.from"/></not></bool>
114            <echo level="info">No, start from the beginning</echo>
115            <else>
116                <echo level="info">Yes, resuming from ${resume.from}</echo>
117            </else>
118        </if>
119        <echo level="info"/>
120
121        <!-- check resume to -->
122        <echo level="info">Checking if we are resuming up to a given target...</echo>
123        <if>
124            <bool><not><isset property="resume.to"/></not></bool>
125            <echo level="info">No, stop at the end</echo>
126            <else>
127                <echo level="info">Yes, resuming from ${resume.to}</echo>
128            </else>
129        </if>
130        <echo level="info"/>
131
132
133        <!-- check resume mode-->
134        <echo level="info">Determining resume mode...</echo>
135        <if>
136            <bool>
137                <not><isset property="resume.mode"/></not>
138            </bool>
139            <echo level="info">Mode not set, just fall through</echo>
140            <else>
141                <echo level="info">Mode set to ${resume.mode}</echo>
142                <if>
143                    <bool>
144                        <not><equals arg1="${resume.mode}" arg2="descend"/></not>
145                    </bool>
146                    <echo level="error">You have not specified a valid resume mode.</echo>
147                    <echo level="error">Valid modes are 'descend' and null.</echo>
148                    <fail>You have not specified a valid resume mode.</fail>
149                </if>
150            </else>
151        </if>
152        <echo level="info"/>
153
154        <!-- execute target code or just traverse tree -->
155        <echo level="info">Determining execute mode...</echo>
156        <if>
157            <bool>
158                <not><isset property="execute"/></not>
159            </bool>
160            <echo level="info">Execute not set, defaulting to 'true'</echo>
161            <property name="execute" value="true"/>
162            <else>
163                <echo level="info">Execute set to ${execute}</echo>
164                <if>
165                    <bool>
166                        <and>
167                            <not><equals arg1="${execute}" arg2="true"/></not>
168                            <not><equals arg1="${execute}" arg2="false"/></not>
169                        </and>
170                    </bool>
171                    <echo level="error">You have not specified a valid value for execute.</echo>
172                    <echo level="error">Valid values are 'true' and 'false'.</echo>
173                    <fail>You have not specified a valid value for execute.</fail>
174                </if>
175            </else>
176        </if>
177
178        <echo level="info"/>
179
180
181        <!-- check branch.path -->
182        <echo level="info">Determining the branch path...</echo>
183        <if>
184            <bool><not><isset property="branch.path"/></not></bool>
185            <fail>You have not specified a branch path where code will come from in the repository</fail>
186        </if>
187
188        <echo level="info">Branch Path: ${branch.path}</echo>
189        <echo level="info"/>
190       
191        <!-- check branch.revision -->
192        <echo level="info">Determining the branch revision...</echo>
193        <if>
194            <bool><not><isset property="branch.revision"/></not></bool>
195            <property name="branch.revision" value="HEAD"/>
196            <!--<echo level="info">No branch revision specified, defaulting to HEAD</echo>-->
197        </if>
198
199        <echo level="info">Branch Revision: ${branch.revision}</echo>
200        <echo level="info"/>
201
202    </target>
203
204</project>
Note: See TracBrowser for help on using the browser.