forked from petablox/petablox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
executable file
·387 lines (362 loc) · 13.9 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
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
<?xml version="1.0" encoding="UTF-8"?>
<!--
Main build file for Petablox
-->
<project name="petablox" default="compile">
<taskdef resource="net/sf/antcontrib/antlib.xml" classpath="lib/ant-contrib.jar"/>
<!--
==========================================================================
DESCRIPTION OF TARGETS
==========================================================================
-->
<target name="help">
<echo>
===============================================================
Primary Targets:
===============================================================
compile Compile Petablox sources and build petablox.jar (default)
run Run Petablox
Optional properties:
- petablox.main.class (main class of analyzed program)
- petablox.class.path (classpath of analyzed program)
- petablox.run.analyses (names of analyses to be run)
- many more ... (see Petablox user guide)
clean Cleanup all generated binary files
===============================================================
Utility Targets:
===============================================================
solve Run bddbddb (BDD-based Datalog solver)
Required properties:
- work.dir (dir containing input/output BDD files)
- dlog.file (file specifying Datalog program)
Optional properties:
- max.heap (default=2048m)
- max.tuples (default=1000)
- verbose ([0..6]; default=4)
debug Run bddbddb's interactive interpreter
Required properties:
- work.dir (dir containing input/output BDD files)
- dlog.file (file specifying Datalog program)
Optional properties:
- max.heap (default=2048m)
- max.tuples (default=1000)
- verbose ([0..6]; default=4)
j2h_xref Convert .java files to .html with cross-references
Required properties:
- java.dir (dir containing Java source files)
- html.dir (dir to dump generated HTML files)
j2h_fast Convert .java files to .html without cross-references
Required properties:
- java.dir (dir containing Java source files)
- html.dir (dir to dump generated HTML files)
===============================================================
Documentation Targets:
===============================================================
javadoc Generate javadoc for Petablox's Java source code
htmldoc Generate HTML user guide (needs hyperlatex)
pdfdoc Generate PDF user guide (needs pdflatex)
cleandoc Cleanup all generated javadoc/htmldoc/pdfdoc files
</echo>
</target>
<!--
==========================================================================
BUILD PROPERTIES
==========================================================================
-->
<!--
This target does the following things in order:
1. Loads file petablox.properties from Petablox's main/ directory
2. Sets properties petablox.use.buddy and petablox.use.jvmti to false unless they
have been already set.
3. If either property petablox.use.buddy or petablox.use.jvmti is set to true then:
1. sets property petablox.jdk_root to the root of the JDK installation
2. sets property petablox.arch to '-m32' or '-m64'
3. sets property petablox.make to 'make' on Linux and to 'gmake' on
non-GNU operation systems
-->
<target name="props">
<property file="petablox.properties"/>
<property name="petablox.use.buddy" value="false"/>
<property name="petablox.use.jvmti" value="false"/>
<if><or><equals arg1="${petablox.use.buddy}" arg2="true"/>
<equals arg1="${petablox.use.jvmti}" arg2="true"/>
</or>
<then>
<path id="jdk_root"><pathelement location="${java.home}/.."/></path>
<pathconvert targetos="unix" property="petablox.jdk_root" refid="jdk_root"/>
<if><equals arg1="${os.name}" arg2="FreeBSD"/>
<then><property name="petablox.make" value="gmake"/></then>
<else><property name="petablox.make" value="make"/></else>
</if>
<if><equals arg1="${sun.arch.data.model}" arg2="32"/>
<then><property name="petablox.arch" value="-m32"/></then>
<else><property name="petablox.arch" value="-m64"/></else>
</if>
</then>
</if>
</target>
<!--
==========================================================================
COMPILE PETABLOX
==========================================================================
-->
<target name="compile" description="Compile Petablox.">
<antcall target="compile-j-part"/>
<antcall target="compile-c-part"/>
</target>
<target name="compile-j-part">
<mkdir dir="classes"/>
<javac debug="true" debuglevel="source,lines,vars" includeAntRuntime="false"
source="1.6" target="1.6" destdir="classes" srcdir="src">
<classpath>
<pathelement location="lib/joeq.jar"/>
<pathelement location="lib/jwutil.jar"/>
<pathelement location="lib/jdom.jar"/>
<pathelement location="lib/bddbddb.jar"/>
<pathelement location="lib/javabdd-1.0b2.jar"/>
<pathelement location="lib/javassist.jar"/>
<pathelement location="lib/hj.jar"/>
<pathelement location="lib/CnCHj.jar"/>
<pathelement location="lib/trove-3.0.2.jar"/>
<pathelement location="lib/scannotation-1.0.2.jar"/>
<pathelement location="lib/j2h.jar"/>
<pathelement location="lib/saxon9.jar"/>
<pathelement location="lib/soot-trunk.jar"/>
<pathelement location="lib/confspellcheck-0.1.jar"/>
</classpath>
</javac>
<jar destfile="./lib/reflection-instr.jar" basedir="classes" includes="**/*.class" duplicate="fail">
<zipfileset includes="**/*.class" src="lib/javassist.jar"/>
<fileset dir=".">
<include name="web/*"/>
</fileset>
<file file="lib/options.dict"/>
<fileset dir="src">
<include name="**/*.txt"/>
<include name="**/*.dlog"/>
<include name="**/*.datalog"/>
<include name="**/*.logic"/>
<include name="**/*.xsl"/>
<include name="**/*.xml"/>
<include name="**/*.dtd"/>
<include name="**/*.config"/>
</fileset>
<manifest>
<attribute name="Main-Class" value="petablox.project.Boot"/>
<attribute name="Premain-Class" value="petablox.instr.OnlineTransformer"/>
<attribute name="Can-Retransform-Classes" value="true"/>
</manifest>
</jar>
<jar destfile="petablox.jar" basedir="classes" includes="**/*.class" duplicate="fail">
<zipfileset includes="**/*.class" src="lib/joeq.jar"/>
<zipfileset includes="**/*.class" src="lib/jwutil.jar"/>
<zipfileset includes="**/*.class" src="lib/jdom.jar"/>
<zipfileset includes="**/*.class" src="lib/bddbddb.jar"/>
<zipfileset includes="**/*.class" src="lib/javabdd-1.0b2.jar"/>
<zipfileset includes="**/*.class" src="lib/javassist.jar"/>
<zipfileset includes="**/*.class" src="lib/hj.jar"/>
<zipfileset includes="**/*.class" src="lib/CnCHj.jar"/>
<zipfileset includes="**/*.class" src="lib/trove-3.0.2.jar"/>
<zipfileset includes="**/*.class" src="lib/scannotation-1.0.2.jar"/>
<zipfileset includes="**/*.class" src="lib/j2h.jar"/>
<zipfileset includes="**/*.class" src="lib/saxon9.jar"/>
<zipfileset includes="**/*.class" src="lib/soot-trunk.jar"/>
<zipfileset includes="**/*.class" src="lib/confspellcheck-0.1.jar"/>
<fileset dir="lib/">
<include name="reflection-instr.jar"/>
</fileset>
<fileset dir=".">
<include name="web/*"/>
</fileset>
<file file="lib/options.dict"/>
<fileset dir="src">
<include name="**/*.txt"/>
<include name="**/*.dl"/>
<include name="**/*.dlog"/>
<include name="**/*.datalog"/>
<include name="**/*.logic"/>
<include name="**/*.xsl"/>
<include name="**/*.xml"/>
<include name="**/*.dtd"/>
<include name="**/*.config"/>
<include name="**/mifumax*"/>
</fileset>
<manifest>
<attribute name="Main-Class" value="petablox.project.Boot"/>
<attribute name="Premain-Class" value="petablox.instr.OnlineTransformer"/>
<attribute name="Can-Retransform-Classes" value="true"/>
</manifest>
</jar>
</target>
<target name="compile-c-part">
<antcall target="compile-buddy"/>
<antcall target="compile-agent"/>
</target>
<target name="compile-buddy" depends="props">
<if><equals arg1="${petablox.use.buddy}" arg2="true"/>
<then>
<exec executable="${petablox.make}" dir="bdd">
<arg value="JDK_ROOT=${petablox.jdk_root}"/>
<arg value="M32_FLAG=${petablox.arch}"/>
</exec>
</then>
</if>
</target>
<target name="compile-agent" depends="props">
<if><equals arg1="${petablox.use.jvmti}" arg2="true"/>
<then>
<exec executable="${petablox.make}" dir="agent">
<arg value="JDK_ROOT=${petablox.jdk_root}"/>
<arg value="M32_FLAG=${petablox.arch}"/>
</exec>
</then>
</if>
</target>
<!--
==========================================================================
RUN PETABLOX
==========================================================================
-->
<target name="run" description="Run Petablox.">
<java classname="petablox.project.Boot" failonerror="true" classpath="petablox.jar">
<syspropertyset>
<propertyref builtin="all"/>
</syspropertyset>
</java>
</target>
<!--
==========================================================================
JAVA TO HTML UTILS
==========================================================================
-->
<target name="j2h_xref" description="HTMLize Java source code with cross-referencing.">
<fail unless="java.dir"/>
<fail unless="html.dir"/>
<java classname="j2h" failonerror="true">
<arg value="-js"/>
<arg file="${java.dir}"/>
<arg value="-d"/>
<arg file="${html.dir}"/>
<arg value="-m"/>
<arg value="4"/>
<arg value="-t"/>
<arg value="4"/>
<classpath><pathelement location="lib/j2h.jar"/></classpath>
</java>
</target>
<target name="j2h_fast" description="HTMLize Java source code without cross-referencing.">
<fail unless="java.dir"/>
<fail unless="html.dir"/>
<taskdef name="java2html" classname="de.java2html.anttasks.Java2HtmlTask">
<classpath><pathelement location="lib/java2html.jar"/></classpath>
</taskdef>
<java2html srcdir="${java.dir}" destdir="${html.dir}" includes="**/*.java"
style="eclipse" showLineNumbers="true" addLineAnchors="true" tabs="4"/>
</target>
<!--
==========================================================================
BDDBDDB UTILS
==========================================================================
-->
<target name="solve" description="Run bddbddb (BDD-based Datalog solver).">
<fail unless="work.dir"/>
<fail unless="dlog.file"/>
<property name="max.heap" value="2048m"/>
<property name="verbose" value="3"/>
<java classname="net.sf.bddbddb.Solver" fork="true" maxmemory="${max.heap}">
<classpath>
<pathelement location="lib/bddbddb.jar"/>
<pathelement location="lib/javabdd-1.0b2.jar"/>
<pathelement location="lib/jdom.jar"/>
<pathelement location="lib/jwutil.jar"/>
</classpath>
<sysproperty key="java.library.path" file="."/>
<sysproperty key="basedir" file="${work.dir}"/>
<sysproperty key="verbose" value="${verbose}"/>
<syspropertyset>
<propertyref builtin="commandline"/>
</syspropertyset>
<arg file="${dlog.file}"/>
</java>
</target>
<target name="debug" description="Run bddbddb's interactive interpreter.">
<fail unless="work.dir"/>
<fail unless="dlog.file"/>
<property name="max.heap" value="2048m"/>
<property name="verbose" value="3"/>
<java classname="net.sf.bddbddb.Interactive" fork="true" maxmemory="${max.heap}">
<classpath>
<pathelement location="lib/bddbddb.jar"/>
<pathelement location="lib/javabdd-1.0b2.jar"/>
<pathelement location="lib/jdom.jar"/>
<pathelement location="lib/jwutil.jar"/>
</classpath>
<sysproperty key="java.library.path" file="."/>
<sysproperty key="basedir" file="${work.dir}"/>
<sysproperty key="verbose" value="${verbose}"/>
<syspropertyset>
<propertyref builtin="commandline"/>
</syspropertyset>
<arg file="${dlog.file}"/>
</java>
</target>
<!--
==========================================================================
BUILD DOCUMENTATION
==========================================================================
-->
<target name="javadoc" depends="compile-j-part" description="Generate Javadoc.">
<javadoc destdir="javadoc" classpath="petablox.jar" useexternalfile="true">
<fileset dir="src">
<include name="**/*.java"/>
</fileset>
</javadoc>
<copy todir="javadoc" flatten="true">
<fileset dir="src">
<include name="**/*.dlog"/>
<include name="**/*.datalog"/>
</fileset>
</copy>
</target>
<target name="htmldoc" description="Generate HTML user guide (needs Hyperlatex).">
<exec executable="hyperlatex" dir="doc">
<arg value="user_guide.tex"/>
</exec>
</target>
<target name="pdfdoc" description="Generate PDF user guide (needs pdflatex).">
<exec executable="pdflatex" dir="doc">
<arg value="user_guide.tex"/>
</exec>
</target>
<!--
==========================================================================
CLEAN UP
==========================================================================
-->
<target name="clean" depends="props" description="Clean all generated files.">
<delete dir="classes"/>
<delete file="petablox.jar"/>
<if><equals arg1="${petablox.use.buddy}" arg2="true"/>
<then>
<exec executable="${petablox.make}" dir="bdd">
<arg value="clean"/>
</exec>
</then>
</if>
<if><equals arg1="${petablox.use.jvmti}" arg2="true"/>
<then>
<exec executable="${petablox.make}" dir="agent">
<arg value="clean"/>
</exec>
</then>
</if>
</target>
<target name="cleandoc" description="Clean generated Javadoc and user guide.">
<delete dir="javadoc"/>
<delete file="doc/user_guide.pdf"/>
<delete file="doc/user_guide.aux"/>
<delete file="doc/user_guide.log"/>
<delete file="doc/user_guide.out"/>
<delete file="doc/user_guide.dvi"/>
</target>
</project>