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 17 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="DacapoBenchmarks" default="dist" basedir=".">
john's avatar
john committed
10
11
    <property name="toolsdir" location="../tools"/>
    <property name="log.dir" value="${basedir}/log"/>
John Zhang's avatar
John Zhang committed
12
    <property environment="env"/>
john's avatar
john committed
13
14
15
16
    <tstamp>
        <format property="build.time" pattern="yyyyMMdd-hhmm"/>
    </tstamp>
    <description>
jzigman's avatar
jzigman committed
17
            The DaCapo Benchmark Suite
18

steveb-oss's avatar
steveb-oss committed
19
DEPENDENCIES:
jzigman's avatar
jzigman committed
20
        
21
22
   - javacc (http://javacc.dev.java.net/)
   - maven  (http://maven.apache.org/)
jzigman's avatar
jzigman committed
23
        
24
For convinience, both are included in the tools directory:
jzigman's avatar
jzigman committed
25
    ${toolsdir}
26

jzigman's avatar
jzigman committed
27
        
steveb-oss's avatar
steveb-oss committed
28
BUILDING:
29

jzigman's avatar
jzigman committed
30
31
    1. Set your JAVA_HOME environment variable appropriately:
        On Mac OS X:
32
            export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home            
jzigman's avatar
jzigman committed
33
        On Ubuntu 9.04:
34
            export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
jzigman's avatar
jzigman committed
35
            
36
37
38
39
40
41
42
43
44
45
46
47
    2. Set ant and maven environment variables if necessary.  In particular,
       for some jvms it is necessary to explicitly request a larger heap size.
       It is necessary to set the maven options because the trade benchmarks
       are built by maven (called by ant).  As another example, you may wish
       for ant to use a proxy when downloading (there is a lot to be
       downloaded).   Some examples:
            export ANT_OPTS="-Xms512M -Xmx512M"
            export MAVEN_OPTS="-Xms512M -Xmx512M"
       or
            export ANT_OPTS="-Dhttp.proxyHost=xxx.xxx.xxx.xxx -Dhttp.proxyPort=3128"

    3. Copy default.properties to local.properties and edit local.properties
jzigman's avatar
jzigman committed
48
       for your environment.
49

50
    4. Run ant:
jzigman's avatar
jzigman committed
51
               ant         [builds all benchmarks]
52
53
               ant dist    [builds all benchmarks, this is the default]
               ant source  [builds a source distribution including benchmarks and tools]
jzigman's avatar
jzigman committed
54
               ant bm      [builds a specific benchmark, bm]
55

56
    5. A log of directory is created under this benchmark directory
57
58
59
60
61
62
63
64
       for benchmark build status and build success or failure files
       to be stored.  The directory log directory is normally of the
       form
           ${basedir}/log/${build.time}
       and contains status.txt where each benchmark build status is recorded,
       and either pass.txt if all benchmarks build, or fail.txt if one or
       more benchmarks fail to build. Note: that either fail.txt or pass.txt
       is created when a full build is performed.
steveb-oss's avatar
steveb-oss committed
65
</description>
66

john's avatar
john committed
67
68
69
70
71
72
73
74
    <property file="local.properties"/>
    <property file="default.properties"/>
    <property file="dacapo.properties"/>
    <property name="log.build.dir" value="${log.dir}/${build.time}"/>
    <property name="log.build.report" value="${log.dir}/${build.time}/status.txt"/>
    <property name="log.build.pass" value="${log.dir}/${build.time}/pass.txt"/>
    <property name="log.build.fail" value="${log.dir}/${build.time}/fail.txt"/>

75
    <property name="dacapo.build.dir" value="${basedir}/build"/>
76
77
78
	<property name="dacapo.build.doc.dir" value="${dacapo.build.dir}/doc"/>
	<property name="dacapo.doc.dir" value="${basedir}/doc"/>
	<property name="dacapo.src.dir" value="${basedir}/src"/>
79

John Zhang's avatar
John Zhang committed
80
81
82
    <target name="check-git-present">
        <available property="git.present" file="../.git" type="dir"/>
        <property name="git.exe" value="git"/>
john's avatar
john committed
83
84
    </target>

John Zhang's avatar
John Zhang committed
85
86
87
88
    <target name="extract-git-revision" depends="check-git-present" if="git.present">
        <exec executable="${git.exe}" failonerror="no" failifexecutionfails="no">
            <arg line="show --abbrev-commit HEAD"/>
            <redirector outputproperty="git.revision">
john's avatar
john committed
89
                <outputfilterchain>
John Zhang's avatar
John Zhang committed
90
91
92
                    <linecontainsregexp>
                        <regexp pattern="^commit [a-z0-9]+$"/>
                    </linecontainsregexp>
john's avatar
john committed
93
                    <tokenfilter>
John Zhang's avatar
John Zhang committed
94
                        <replacestring from="commit " to=""/>
john's avatar
john committed
95
96
97
98
99
100
                    </tokenfilter>
                </outputfilterchain>
            </redirector>
        </exec>
    </target>

John Zhang's avatar
John Zhang committed
101
    <target name="get-git-revision" depends="extract-git-revision" unless="git.revision">
john's avatar
john committed
102
        <!-- set property if not already set -->
John Zhang's avatar
John Zhang committed
103
        <property name="git.revision" value="unknown"/>
john's avatar
john committed
104
105
    </target>

John Zhang's avatar
John Zhang committed
106
    <target name="set-build-version-info" depends="get-git-revision">
john's avatar
john committed
107
        <property name="build.nickname" value="development"/>
John Zhang's avatar
John Zhang committed
108
        <property name="build.version"  value="head-r${git.revision}"/>
john's avatar
john committed
109
110
    </target>

111
112
113
114
115
116
117
118
119
120
121
122
123
124
    <target name="init" depends="set-build-version-info">
        <!-- Create the time stamp -->
        <tstamp/>
        <delete dir="${log.build.dir}" />
        <delete dir="${dacapo.build.doc.dir}"/>
        <delete dir="${dacapo.build.dir}" />

        <mkdir dir="${log.build.dir}" />
        <mkdir dir="${dacapo.build.dir}" />
        <mkdir dir="${dacapo.build.doc.dir}"/>
    	
        <echo>build.nickname=${build.nickname}</echo>
        <echo>build.version=${build.version}</echo>
    </target>
john's avatar
john committed
125
126
127
128

    <!-- BEGIN PUBLIC TARGETS -->

    <!-- =================================
129
130
         target: source
         ================================= -->
john's avatar
john committed
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
    <target name="source" depends="set-build-version-info">
        <echo file="SOURCE_VERSION.txt">This source distribution was built from DaCapo release ${build.version} "${build.nickname}"${line.separator}</echo>

        <zip destfile="dacapo-src.zip" level="9" whenempty="create">
            <zipfileset dir="${basedir}/.." defaultexcludes="yes" filemode="755">
                <include name="tools/*/bin/**"/>
            </zipfileset>
            <zipfileset dir="${basedir}/.." defaultexcludes="yes">
                <!-- add source readme indicating where this is from -->
                <include name="benchmarks/SOURCE_VERSION.txt"/>

                <!-- benchmark top level source -->
                <include name="benchmarks/*.xml"/>
                <include name="benchmarks/dacapo.properties"/>
                <include name="benchmarks/default.properties"/>
                <include name="benchmarks/CHANGES.txt"/>
                <include name="benchmarks/LICENSE-2.0.txt"/>
                <include name="benchmarks/README.txt"/>
                <include name="benchmarks/RELEASE_NOTES.txt"/>

                <!-- benchmark harness source -->
                <include name="benchmarks/harness/*.xml"/>
                <include name="benchmarks/harness/downloads/**.MD5"/>
                <include name="benchmarks/harness/src/**"/>

                <!-- libs source -->
                <include name="benchmarks/libs/*.xml"/>
                <include name="benchmarks/libs/*/*.xml"/>
                <include name="benchmarks/libs/*/*.patch"/>
                <include name="benchmarks/libs/*/*.pl"/>
                <include name="benchmarks/libs/*/data/**"/>
                <include name="benchmarks/libs/*/downloads/**.MD5"/>
                <include name="benchmarks/libs/*/src/**"/>

                <!-- add benchmark xml -->
                <include name="benchmarks/bms/*.xml"/>

                <!-- add each benchmark -->
                <include name="benchmarks/bms/*/*.cnf"/>
                <include name="benchmarks/bms/*/*.patch"/>
                <include name="benchmarks/bms/*/*.xml"/>
                <include name="benchmarks/bms/*/*.properties"/>
                <include name="benchmarks/bms/*/META-INF/**"/>
                <include name="benchmarks/bms/*/data/**"/>
                <include name="benchmarks/bms/*/downloads/**.MD5"/>
                <include name="benchmarks/bms/*/src/**"/>

                <!-- add eclipse's plugin -->
                <include name="benchmarks/bms/eclipse/plugin/META-INF/**"/>
                <include name="benchmarks/bms/eclipse/plugin/src/**"/>
                <include name="benchmarks/bms/eclipse/plugin/*.xml"/>
                <include name="benchmarks/bms/eclipse/plugin/build.properties"/>
                <include name="benchmarks/bms/eclipse/plugin/javaCompiler...args"/>
                <include name="benchmarks/bms/eclipse/bundles-default.lst"/>
                <include name="benchmarks/bms/eclipse/bundles-required.lst"/>
                <include name="benchmarks/bms/eclipse/bundles-stub-required.lst"/>

                <!-- add tools -->
                <include name="tools/**"/>

                <!-- exclude svn -->
                <exclude name="benchmarks/**/.svn"/>

                <!-- exclude defunct benchmarks -->
                <exclude name="benchmarks/bms/antlr/**"/>
                <exclude name="benchmarks/bms/bloat/**"/>
                <exclude name="benchmarks/bms/chart/**"/>
                <exclude name="benchmarks/bms/hsqldb/**"/>
                <exclude name="tools/*/bin/**"/>
            </zipfileset>
        </zip>
    </target>

    <!-- ================================= 
205
206
         target: dist              
         ================================= -->
john's avatar
john committed
207
208
209
    <target name="dist" depends="harness,compile">
        <move file="dacapo.jar" tofile="dacapo-${DSTAMP}.jar"/>
    </target>
210

211
212
213
    <target name="doc" depends="init,bootstrap,harness" description="make the top level documentation">
    	
    	<jar /> 
john's avatar
john committed
214
    </target>
215

216
	
217
218
219
220
    <!-- =================================
         target: bootstrap for running harness
         ================================= -->
    <target name="bootstrap" depends="init">
221
    	<!-- construct the bootstrap -->
222
223
        <javac srcdir="${dacapo.src.dir}" destdir="${dacapo.build.dir}"/>

224
225
226
227
228
229
    	<!-- set the manifest for the jar -->
        <copy file="${dacapo.src.dir}/META-INF/MANIFEST.MF" todir="${dacapo.build.dir}"/>
        <echo file="${dacapo.build.dir}/MANIFEST.MF" append="yes">Specification-Version: ${build.nickname}${line.separator}</echo>
        <echo file="${dacapo.build.dir}/MANIFEST.MF" append="yes">Implementation-Version: ${build.version}${line.separator}</echo>

    	<!-- form the top level info -->
John Zhang's avatar
John Zhang committed
230
231
        <copy file="${basedir}/../LICENSE" todir="${dacapo.build.dir}"/>
        <copy file="${basedir}/../README.md" todir="${dacapo.build.dir}"/>
232
233
        <copy file="${basedir}/RELEASE_NOTES.txt" todir="${dacapo.build.dir}"/>

234
    	<!-- this forms the base document section -->
John Zhang's avatar
John Zhang committed
235
236
        <copy file="${basedir}/../LICENSE" todir="${dacapo.build.dir}"/>
        <copy file="${basedir}/../README.md" todir="${dacapo.build.dir}"/>
237
238
239
240
241
		<copy file="${basedir}/RELEASE_NOTES.txt" todir="${dacapo.build.doc.dir}" />

		<copy todir="${dacapo.build.doc.dir}">
			<fileset dir="${dacapo.doc.dir}"/>
		</copy>
242

243
    	<!-- construct the base jar -->
244
245
246
247
        <jar jarfile="${jar-target}" basedir="${dacapo.build.dir}" update="false" manifest="${dacapo.build.dir}/MANIFEST.MF" excludes="MANIFEST.MF"/>
    </target>

    <target name="clean-bootstrap" depends="init">
248
        <delete dir="${dacpao.build.doc.dir}"/>
249
250
251
        <delete dir="${dacpao.build.dir}"/>
    </target>

john's avatar
john committed
252
    <!-- ================================= 
253
254
         target: compile  all sources
         ================================= -->
john's avatar
john committed
255
256
257
258
    <target name="compile" depends="avrora,batik,h2,eclipse,fop,jython,luindex,lusearch,pmd,sunflow,tradebeans,tradesoap,tomcat,xalan">
        <antcall target="build.status.fail" />
        <antcall target="build.status.pass" />
    </target>
259
	
john's avatar
john committed
260
    <!-- ================================= 
261
262
         target: harness           
         ================================= -->
263
    <target name="harness" depends="init,bootstrap" description="compile the source ">
john's avatar
john committed
264
265
        <ant antfile="harness/build.xml"/>
    </target>
266
	
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
    <target name="clean-harness" depends="init">
        <ant antfile="harness/build.xml" target="clean"/>
    </target>

    <!-- *************************************************************************** -->
    <!--                            Clean                                            -->
    <!-- *************************************************************************** -->

    <macrodef name="clean.bm">
        <attribute name="benchmark"/>
        <sequential>
            <exec executable="ant" failifexecutionfails="no" failonerror="no" resultproperty="clean-@{benchmark}-status">
                <arg value="-Dtoolsdir=${toolsdir}"/>
                <arg value="-Dbuild.time=${build.time}"/>
                <arg value="-Dlog.build.dir=${log.build.dir}"/>
                <arg value="-buildfile"/>
                <arg value="bms/@{benchmark}/build.xml"/>
                <arg value="clean"/>
            </exec>
        </sequential>
    </macrodef>
 
    <target name="clean-benchmarks" depends="init">
        <clean.bm benchmark="avrora"/>
        <clean.bm benchmark="batik"/>
        <clean.bm benchmark="h2"/>
        <clean.bm benchmark="eclipse"/>
        <clean.bm benchmark="fop"/>
        <clean.bm benchmark="jython"/>
        <clean.bm benchmark="luindex"/>
        <clean.bm benchmark="lusearch"/>
        <clean.bm benchmark="pmd"/>
        <clean.bm benchmark="sunflow"/>
        <clean.bm benchmark="tomcat"/>
        <clean.bm benchmark="tradebeans"/>
        <clean.bm benchmark="tradesoap"/>
        <clean.bm benchmark="xalan"/>
    </target>

    <target name="clean" depends="clean-benchmarks,clean-harness,clean-bootstrap"/>
  
john's avatar
john committed
308
309
310
311
312
    <!-- *************************************************************************** -->
    <!--                            Build                                            -->
    <!-- *************************************************************************** -->
    <target name="build.status.fail" if="build.failed">
        <echo level="error">
313
314
build: FAIL
See ${log.build.report} for a summary of benchmark build status.
john's avatar
john committed
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
    </echo>
        <echo file="${log.build.fail}" level="error" message="build: FAIL${line.separator}"/>
    </target>

    <target name="build.status.pass" unless="build.failed">
        <echo level="error" message="build: PASS${line.separator}"/>
        <echo file="${log.build.pass}" level="error" message="build: PASS${line.separator}"/>
    </target>

    <macrodef name="build.bm">
        <attribute name="benchmark"/>
        <sequential>
            <exec executable="ant" failifexecutionfails="no" failonerror="no" resultproperty="@{benchmark}-status">
                <arg value="-Dtoolsdir=${toolsdir}"/>
                <arg value="-Dbuild.time=${build.time}"/>
                <arg value="-Dlog.build.dir=${log.build.dir}"/>
                <arg value="-buildfile"/>
                <arg value="bms/@{benchmark}/build.xml"/>
                <arg value="incremental"/>
            </exec>
            <condition property="@{benchmark}.failed">
                <isfailure code="${@{benchmark}-status}"/>
            </condition>
            <condition property="@{benchmark}.message" value="FAIL" else="PASS">
                <isset property="@{benchmark}.failed"/>
            </condition>
            <condition property="build.failed">
                <and>
                    <not>
                        <isset property="build.failed"/>
                    </not>
                    <isset property="@{benchmark}.failed"/>
                </and>
            </condition>
            <echo level="error" message="@{benchmark}: ${@{benchmark}.message}${line.separator}"/>
            <echo file="${log.build.report}" append="true" level="error" message="@{benchmark}: ${@{benchmark}.message}${line.separator}"/>
            <fail message="@{benchmark}: FAIL">
                <condition>
                    <and>
                        <istrue value="${build.failonerror}"/>
                        <isset property="@{benchmark}.failed"/>
                    </and>
                </condition>
            </fail>
        </sequential>
    </macrodef>

    <target name="avrora" depends="init,harness">
        <build.bm benchmark="avrora"/>
    </target>
    <target name="batik" depends="init,harness">
        <build.bm benchmark="batik"/>
    </target>
    <target name="h2" depends="init,harness">
        <build.bm benchmark="h2"/>
    </target>
    <target name="eclipse" depends="init,harness">
        <build.bm benchmark="eclipse"/>
    </target>
    <target name="fop" depends="init,harness">
        <build.bm benchmark="fop"/>
    </target>
    <target name="jython" depends="init,harness">
        <build.bm benchmark="jython"/>
    </target>
    <target name="luindex" depends="init,harness">
        <build.bm benchmark="luindex"/>
    </target>
    <target name="lusearch" depends="init,harness">
        <build.bm benchmark="lusearch"/>
    </target>
    <target name="pmd" depends="init,harness">
        <build.bm benchmark="pmd"/>
    </target>
    <target name="sunflow" depends="init,harness">
        <build.bm benchmark="sunflow"/>
    </target>
    <target name="tomcat" depends="init,harness">
        <build.bm benchmark="tomcat"/>
    </target>
    <target name="tradebeans" depends="init,harness">
        <build.bm benchmark="tradebeans"/>
    </target>
    <target name="tradesoap" depends="init,harness">
        <build.bm benchmark="tradesoap"/>
    </target>
    <target name="xalan" depends="init,harness">
        <build.bm benchmark="xalan"/>
    </target>
404
</project>