-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
324 lines (254 loc) · 10.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
<?xml version="1.0" ?>
<!--
This file is part of spf-sca, a tool to quantify leaks of
confidential in Java programs.
spf-sca 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.
spf-sca 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
spf-sca. 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
jar build JPF jar files
dist build binary distribution
clean remove the files that have been generated by the build process
-->
<project name="spf-sca" 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!
-->
<!-- 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"/>
<!-- if there is none, default to a 'jpf-core' peer dir -->
<property name="jpf-symbc" value = "../jpf-symbc"/>
<!-- get the jpf-symbc path properties -->
<property file="${jpf-symbc}/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"/>
<pathelement location="build/classes"/>
<!-- we don't have these
<pathelement location="build/peers"/>
-->
<fileset dir=".">
<include name="lib/*.jar"/>
<include name="lib/engagement1/*.jar"/>
</fileset>
<!-- add in what we need from the core -->
<pathelement path="${jpf-core.native_classpath}"/>
<!-- add in what we need from the symbc -->
<pathelement path="${jpf-symbc.native_classpath}"/>
<pathelement path="${jpf-symbc.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/classes" type="dir" property="have_classes"/>
<available file="src/peers" type="dir" property="have_peers"/>
<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>
</target>
<!-- ======================= COMPILE SECTION ============================= -->
<!-- public compile -->
<target name="compile" depends="-init,-compile-main,-compile-classes,-compile-peers,-compile-tests,-compile-examples"
description="compile all JPF core sources" >
</target>
<target name="-compile-main" if="have_main" >
<mkdir dir="build/main"/>
<!--TODO: remove src/examples from srcdir after configuring dynamically program inputs-->
<javac srcdir="src/main;src/classes" destdir="build/main" includeantruntime="false"
debug="${debug}" source="${src_level}" deprecation="${deprecation}"
classpathref="lib.path" />
</target>
<target name="-compile-classes" if="have_classes" depends="-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-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}"
includeantruntime="false">
<classpath>
<path refid="lib.path"/>
<pathelement location="build/peers"/>
</classpath>
</javac>
</target>
<target name="-compile-tests" if="have_tests" depends="-compile-main">
<mkdir dir="build/tests"/>
<javac srcdir="src/tests" destdir="build/tests" includeantruntime="false"
debug="${debug}" source="${src_level}" deprecation="${deprecation}">
<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-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/classes"/>
<pathelement location="build/annotations"/>
</classpath>
</javac>
</target>
<!-- ======================= MISC SECTION ================================ -->
<!-- build jars -->
<target name="build" depends="compile,-jar-jvm,-jar-jpf,-jar-tool,create-tmp-dir"
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"/>
<manifest>
<attribute name="Main-Class" value="sidechannel.tool.RunQuantifier" />
</manifest>
</jar>
<chmod file="build/${ant.project.name}.jar" perm="ugo+rx"/>
</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-jpf" if="have_jpf_code">
<jar jarfile="build/${ant.project.name}-classes.jar">
<fileset dir="build/classes"/>
</jar>
</target>
<target name="-jar-tool" if="have_jvm_code">
<!-- Rule to build jarfile for RunQuantifier -->
<jar jarfile="build/RunQuantifier.jar">
<fileset dir="build/main">
<include name="sidechannel/tool/RunQuantifier.class"/>
</fileset>
<fileset dir="${jpf-core}/build/main">
<include name="gov/nasa/jpf/tool/Run.class"/>
<include name="gov/nasa/jpf/Config.class"/>
<include name="gov/nasa/jpf/ConfigChangeListener.class"/>
<include name="gov/nasa/jpf/Config$MissingRequiredKeyException.class"/>
<include name="gov/nasa/jpf/JPFClassLoader.class"/>
<include name="gov/nasa/jpf/JPFException.class"/>
<include name="gov/nasa/jpf/JPFConfigException.class"/>
<include name="gov/nasa/jpf/util/JPFSiteUtils.class"/>
<include name="gov/nasa/jpf/util/FileUtils.class"/>
<include name="gov/nasa/jpf/util/StringMatcher.class"/>
<include name="gov/nasa/jpf/util/Pair.class"/>
</fileset>
<manifest>
<attribute name="Main-Class" value="sidechannel.tool.RunQuantifier" />
</manifest>
</jar>
<chmod file="build/RunQuantifier.jar" perm="ugo+rx"/>
<!-- Rule to build jarfile for the ProfilingServer -->
<jar jarfile="build/ProfilingServer.jar">
<fileset dir="build/examples">
<include name="sidechannel/dynamicadaptive/ProfilingServer.class"/>
<include name="sidechannel/dynamicadaptive/SideChannelApps.class"/>
<include name="sidechannel/dynamicadaptive/*.class"/>
</fileset>
<manifest>
<attribute name="Main-Class" value="sidechannel.dynamicadaptive.ProfilingServer"/>
</manifest>
</jar>
<chmod file="build/RunQuantifier.jar" perm="ugo+rx"/>
</target>
<target name="testchoco" depends="compile">
<junit showoutput="true" printsummary="on" haltonfailure="no" fork="on" dir="src/examples">
<!-- Project classpath, must include junit.jar -->
<classpath refid="lib.path" />
<!-- test class -->
<classpath location="build/examples" />
<test name="TestsChoco" haltonfailure="no" todir="build/examples">
<formatter type="plain" />
<formatter type="xml" />
</test>
</junit>
</target>
<target name="testz3" depends="compile">
<junit showoutput="true" printsummary="on" haltonfailure="no" fork="on" dir="src/examples">
<!-- Project classpath, must include junit.jar -->
<classpath refid="lib.path" />
<!-- test class -->
<classpath location="build/examples" />
<test name="TestsZ3" haltonfailure="no" todir="build/examples">
<formatter type="plain" />
<formatter type="xml" />
</test>
</junit>
</target>
<target name="testz3bv" depends="compile">
<junit showoutput="true" printsummary="on" haltonfailure="no" fork="on" dir="src/examples">
<!-- Project classpath, must include junit.jar -->
<classpath refid="lib.path" />
<!-- test class -->
<classpath location="build/examples" />
<test name="TestsZ3BV" haltonfailure="no" todir="build/examples">
<formatter type="plain" />
<formatter type="xml" />
</test>
</junit>
</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>
</project>