GitLab will be upgraded on 30 Jan 2023 from 2.00 pm (AEDT) to 3.00 pm (AEDT). During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to us at N110 (b) CSIT building.

build.xml 13.6 KB
Newer Older
1
2
3
4
5
6
7
8
<!--
 * Copyright (c) 2009 The Australian National University.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Apache License v2.0.
 * You may obtain the license at
 * 
 *    http://www.opensource.org/licenses/apache2.0.php
 -->
9
<project name="daytrader" default="all" basedir="../..">
john's avatar
john committed
10
11
12
13
14
15
16
17
    <description>daytrader application, required by tradebeans and tradesoap</description>

    <property environment="env"/>

    <property file="ant/dacapo.properties"/>

    <property name="lib-name" value="daytrader"/>

18
    <property name="maven-central" value="http://central.maven.org/maven2"/>
john's avatar
john committed
19
20
21
22
    <property name="apache-svn-url" value="http://svn.apache.org/repos/asf"/>
    <property name="java-dev-url" value="http://download.java.net/maven"/>

    <property name="lib-svn-url" value="${apache-svn-url}/geronimo/daytrader/trunk"/>
23
    <property name="lib-svn-revision" value="1825949"/>
john's avatar
john committed
24
25
26
    <property name="lib-version" value="svn-${lib-svn-revision}"/>
    <property name="lib-src" value="daytrader-${lib-version}-src.tar.gz"/>

27
28
    <property name="ger-version" value="3.0.1"/>
    <property name="ger-name" value="geronimo-tomcat7-minimal"/>
john's avatar
john committed
29
30
31
    <property name="ger-url" value="${apache.dl.url}/geronimo/${ger-version}"/>
    <property name="ger-bin" value="${ger-name}-${ger-version}-bin.tar.gz"/>

32
33
    <property name="ger-plugins-url" value="${apache-svn-url}/geronimo/server/tags/geronimo-${ger-version}/plugins"/>
    <property name="ger-plugins-revision" value="1822921"/>
john's avatar
john committed
34
35
    <property name="ger-plugins-bin" value="${ger-name}-${ger-version}-plugins.tar.gz"/>

36
37
38
39
    <property name="geronimo-jms-version" value="1.1.1"/>
    <property name="geronimo-jms-groupId" value="org/apache/geronimo/specs/geronimo-jms_1.1_spec/${geronimo-jms-version}"/>
    <property name="geronimo-jms-url" value="${maven-central}/${geronimo-jms-groupId}"/>
    <property name="geronimo-jms-bin" value="geronimo-jms_1.1_spec-${geronimo-jms-version}.jar"/>
john's avatar
john committed
40

41
42
43
44
    <property name="xbean-asm-version" value="3.11.1"/>
    <property name="xbean-asm-groupId" value="org/apache/xbean/xbean-asm-shaded/${xbean-asm-version}"/>
    <property name="xbean-asm-url" value="${maven-central}/${xbean-asm-groupId}"/>
    <property name="xbean-asm-bin" value="xbean-asm-shaded-${xbean-asm-version}.jar"/>
john's avatar
john committed
45

46
47
48
49
    <property name="servicemix-bundles-version" value="1.6.1_2"/>
    <property name="servicemix-bundles-groupId" value="org/apache/servicemix/bundles/org.apache.servicemix.bundles.dom4j/${servicemix-bundles-version}"/>
    <property name="servicemix-bundles-url" value="${maven-central}/${servicemix-bundles-groupId}"/>
    <property name="servicemix-bundles-bin" value="org.apache.servicemix.bundles.dom4j-${servicemix-bundles-version}.jar"/>
john's avatar
john committed
50

John Zhang's avatar
John Zhang committed
51

john's avatar
john committed
52
53
54
55
56
57
    <import file="../common.xml"/>

    <property name="dt-build" location="${lib-build-dir}/daytrader"/>
    <property name="plugins-build" location="${lib-build-dir}/plugins"/>
    <property name="launcher-build" location="${lib-build-dir}/launcher"/>
    <property name="ger-home" location="${lib-build-dir}/${ger-name}-${ger-version}"/>
58
59
60
61
62
    <property name="ger-repo" location="${lib-build-dir}/${ger-name}-${ger-version}/repository"/>
    <property name="ger-cli-jar" value="${ger-home}/repository/org/apache/geronimo/framework/geronimo-cli/${ger-version}/geronimo-cli-${ger-version}.jar"/>
    <property name="ger-kernel-jar" value="${ger-home}/repository/org/apache/geronimo/framework/geronimo-kernel/${ger-version}/geronimo-kernel-${ger-version}.jar"/>
    <property name="osgi-framework-util-jar" value="${ger-home}/repository/org/osgi/org.osgi.core/4.3.1/org.osgi.core-4.3.1.jar"/>
    <property name="geronimo-main-jar" value="${ger-home}/lib/geronimo-main.jar"/>
john's avatar
john committed
63
64
65
66
67

    <condition property="shell-exe" value="cmd.exe">
        <os family="windows"/>
    </condition>
    <property name="shell-exe" value="sh"/>
68
    <condition property="geronimo-exe" value="geronimo.bat">
john's avatar
john committed
69
70
        <os family="windows"/>
    </condition>
71
72
73
74
75
    <property name="geronimo-exe" value="geronimo"/>
    <condition property="deploy-exe" value="deploy.bat">
        <os family="windows"/>
    </condition>
    <property name="deploy-exe" value="deploy"/>
john's avatar
john committed
76
77
78
79
80
    <condition property="mvn-exe" value="mvn.bat">
        <os family="windows"/>
    </condition>
    <property name="mvn-exe" value="mvn"/>

81

john's avatar
john committed
82
83
84
85
86
87
88
89
90
91
92
93
94
95
    <target name="url-source" if="ger-url">
        <antcall target="check-source">
            <param name="target-dir" value="${lib-downloads}"/>
            <param name="target-url" value="${ger-url}"/>
            <param name="target-file" value="${ger-bin}"/>
        </antcall>
        <antcall target="check-svn-source">
            <param name="svn-url" value="${ger-plugins-url}"/>
            <param name="svn-revision" value="${ger-plugins-revision}"/>
            <param name="target-file" value="${ger-plugins-bin}"/>
            <param name="target-dir" value="${lib-downloads}"/>
        </antcall>
        <antcall target="check-source">
            <param name="target-dir" value="${lib-downloads}"/>
96
97
            <param name="target-url" value="${geronimo-jms-url}"/>
            <param name="target-file" value="${geronimo-jms-bin}"/>
john's avatar
john committed
98
99
100
        </antcall>
        <antcall target="check-source">
            <param name="target-dir" value="${lib-downloads}"/>
101
102
            <param name="target-url" value="${xbean-asm-url}"/>
            <param name="target-file" value="${xbean-asm-bin}"/>
john's avatar
john committed
103
104
105
        </antcall>
        <antcall target="check-source">
            <param name="target-dir" value="${lib-downloads}"/>
106
107
            <param name="target-url" value="${servicemix-bundles-url}"/>
            <param name="target-file" value="${servicemix-bundles-bin}"/>
John Zhang's avatar
John Zhang committed
108
        </antcall>
john's avatar
john committed
109
110
111
112
113
    </target>

    <target name="unpack">
        <untar src="${lib-downloads}/${ger-bin}" dest="${lib-build-dir}" compression="gzip"/>
        <untar src="${lib-downloads}/${ger-plugins-bin}" dest="${lib-build-dir}/plugins" compression="gzip"/>
114

115
        <patch patchfile="${lib-base}/${lib-name}/geronimo-quiet-log.patch" dir="${lib-build-dir}" ignorewhitespace="yes" strip="0" failonerror="yes"/>
116

john's avatar
john committed
117
118
119
        <chmod dir="${ger-home}/bin" includes="**" perm="u+x"/>
        <mkdir dir="${dt-build}"/>
        <untar src="${lib-downloads}/${lib-src}" dest="${dt-build}/" compression="gzip"/>
120
121
122
123
124
125
126
127
128

        <copy file="${lib-data}/stocks.txt" todir="${dt-build}/javaee6/modules/web/src/main/resources/"/>
        <copy file="${lib-data}/users.txt" todir="${dt-build}/javaee6/modules/web/src/main/resources/"/>
        <copy file="${lib-data}/workload.txt" todir="${dt-build}/javaee6/modules/web/src/main/resources/"/>

        <copy file="${lib-downloads}/${geronimo-jms-bin}" todir="${ger-repo}/${geronimo-jms-groupId}"/>
        <copy file="${lib-downloads}/${xbean-asm-bin}" todir="${ger-repo}/${xbean-asm-groupId}"/>
        <copy file="${lib-downloads}/${servicemix-bundles-bin}" todir="${ger-repo}/${servicemix-bundles-groupId}"/>

john's avatar
john committed
129
130
131
132
133
134
        <copy todir="${dt-build}">
            <fileset dir="libs/${lib-name}/${lib-name}" />
        </copy>
        <copy todir="${plugins-build}">
            <fileset dir="libs/${lib-name}/plugins" />
        </copy>
135

136
        <patch patchfile="${lib-base}/${lib-name}/${lib-name}.patch" dir="${lib-build-dir}" ignorewhitespace="yes" strip="0" failonerror="yes"/>
137

john's avatar
john committed
138
139
140
141
142
143
144
145
146
147
148
149
    </target>

    <target name="jar" depends="build">
        <jar destfile="${lib-jars}/${lib-name}.jar">
            <fileset dir="${launcher-build}">
                <include name="**/*.class"/>
            </fileset>
        </jar>
    </target>

    <target name="build" depends="build.init,data">
        <mkdir dir="${launcher-build}/"/>
150
        <javac srcdir="${lib-src-dir}" destdir="${launcher-build}" classpath="${ger-cli-jar}:${ger-kernel-jar}:${osgi-framework-util-jar}:${geronimo-main-jar}" debug="true" debuglevel="lines,vars,source"/>
john's avatar
john committed
151
152
153
154
155
156
157
158
159
160
    </target>

    <target name="build.init">
        <property name="mvn-home" location="${toolsdir}/apache-maven-${mvn.version}/bin"/>
        <property name="mvn" location="${mvn-home}/${mvn-exe}"/>
    </target>

    <target name="data" depends="build.init">

        <!-- build required plugins -->
161
162
163
        <exec executable="${mvn}" dir="${lib-build-dir}/plugins/client" failonerror="yes" failifexecutionfails="yes"/>
        <exec executable="${mvn}" dir="${lib-build-dir}/plugins/cxf" failonerror="yes" failifexecutionfails="yes"/>
        <exec executable="${mvn}" dir="${lib-build-dir}/plugins/axis" failonerror="yes" failifexecutionfails="yes"/>
john's avatar
john committed
164
165
166

        <!-- build daytrader -->
        <exec executable="${mvn}" dir="${dt-build}">
John Zhang's avatar
John Zhang committed
167
            <env key="PATH" path="${env.PATH}:${toolsdir}/apache-maven-${mvn.version}/bin:${JAVA_HOME}/bin"/>
john's avatar
john committed
168
169
170
171
172
173
174
175
176
177
            <env key="GERONIMO_HOME" value="${ger-home}"/>
            <env key="MAVEN_OPTS" value="-Xms256m -Xmx512m"/>
            <arg value="clean"/>
            <arg value="install"/>
        </exec>

        <!-- deploy daytrader to geronimo -->
        <antcall target="start-geronimo"/>

        <antcall target="deploy">
178
            <param name="deploy-subject" value="${plugins-build}/client/client/target/client-${ger-version}.car"/>
john's avatar
john committed
179
180
        </antcall>
        <antcall target="deploy">
181
            <param name="deploy-subject" value="${plugins-build}/client/client-deployer/target/client-deployer-${ger-version}.car"/>
john's avatar
john committed
182
183
        </antcall>
        <antcall target="deploy">
184
            <param name="deploy-subject" value="${plugins-build}/client/client-security/target/client-security-${ger-version}.car"/>
john's avatar
john committed
185
186
        </antcall>
        <antcall target="deploy">
187
            <param name="deploy-subject" value="${plugins-build}/cxf/cxf/target/cxf-${ger-version}.car"/>
john's avatar
john committed
188
189
        </antcall>
        <antcall target="deploy">
190
            <param name="deploy-subject" value="${plugins-build}/cxf/cxf-deployer/target/cxf-deployer-${ger-version}.car"/>
john's avatar
john committed
191
192
        </antcall>
        <antcall target="deploy">
193
            <param name="deploy-subject" value="${plugins-build}/cxf/cxf-ejb/target/cxf-ejb-${ger-version}.car"/>
john's avatar
john committed
194
195
        </antcall>
        <antcall target="deploy">
196
            <param name="deploy-subject" value="${plugins-build}/cxf/cxf-ejb-deployer/target/cxf-ejb-deployer-${ger-version}.car"/>
john's avatar
john committed
197
198
        </antcall>
        <antcall target="deploy">
199
            <param name="deploy-subject" value="${plugins-build}/axis/axis/target/axis-${ger-version}.car"/>
john's avatar
john committed
200
201
202
203
        </antcall>

        <!-- daytrader -->
        <antcall target="deploy">
204
            <param name="deploy-subject" value="${dt-build}/plugins/daytrader-tomcat/target/daytrader-tomcat-3.0-SNAPSHOT.car"/>
john's avatar
john committed
205
206
        </antcall>
        <antcall target="deploy">
207
            <param name="deploy-subject" value="${dt-build}/plugins/daytrader-tomcat/target/daytrader-dacapo-3.0-SNAPSHOT.car"/>
john's avatar
john committed
208
        </antcall>
209

john's avatar
john committed
210
211
        <antcall target="stop-geronimo"/>

212

john's avatar
john committed
213
        <!-- hack to get geronimo to correctly load RMIClassLoaderSpiImpl
214
             which it only seems to load from the jar that dacapo is contained in -->
215
        <unjar src="${lib-build-dir}/${ger-name}-${ger-version}/lib/geronimo-rmi-loader.jar" dest="${bm-output-dir}">
john's avatar
john committed
216
217
218
219
220
221
            <patternset>
                <include name="**org/apache/geronimo/kernel/rmi/RMIClassLoaderSpiImpl.class"/>
                <include name="**org/apache/geronimo/kernel/rmi/RMIClassLoaderSpiImpl$ClassLoaderServerAware.class"/>
            </patternset>
        </unjar>

222
223
        <copy file="${lib-data}/client.jar" todir="${ger-home}/bin"/>

john's avatar
john committed
224
225
226
227
228
229
230
        <!-- package the resulting geronimo install as a zip -->
        <zip destfile="${lib-dat}/${lib-name}.zip">
            <fileset dir="${lib-build-dir}" includes="${ger-name}-${ger-version}/**"/>
        </zip>
    </target>

    <target name="start-geronimo">
231
232
233

        <echo message="${ger-home}/bin/${geronimo-exe}"/>
        <exec executable="${ger-home}/bin/${geronimo-exe}" dir="${ger-home}" spawn="true">
john's avatar
john committed
234
            <env key="GERONIMO_HOME" path="${ger-home}"/>
235
            <env key="JAVA_HOME" path="${jdk17home}"/>
236
237
            <arg value="start"/>
            <arg value="--clean"/>
john's avatar
john committed
238
239
        </exec>
        <echo message="Waiting for geronimo startup..."/>
240
241
        <waitfor maxwait="30" maxwaitunit="second" checkevery="1000">
            <http url="http://localhost:8080"/>
john's avatar
john committed
242
243
        </waitfor>
        <echo message="Established connection..."/>
244
        <sleep seconds="5"/>
john's avatar
john committed
245
246
    </target>
    <target name="stop-geronimo">
247
        <exec executable="${ger-home}/bin/${geronimo-exe}" dir="${ger-home}" spawn="false">
john's avatar
john committed
248
            <env key="GERONIMO_HOME" path="${ger-home}"/>
249
            <env key="JAVA_HOME" path="${jdk17home}"/>
250
251
252
253
254
255
            <arg value="stop"/>
            <arg value="-u"/>
            <arg value="system"/>
            <arg value="-p"/>
            <arg value="manager"/>
            <arg value="--clean"/>
john's avatar
john committed
256
        </exec>
257
258
259
260
261
262
        <waitfor maxwait="2" maxwaitunit="minute" checkevery="1000">
            <not>
                <http url="http://localhost:8080/console"/>
            </not>
        </waitfor>
        <sleep seconds="5"/>
john's avatar
john committed
263
264
    </target>
    <target name="deploy">
265
        <exec executable="${ger-home}/bin/${deploy-exe}">
john's avatar
john committed
266
            <env key="GERONIMO_HOME" path="${ger-home}"/>
267
            <env key="JAVA_HOME" path="${jdk17home}"/>
268
269
270
271
272
273
            <arg value="-u"/>
            <arg value="system"/>
            <arg value="-p"/>
            <arg value="manager"/>
            <arg value="install-plugin"/>
            <arg value="${deploy-subject}"/>
john's avatar
john committed
274
275
276
        </exec>
    </target>
    <target name="undeploy">
277
        <exec executable="${ger-home}/bin/${deploy-exe}">
john's avatar
john committed
278
            <env key="GERONIMO_HOME" path="${ger-home}"/>
279
280
281
282
283
284
            <arg value="-u"/>
            <arg value="system"/>
            <arg value="-p"/>
            <arg value="manager"/>
            <arg value="undeploy"/>
            <arg value="${deploy-subject}"/>
john's avatar
john committed
285
286
        </exec>
    </target>
287
</project>