forked from star-finder/jpf-costar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
326 lines (257 loc) · 11.6 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
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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
<?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-costar" 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 dependent project properties -->
<property file="${jpf-core}/jpf.properties"/>
<!-- if there is none, default to a 'starlib' peer dir -->
<property name="starlib" value = "../starlib"/>
<!-- get the starlib path properties -->
<property file="${starlib}/jpf.properties"/>
<property name="jpf-star" value = "../jpf-star"/>
<!-- get the jpf-star path properties -->
<property file="${jpf-star}/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 projects we depend on -->
<pathelement path="${jpf-core.native_classpath}"/>
<!-- add in what we need from the jpf-star -->
<pathelement path="${jpf-star.native_classpath}"/>
<pathelement path="${jpf-star.classpath}"/>
<!-- add in what we need from the starlib -->
<pathelement path="${starlib.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>
<!-- <fail unless="env.JUNIT_HOME">
The JUNIT_HOME environment variable must be set.
</fail>
<property name="junit.home" value="${env.JUNIT_HOME}"/>
-->
<!-- 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" includeantruntime="false"
debug="${debug}" source="${src_level}" deprecation="${deprecation}"
classpath=""/>
</target>
<target name="-compile-main" if="have_main">
<mkdir dir="build/main"/>
<javac srcdir="src/main" destdir="build/main" includeantruntime="false"
debug="${debug}" source="${src_level}" deprecation="${deprecation}"
classpathref="lib.path"/>
</target>
<target name="-compile-peers" if="have_peers" depends="-compile-main" >
<mkdir dir="build/peers"/>
<javac srcdir="src/peers" destdir="build/peers" includeantruntime="false"
debug="${debug}" source="${src_level}" deprecation="${deprecation}"
classpathref="lib.path"/>
</target>
<target name="-compile-classes" if="have_classes" depends="-compile-annotations,-compile-main" >
<mkdir dir="build/classes"/>
<javac srcdir="src/classes" destdir="build/classes" includeantruntime="false"
debug="${debug}" source="${src_level}" deprecation="${deprecation}" >
<classpath>
<path refid="lib.path"/>
<pathelement location="build/annotations"/>
</classpath>
</javac>
</target>
<target name="-compile-tests" if="have_tests" depends="-compile-annotations,-compile-main,-compile-examples">
<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/main"/>
<pathelement location="build/examples"/>
<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" includeantruntime="false"
debug="${debug}" source="${src_level}" deprecation="${deprecation}">
<classpath>
<path refid="lib.path"/>
<pathelement location="build/annotations"/>
</classpath>
</javac>
</target>
<target name="build-output">
<mkdir dir="build/output"/>
<javac srcdir="src/output" destdir="build/output"
debug="${debug}" source="${src_level}" deprecation="${deprecation}"
includeantruntime="false">
<classpath>
<path refid="lib.path"/>
<pathelement location="build/main"/>
<pathelement location="build/examples"/>
</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 #1. Set property value depends on check result -->
<target name="check-dir">
<available property="tmp.dir" file="build/tmp" type="dir"/>
</target>
<!-- target #2. Create dir 'tmp' if doesn't exist -->
<target name="create-tmp-dir" depends="check-dir" unless="tmp.dir">
<mkdir dir="build/tmp"/>
</target>
<target name="-jar-jvm" if="have_jvm_code">
<jar jarfile="build/${ant.project.name}.jar" whenmanifestonly="skip">
<fileset dir="build/main" erroronmissingdir="false"/>
<fileset dir="build/peers" erroronmissingdir="false"/>
</jar>
</target>
<target name="-jar-jpf" if="have_jpf_code">
<jar jarfile="build/${ant.project.name}-classes.jar" whenmanifestonly="skip">
<fileset dir="build/classes" erroronmissingdir="false"/>
<fileset dir="build/annotations" erroronmissingdir="false"/>
</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" whenmanifestonly="skip">
<fileset dir="build/annotations" erroronmissingdir="false"/>
</jar>
</target>
<!-- build distribution zips -->
<target name="dist" description="build binary distribution" depends="build">
<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}"/>
<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>
<target name="src-dist" description="build source distribution">
<delete file="build/${ant.project.name}-src.zip"/>
<zip destfile="build/${ant.project.name}-src.zip" update="false" excludes="*">
<zipfileset file="jpf.properties" prefix="${ant.project.name}"/>
<zipfileset file="build.xml" prefix="${ant.project.name}"/>
<zipfileset dir="src" prefix="${ant.project.name}/src" erroronmissingdir="false"/>
<zipfileset dir="lib" prefix="${ant.project.name}/lib" erroronmissingdir="false"/>
<zipfileset dir="bin" prefix="${ant.project.name}/bin" erroronmissingdir="false"/>
<zipfileset dir="tools" includes="Run*.jar" prefix="${ant.project.name}/tools" erroronmissingdir="false"/>
<!-- IDE related configuration files -->
<zipfileset file=".project" prefix="${ant.project.name}"/>
<zipfileset file=".classpath" prefix="${ant.project.name}"/>
<zipfileset dir="eclipse" prefix="${ant.project.name}/eclipse" erroronmissingdir="false"/>
<zipfileset dir="nbproject" prefix="${ant.project.name}/nbproject" erroronmissingdir="false"/>
</zip>
</target>
<!-- public clean: cleanup from previous tasks/builds -->
<target name="clean">
<delete dir="build" />
<delete dir="logs" />
<delete file="oc.out" />
<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">
<condition property="junit.usefile">
<!-- don't set if this is running from within an IDE that collects output -->
<not>
<isset property="netbeans.home"/>
</not>
</condition>
<junit printsummary="on" showoutput="off" haltonfailure="yes" dir="${basedir}"
fork="yes" forkmode="perTest" maxmemory="1024m" outputtoformatters="true">
<formatter type="plain" usefile="${junit.usefile}"/>
<classpath>
<path refid="lib.path"/>
<pathelement location="build/tests"/>
<pathelement location="build/main"/>
<pathelement location="build/examples"/>
</classpath>
<batchtest todir="build/tests">
<fileset dir="build/tests">
<include name="**/*Test.class"/>
</fileset>
</batchtest>
</junit>
</target>
</project>