-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
409 lines (345 loc) · 15.5 KB
/
Copy pathbuild.xml
File metadata and controls
409 lines (345 loc) · 15.5 KB
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
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
404
405
406
407
408
409
<?xml version="1.0" ?>
<!--
Copyright (C) 2012 Gurvan Le Guernic
This file is part of ENCoVer. ENCoVer is a JavaPathFinder extension allowing
to verify if a Java method respects different epistemic noninterference
properties.
ENCoVer is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
ENCoVer is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
ENCoVer. If not, see <http://www.gnu.org/licenses/>.
-->
<!--
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
examples compile the example files
build build JPF jar files
dist build source and binary distribution
clean remove the files that have been generated by the compilation process
mrproper remove the files that have been generated by the compilation and distribution process
-->
<project name="jpf-encover" 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"/>
<!-- this is where we get the 'jpf.core' location from -->
<property name="config_path" value="."/>
<property file="./site.properties"/>
<!-- get the jpf-core path properties -->
<property file="${jpf-core}/jpf.properties"/>
<!-- get the jpf-symbc path properties -->
<property file="${jpf-symbc}/jpf.properties"/>
<!-- compiler settings -->
<property name="src_level" value="6"/>
<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"/>
<fileset dir="."> <include name="lib/*.jar"/> </fileset>
<!-- add in what we need from the core -->
<pathelement path="${jpf-core.native_classpath}"/>
<!-- add in what we need from symbc -->
<pathelement path="${jpf-symbc.native_classpath}"/>
</path>
<!-- init: common initialization -->
<target name="-init">
<tstamp/>
<mkdir dir="build"/> <!-- the build root -->
<mkdir dir="build/src"/> <!-- the generated source dir -->
<!-- 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"
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/src/main/se/kth/csc/jpf_encover"/>
<javacc
target="src/main/se/kth/csc/jpf_encover/Smt2Parser.jj"
outputdirectory="build/src/main/se/kth/csc/jpf_encover"
javacchome="tools"
/>
<mkdir dir="build/main"/>
<javac srcdir="src/main;build/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">
<mkdir dir="build/tests"/>
<javac srcdir="src/tests" destdir="build/tests" includeantruntime="false"
debug="${debug}" source="${src_level}" deprecation="${deprecation}"
includes="*">
<classpath>
<path refid="lib.path"/>
<pathelement location="build/annotations"/>
</classpath>
</javac>
<copy todir="build/tests">
<fileset dir="src/tests" includes="*.jpf">
<!--
<present targetdir="build/tests">
<mapper type="glob" from="*.jpf" to="*.class"/>
</present>
-->
</fileset>
</copy>
</target>
<target name="examples">
<mkdir dir="build/examples" />
<javac srcdir="src/examples" destdir="build/examples" includeantruntime="false"
debug="${debug}" source="${src_level}" deprecation="${deprecation}"
classpathref="lib.path" includes="**/*.java"/>
<copy todir="build/examples">
<fileset dir="src/examples" includes="framework_testConf.jpf"/>
<fileset dir="src/examples" includes="**/conf_*.txt"/>
<fileset dir="src/examples" includes="**/*.java"/>
</copy>
<mkdir dir="build/examples/bin" />
<copy todir="build/examples/bin">
<fileset dir="src/examples/bin" includes="*.sh"/>
</copy>
</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" 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">
<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">
<fileset dir="build/annotations" erroronmissingdir="false"/>
</jar>
</target>
<!-- =================== DISTRIBUTION SECTION ============================ -->
<property name="dist.dir" value="dist"/>
<!-- <property name="dist.src.dir" value="dist_src_dir"/> -->
<!-- <property name="dist.name" value="encover"/> -->
<property name="dist.used.bin" value="encover.sh, displayGraph.sh"/>
<property name="dist.used.tools" value="javacc.jar"/>
<property name="dist.used.examples-bin" value="generateTestConfFiles.sh, computeTestAverages.sh, generateTestSummary.sh, runAndLogAllTests.sh, runTestAndLogResults.sh"/>
<!-- -init-rev-numbers -->
<target name="-init-rev-numbers">
<exec dir="${jpf-core}" executable="hg" outputproperty="rev.jpf-core" failifexecutionfails="false">
<arg value="tip"/>
<arg value="--template"/>
<arg value="{rev}"/>
</exec>
<exec dir="${jpf-symbc}" executable="hg" outputproperty="rev.jpf-symbc" failifexecutionfails="false">
<arg value="tip"/>
<arg value="--template"/>
<arg value="{rev}"/>
</exec>
<exec executable="bash" outputproperty="rev.jpf-encover" failifexecutionfails="false">
<arg value="-c"/>
<arg value="svn info | grep Revision | cut -d ' ' -f 2"/>
</exec>
</target> <!-- -init-rev-numbers -->
<!-- dist-src -->
<target name="dist-src"
description="Create a directory containing the required sources for distribution (as source and to build distributed binaries)"
depends="-init-rev-numbers">
<!-- Removing old source dir -->
<delete dir="${dist.dir}"/>
<!-- Copying jpf-encover sources -->
<copy todir="${dist.dir}">
<fileset dir="." includes="build.xml, COPYING, jpf.properties, README.*"/>
</copy>
<exec dir="${dist.dir}" executable="sed" failifexecutionfails="true">
<arg value="-i"/>
<arg value="s/\${user\.home}\/\.jpf\/site\.properties/\.\/site\.properties/"/>
<arg value="build.xml"/>
</exec>
<copy todir="${dist.dir}/src">
<fileset dir="src" includes="**/*.java"/>
<fileset dir="src" includes="**/*.jj"/>
<fileset dir="src" includes="examples/**/framework_testConf.jpf"/>
<fileset dir="src" includes="examples/**/conf_*.txt"/>
</copy>
<copy todir="${dist.dir}/lib">
<fileset dir="lib" includes="jgraphx.jar, jung*"/>
</copy>
<copy todir="${dist.dir}/bin">
<fileset dir="bin" includes="${dist.used.bin}"/>
</copy>
<exec dir="${dist.dir}/bin" executable="sed" failifexecutionfails="true">
<arg value="-i"/>
<arg value="s/\${HOME}\/\.jpf\/site\.properties/\$(dirname \$0)\/\.\.\/site\.properties/"/>
<arg value="encover.sh"/>
</exec>
<exec dir="${dist.dir}/bin" executable="sed" failifexecutionfails="true">
<arg value="-i"/>
<arg value="s/\${HOME}\/\.jpf\/site\.properties/site\.properties/"/>
<arg value="displayGraph.sh"/>
</exec>
<copy todir="${dist.dir}/src/examples/bin">
<fileset dir="src/examples/bin" includes="${dist.used.examples-bin}"/>
</copy>
<copy todir="${dist.dir}/tools">
<fileset dir="tools" includes="${dist.used.tools}"/>
</copy>
<!-- Updating jpf-encover sources -->
<exec executable="bash" failifexecutionfails="true">
<arg value="-c"/>
<arg value="./bin/setupSourcesForDistribution.sh ${dist.dir}"/>
</exec>
<!-- Retrieving JPF jar files -->
<!--
<exec dir="${jpf-core}" executable="ant"> <arg value="clean"/> </exec>
<exec dir="${jpf-core}" executable="ant"> <arg value="build"/> </exec>
<exec dir="${jpf-core}" executable="ant"> <arg value="dist"/> </exec>
-->
<unzip src="${jpf-core}/build/jpf-core-r${rev.jpf-core}.zip" dest="${dist.dir}/lib"/>
<move todir="${dist.dir}/lib/jpf-core-r${rev.jpf-core}"> <fileset dir="${dist.dir}/lib/jpf-core"/> </move>
<!-- Retrieving SYMBC jar files -->
<!--
<exec dir="${jpf-symbc}" executable="ant"> <arg value="clean"/> </exec>
<exec dir="${jpf-symbc}" executable="ant"> <arg value="build"/> </exec>
<exec dir="${jpf-symbc}" executable="ant"> <arg value="dist"/> </exec>
-->
<unzip src="${jpf-symbc}/build/jpf-symbc.zip" dest="${dist.dir}/lib"/>
<move todir="${dist.dir}/lib/jpf-symbc-r${rev.jpf-symbc}"> <fileset dir="${dist.dir}/lib/jpf-symbc"/> </move>
<exec executable="bash" failifexecutionfails="true">
<arg value="-c"/>
<arg value="find ${jpf-symbc}/lib/ -name old_* -prune -o -name z3 -prune -o -type f -exec basename {} \; > symbcLibFiles.tmp"/>
</exec>
<copy todir="${dist.dir}/lib/jpf-symbc-r${rev.jpf-symbc}/lib">
<fileset dir="${jpf-symbc}/lib" includesfile="symbcLibFiles.tmp"/>
</copy>
<delete file="symbcLibFiles.tmp"/>
<!-- Setting up specific site.properties -->
<echo file="${dist.dir}/site.properties" append="false">
jpf-core = $${config_path}/lib/jpf-core-r${rev.jpf-core}
jpf-symbc = $${config_path}/lib/jpf-symbc-r${rev.jpf-symbc}
jpf-encover = $${config_path}
</echo>
<!-- Packaging sources in a zip -->
<delete file="${ant.project.name}_r${rev.jpf-encover}_src.zip"/>
<zip destfile="${ant.project.name}_r${rev.jpf-encover}_src.zip"
update="false" encoding="UTF-8" compress="true" level="9" whenempty="fail">
<zipfileset dir="${dist.dir}" prefix="${ant.project.name}"
excludes="README.bin"/>
</zip>
</target> <!-- dist-src -->
<!-- ======================= TEST SECTION ================================ -->
<target name="test" depends="build"
description="compile and run core regression tests" if="have_tests">
<mkdir dir="unitTests"/>
<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="unitTests"
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/classes"/>
<pathelement location="build/annotations"/>
</classpath>
<batchtest todir="build/tests">
<fileset dir="build/tests">
<exclude name="**/InvokeEncoverTest.class"/>
<include name="**/IFTest_*.class"/>
<exclude name="**/IFTest_*$*.class"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- ======================= CLEAN SECTION =============================== -->
<!-- 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>
<!-- Addition by Gurvan -->
<delete dir="unitTests" />
<delete dir="${dist.src.dir}" />
<!-- End addition by Gurvan -->
</target>
<!-- public mrproper: cleanup from previous tasks/builds including distribution files -->
<target name="mrproper" depends="clean">
<delete dir="${dist.dir}" />
</target>
</project>