-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
273 lines (224 loc) · 9.25 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
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
<?xml version="1.0" ?>
<!--
build.xml - generic JPF extension build script
using Ant (http://jakarta.apache.org/ant)
public targets:
compile compile JPF and its specific (modeled) environment libraries
test run all JPF tests
jar build JPF jar files
dist build binary distribution
clean remove the files that have been generated by the build process
-->
<project name="jpf-symbc" default="build" basedir=".">
<!-- ========================== COMMON SECTION ========================== -->
<!--
local props have to come first, because Ant properties are immutable
NOTE: this file is local - it is never in the repository!
-->
<property file="local.properties"/>
<property environment="env"/>
<!-- this is where we get the 'jpf.core' location from -->
<property file="${user.home}/.jpf/site.properties"/>
<!-- if there is none, default to a 'jpf-core' peer dir -->
<property name="jpf-core" value = "../jpf-core"/>
<!-- get the jpf-core path properties -->
<property file="${jpf-core}/jpf.properties"/>
<!-- compiler settings -->
<property name="src_level" value="8"/>
<property name="debug" value="on"/>
<property name="deprecation" value="on"/>
<!-- generic classpath settings -->
<path id="lib.path">
<!-- our own classes and libs come first -->
<pathelement location="build/main"/>
<!-- we don't have these
<pathelement location="build/peers"/>
-->
<fileset dir=".">
<include name="lib/*.jar"/>
</fileset>
<!-- add in what we need from the core -->
<pathelement path="${jpf-core.native_classpath}"/>
</path>
<!-- init: common initialization -->
<target name="-init">
<tstamp/>
<mkdir dir="build"/> <!-- the build root -->
<!-- the things that have to be in the classpath of whatever runs Ant -->
<available property="have_javac" classname="com.sun.tools.javac.Main"/>
<fail unless="have_javac">no javac found</fail>
<available file="src/main" type="dir" property="have_main"/>
<available file="src/annotations" type="dir" property="have_annotations"/>
<available file="src/peers" type="dir" property="have_peers"/>
<available file="src/classes" type="dir" property="have_classes"/>
<available file="src/tests" type="dir" property="have_tests"/>
<available file="src/examples" type="dir" property="have_examples"/>
<condition property="have_jvm_code">
<or>
<isset property="have_main"/>
<isset property="have_peers"/>
</or>
</condition>
<condition property="have_jpf_code">
<or>
<isset property="have_classes"/>
<isset property="have_annotations"/>
</or>
</condition>
<!-- optionally set the required artifacts here
<fail unless="have_main">no src/main</fail>
<fail unless="have_annotations">no src/annotations</fail>
<fail unless="have_peers">no src/peers</fail>
<fail unless="have_classes">no src/classes</fail>
<fail unless="have_tests">no src/tests</fail>
<fail unless="have_examples">no src/examples</fail>
-->
</target>
<!-- ======================= COMPILE SECTION ============================= -->
<!-- public compile -->
<target name="compile" depends="-init,-compile-annotations,-compile-main,-compile-peers,-compile-classes,-compile-tests,-compile-examples"
description="compile all JPF core sources" >
</target>
<target name="-compile-annotations" if="have_annotations">
<mkdir dir="build/annotations"/>
<javac srcdir="src/annotations" destdir="build/annotations"
debug="${debug}" source="${src_level}" deprecation="${deprecation}" classpath="" includeantruntime="false" />
</target>
<target name="-compile-main" if="have_main">
<mkdir dir="build/main"/>
<javac srcdir="src/main" destdir="build/main"
debug="${debug}" source="${src_level}" deprecation="${deprecation}"
classpathref="lib.path"
includeantruntime="false"/>
</target>
<target name="-compile-peers" if="have_peers" depends="-compile-main" >
<mkdir dir="build/peers"/>
<javac srcdir="src/peers" destdir="build/peers"
debug="${debug}" source="${src_level}" deprecation="${deprecation}"
classpathref="lib.path"
includeantruntime="false"/>
</target>
<target name="-compile-classes" if="have_classes" depends="-compile-annotations,-compile-main" >
<mkdir dir="build/classes"/>
<javac srcdir="src/classes" destdir="build/classes"
debug="${debug}" source="${src_level}" deprecation="${deprecation}"
includeantruntime="false">
<classpath>
<path refid="lib.path"/>
<pathelement location="build/annotations"/>
</classpath>
</javac>
</target>
<target name="-compile-tests" if="have_tests" depends="-compile-annotations,-compile-main">
<mkdir dir="build/tests"/>
<javac srcdir="src/tests" destdir="build/tests"
debug="${debug}" source="${src_level}" deprecation="${deprecation}"
includeantruntime="false">
<classpath>
<path refid="lib.path"/>
<pathelement location="build/classes"/>
<pathelement location="build/annotations"/>
</classpath>
</javac>
</target>
<target name="-compile-examples" if="have_examples" depends="-compile-annotations,-compile-main">
<mkdir dir="build/examples" />
<javac srcdir="src/examples" destdir="build/examples"
debug="${debug}" source="${src_level}" deprecation="${deprecation}"
includeantruntime="false">
<classpath>
<path refid="lib.path"/>
<pathelement location="build/classes"/>
<pathelement location="build/annotations"/>
</classpath>
</javac>
</target>
<!-- ======================= MISC SECTION ================================ -->
<!-- build jars -->
<target name="build" depends="compile,-jar-jvm,-jar-jpf,-jar-annotations"
description="generate the ${ant.project.name} jar files" >
</target>
<target name="-jar-jvm" if="have_jvm_code">
<jar jarfile="build/${ant.project.name}.jar">
<fileset dir="build/main"/>
<fileset dir="build/peers"/>
</jar>
</target>
<target name="-jar-jpf" if="have_jpf_code">
<jar jarfile="build/${ant.project.name}-classes.jar">
<fileset dir="build/classes"/>
<fileset dir="build/annotations"/>
</jar>
</target>
<target name="-jar-annotations" if="have_annotations">
<!-- optional jar that contains annotations to be used in non-JPF dependent apps -->
<jar jarfile="build/${ant.project.name}-annotations.jar">
<fileset dir="build/annotations"/>
</jar>
</target>
<target name="dist" description="build binary distribution">
<delete file="build/${ant.project.name}.zip"/>
<!-- 2do this seems stupid - there needs to be a better way to re-base (zip basedir fails miserably) -->
<zip destfile="build/${ant.project.name}.zip" update="false" excludes="*">
<zipfileset file="jpf.properties" prefix="${ant.project.name}"/>
<!-- don't have one
<zipfileset dir="lib" prefix="${ant.project.name}/lib"/>
-->
<zipfileset dir="bin" prefix="${ant.project.name}/bin"/>
<zipfileset dir="build" includes="*.jar" prefix="${ant.project.name}/build"/>
<zipfileset dir="tools" includes="Run*.jar" prefix="${ant.project.name}/tools"/>
</zip>
</target>
<!-- public clean: cleanup from previous tasks/builds -->
<target name="clean">
<delete dir="build" />
<delete>
<fileset dir="." includes="**/*~" defaultexcludes="no" />
<fileset dir="." includes="**/*.bak" defaultexcludes="no" />
<fileset dir="." includes="**/error.xml" />
</delete>
</target>
<!-- ======================= TEST SECTION ================================ -->
<target name="test" depends="build"
description="compile and run core regression tests" if="have_tests">
<fail unless="env.JUNIT_HOME">
The JUNIT_HOME environment variable must be set.
</fail>
<!-- note this can be directly set in local.properties, which overrides this setting -->
<property name="junit.home" value="${env.JUNIT_HOME}"/>
<property name="junit.usefile" value="false"/>
<junit printsummary="withOutAndErr" logfailedtests="true" showoutput="off" haltonfailure="yes"
fork="yes" forkmode="perTest" maxmemory="1024m">
<formatter type="plain" usefile="${junit.usefile}"/>
<classpath>
<path refid="lib.path"/>
<pathelement location="build/tests"/>
<pathelement location="build/classes"/>
<pathelement location="build/annotations"/>
<fileset dir="${junit.home}">
<include name="**/*.jar"/>
</fileset>
</classpath>
<batchtest todir="build/tests">
<fileset dir="build/tests">
<exclude name="**/JPF_*.class"/>
<include name="**/Test*.class"/>
<exclude name="**/TestBitwise*.class"/>
<exclude name="**/TestCoverage.class"/>
<exclude name="**/TestDIV.class"/>
<exclude name="**/TestExJPF.class"/>
<exclude name="**/TestLazy*.class"/>
<exclude name="**/TestLazy*.class"/>
<exclude name="**/TestPathCondition.class"/>
<exclude name="**/TestStringBuilder.class"/>
<exclude name="**/strings/*.class"/>
<exclude name="/gov/nasa/jpf/symbc/strings/*.class"/>
<exclude name="**/Test*$*.class"/>
<exclude name="**/TestSymbolicListener.class"/>
<exclude name="**/TestSymbolicOutput.class"/>
<exclude name="**/TestSymbolicJPF.class"/>
</fileset>
</batchtest>
</junit>
</target>
</project>