-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
146 lines (124 loc) · 5.22 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?xml version="1.0" encoding="UTF-8"?>
<project name="cw_part2" default="test">
<!-- configuration -->
<patternset id="ignored.files">
<exclude name="**/*.j"/>
</patternset>
<patternset id="compiler.resources">
<exclude name="**/?*.java"/>
<exclude name="**/?*.class"/>
</patternset>
<path id="library.classpath">
<pathelement location="${basedir}/lib/bcel-6.0-SNAPSHOT.jar"/>
<pathelement location="${basedir}/lib/hamcrest-core-1.3.jar"/>
<pathelement location="${basedir}/lib/junit-4.12.jar"/>
<pathelement location="${basedir}/lib/args4j-2.0.21.jar"/>
<pathelement location="${basedir}/lib/jasmin.jar"/>
</path>
<property name="build.dir" value="${basedir}/build"/>
<property name="classes.dir" value="${basedir}/build/classes"/>
<property name="tests.dir" value="${basedir}/build/test"/>
<property name="testreports.original.dir" value="${basedir}/test-reports/original"/>
<property name="testreports.optimised.dir" value="${basedir}/test-reports/optimised"/>
<property name="optimised.dir" value="${basedir}/optimised/classes"/>
<path id="test.original.classpath">
<pathelement location="${classes.dir}"/>
<pathelement location="${tests.dir}"/>
<path refid="library.classpath"/>
</path>
<path id="test.optimised.classpath">
<pathelement location="${optimised.dir}"/>
<pathelement location="${tests.dir}"/>
<path refid="library.classpath"/>
</path>
<path id="sources.dir">
<dirset dir="${basedir}">
<include name="src"/>
</dirset>
</path>
<path id="testsource.dir">
<dirset dir="${basedir}">
<include name="test"/>
</dirset>
</path>
<!-- build -->
<target name="compile" depends="compile.source, compile.tests, generate" description="Compile module part2"/>
<!-- build optimisation code-->
<target name="compile.source" description="Compile module part2; production classes">
<mkdir dir="${classes.dir}"/>
<javac destdir="${classes.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" fork="true" includeantruntime="false">
<classpath refid="library.classpath"/>
<src refid="sources.dir"/>
<patternset refid="ignored.files"/>
</javac>
<copy todir="${classes.dir}">
<fileset dir="${basedir}/src">
<patternset refid="compiler.resources"/>
<type type="file"/>
</fileset>
</copy>
</target>
<!-- generate the SimpleGolding classfile using Jasmin-->
<target name="generate" depends="compile.source" description="Jasmin generation of classfiles">
<java classname="jasmin.Main">
<classpath refid="library.classpath"/>
<arg line="${classes.dir}/comp0012/target/SimpleFolding.j -d ${classes.dir}"/>
</java>
</target>
<!-- build JUnit test cases -->
<target name="compile.tests" depends="compile.source" description="compile module part2; test classes" unless="skip.tests">
<mkdir dir="${tests.dir}"/>
<javac destdir="${tests.dir}" fork="true" includeantruntime="false">
<classpath refid="test.original.classpath"/>
<src refid="testsource.dir"/>
<patternset refid="ignored.files"/>
</javac>
</target>
<!-- Testing -->
<target name="test" depends="optimise,test.original,test.optimised" description="Run JUnit tests...">
</target>
<target name="test.original" depends="compile, generate" description="Run JUnit tests for original classes">
<echo message="Running unit tests for the original classes..."/>
<mkdir dir="${testreports.original.dir}"/>
<junit printsummary="true" showoutput="true" haltonfailure="true" fork="yes">
<classpath refid="test.original.classpath"/>
<formatter type="plain" usefile="true"/>
<batchtest fork="yes" todir="${testreports.original.dir}">
<fileset dir="${tests.dir}">
<include name="**/*Test.class"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="test.optimised" depends="compile, optimise, generate" description="Run JUnit tests for optimised classes">
<echo message="Running unit tests for the optimised classes..."/>
<mkdir dir="${testreports.optimised.dir}"/>
<junit printsummary="true" showoutput="true" haltonfailure="true" fork="yes">
<classpath refid="test.optimised.classpath"/>
<formatter type="plain" usefile="true"/>
<batchtest fork="yes" todir="${testreports.optimised.dir}">
<fileset dir="${tests.dir}">
<include name="**/*Test.class"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- Invoke constant folding optimisation -->
<target name="optimise" depends="generate" description="Perform constant folding">
<echo message="Running constant folding optimisation..."/>
<mkdir dir="${optimised.dir}"/>
<java classname="comp0012.main.Main">
<classpath refid="test.original.classpath"/>
<arg line="-in ${classes.dir} -out ${optimised.dir}"/>
</java>
</target>
<!-- clean up everything -->
<target name="clean" description="cleanup">
<delete dir="${build.dir}"/>
<delete dir="${classes.dir}"/>
<delete dir="${tests.dir}"/>
<delete dir="${basedir}/test-reports"/>
<delete dir="${basedir}/optimised"/>
<delete dir="${optimised.dir}"/>
</target>
</project>