-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathbuild.xml
More file actions
548 lines (479 loc) · 23 KB
/
build.xml
File metadata and controls
548 lines (479 loc) · 23 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
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
<?xml version="1.0" encoding="utf-8"?>
<project name="droidsafe" default="help">
<property name="ssl-antlr-spec" value="src/main/java/droidsafe/speclang/DroidSafe.g"/>
<property name="ssl-ast-to-java" value="src/main/java/droidsafe/speclang/SpecCreator.g"/>
<property name="ssl-antlr-target-dir" value="src/main/java/droidsafe/speclang"/>
<property name="test-results-dir" value="test-reports"/>
<property name="eclipse-plugin-path" value="src/eclipse/droidsafe.eclipse.plugin.core"/>
<property name="va-result-container-classes-dir" value="src/gen/droidsafe/analyses/value/VAResultContainerClasses/"/>
<condition property="is.windows">
<os family="windows" />
</condition>
<path id="lib-jars">
<pathelement location="android-lib/android-impl.jar"/>
<pathelement location="lib/javassist-3.16.1-GA.jar"/>
<pathelement location="lib/opencsv-2.3.jar"/>
<pathelement location="lib/reflections-0.9.9-RC1.jar"/>
<pathelement location="lib/gson-2.2.4.jar"/>
<pathelement location="lib/commons-cli-1.2.jar"/>
<pathelement location="lib/logback-classic-1.0.7.jar"/>
<pathelement location="lib/slf4j-api-1.7.2.jar"/>
<pathelement location="lib/commons-io-2.4.jar"/>
<pathelement location="lib/logback-core-1.0.7.jar"/>
<pathelement location="lib/soot-trunk.jar"/>
<pathelement location="lib/antlr-3.4-complete.jar"/>
<pathelement location="lib/paddle-0.3-custom.jar"/>
<pathelement location="lib/javabdd_0.6.jar"/>
<pathelement location="lib/jedd-runtime.jar"/>
<pathelement location="lib/guava-11.0.2.jar"/>
<pathelement location="lib/commons-lang3-3.1.jar"/>
<pathelement location="lib/jgrapht-jdk1.6.jar"/>
<pathelement location="lib/string.jar"/>
<pathelement location="lib/automaton.jar"/>
<pathelement location="lib/javaparser.jar"/>
</path>
<target name="help">
<echo>
==================================================================================================
Primary Targets:
=====================================================================
build-libs Build and package required libraries
compile Compile Droidsafe core
clean Cleanup all generated binary files
=====================================================================
Documentation Targets:
=====================================================================
javadoc Generate javadoc for Droidsafe's Java source code
htmldoc Generate HTML user guide (needs hyperlatex)
=====================================================================
Testing Targets:
=====================================================================
compile-tests compiles Droidsafe tests
run-tests runs all JUnit tests under 'tests/java/droidsafe/test'
> -Dtest.class wildcard class name of tests to run
> -Dtest.timeout seconds after which to fail the test (default 70)
run-specdump-test checks whether 'make specdump' succeeds for each app in '/android-apps/'
> -Ddir.to.search directory inside 'android-apps to which to limit the app search to
> -Dtest.timeout seconds after which to fail the test (default 70)
run-regression-tests runs all JUnit tests under 'tests/java/droidsafe/test/regression'
> -Ddir.to.search directory inside 'android-apps to which to limit the app search to for SpecdumpRegressionTest
update-specdump-regression-values updates the regression values
using the results from the latest run of 'run-specdump-tests'
=====================================================================
Eclipse Plugin Targets:
=====================================================================
plugin Copies all the needed jar files to the plugin folder.
plugin-clean Removes all the droidsafe jar files from the plugin folder.
plugin-deploy Packages and deploys the plugin to the update site location.
To run target deploy-plugin, you will need to edit file src/eclipse/build.properties
to add the correct paths to eclipse jar files needed to build pluging.
</echo>
</target>
<!--
==========================================================================
BUILD SPEC LANGUAGE PARSER & AST To Java
==========================================================================
-->
<target name="antlr-runs" description="Build Security Specification Parser" unless="droidsafe.core-uptodate">
<java classname="org.antlr.Tool" fork="true" failonerror="true">
<classpath>
<pathelement location="lib/antlr-3.4-complete.jar"/>
</classpath>
<arg value="-verbose"/>
<arg value="-make"/>
<arg value="-o"/>
<arg path="${ssl-antlr-target-dir}"/>
<arg path="${ssl-antlr-spec}"/>
</java>
<java classname="org.antlr.Tool" fork="true" failonerror="true">
<classpath>
<pathelement location="lib/antlr-3.4-complete.jar"/>
</classpath>
<arg value="-verbose"/>
<arg value="-make"/>
<arg value="-o"/>
<arg path="${ssl-antlr-target-dir}"/>
<arg path="${ssl-ast-to-java}"/>
</java>
</target>
<!--
==========================================================================
CHECK FOR UP-TO-DATE SOURCE OR LIB FILES
==========================================================================
-->
<target name="check-for-changes">
<uptodate property="droidsafe.core-uptodate" targetfile="bin/droidsafe-core.jar" >
<srcfiles dir="src/main/" includes="**"/>
</uptodate>
<uptodate property="droidsafe.test-uptodate" targetfile="bin/droidsafe-test.jar" >
<srcfiles dir="src/test" includes="**"/>
</uptodate>
<uptodate property="droidsafe.libs-uptodate" targetfile="bin/droidsafe-libs.jar" >
<srcfiles dir="lib" includes="**"/>
</uptodate>
<uptodate property="droidsafe.calls-uptodate" targetfile="android-lib/droidcalls.jar" >
<srcfiles dir="android-lib" includes="**"/>
</uptodate>
<uptodate property="droidsafe.model-uptodate" targetfile="android-lib/droidsafe-api-model.jar" >
<srcfiles dir="modeling/api" includes="**"/>
</uptodate>
<uptodate property="droidsafe.manual-model-uptodate" targetfile="android-lib/droidsafe-manual-api-model.jar" >
<srcfiles dir="modeling/api-manual" includes="**"/>
</uptodate>
</target>
<!--
<target name="droidsafe-calls-build" unless="droidsafe.calls-uptodate">
<exec executable="make" dir="android-lib">
</exec>
</target>
-->
<target name="droidsafe-calls-build" unless="droidsafe.calls-uptodate">
<antcall target="droidsafe-calls-build-linux"/>
<antcall target="droidsafe-calls-build-windows"/>
</target>
<target name="droidsafe-calls-build-linux" unless="is.windows">
<exec executable="make" dir="android-lib">
</exec>
</target>
<target name="droidsafe-calls-build-windows" if="is.windows">
<javac debug="true" debuglevel="source,lines,vars" includeAntRuntime="false"
source="1.7" target="1.7" srcdir="android-lib/src">
<classpath>
<pathelement location="android-lib"/>
<pathelement location="android-lib/android.jar"/>
<pathelement location="android-lib/src"/>
</classpath>
</javac>
<jar destfile="${eclipse-plugin-path}/android-lib/droidcalls.jar" basedir="android-lib/src" includes="**/*.class">
</jar>
</target>
<target name="build-libs" description="Create jar file libraries."
depends="check-for-changes, antlr-runs" unless="droidsafe.libs-uptodate">
<jar destfile="bin/droidsafe-libs.jar">
<zipfileset includes="**/*.class" src="android-lib/android-impl.jar"/>
<zipfileset includes="**/*.class" src="lib/javassist-3.16.1-GA.jar"/>
<zipfileset includes="**/*.class" src="lib/opencsv-2.3.jar"/>
<zipfileset includes="**/*.class" src="lib/gson-2.2.4.jar"/>
<zipfileset includes="**/*.class" src="lib/reflections-0.9.9-RC1.jar"/>
<zipfileset includes="**/*.class" src="lib/logback-classic-1.0.7.jar"/>
<zipfileset includes="**/*.class" src="lib/slf4j-api-1.7.2.jar"/>
<zipfileset includes="**/*.class" src="lib/commons-io-2.4.jar"/>
<zipfileset includes="**/*.class" src="lib/logback-core-1.0.7.jar"/>
<zipfileset includes="**/*.class" src="lib/soot-trunk.jar"/>
<zipfileset includes="**/*.class" src="lib/antlr-3.4-complete.jar"/>
<zipfileset includes="**/*.class" src="lib/paddle-0.3-custom.jar"/>
<zipfileset includes="**/*.class" src="lib/javabdd_0.6.jar"/>
<zipfileset includes="**/*.class" src="lib/jedd-runtime.jar"/>
<zipfileset includes="**/*.class" src="lib/guava-11.0.2.jar"/>
<zipfileset includes="**/*.class" src="lib/commons-lang3-3.1.jar"/>
<zipfileset includes="**/*.class" src="lib/jgrapht-jdk1.6.jar"/>
<zipfileset includes="**/*.class" src="lib/string.jar"/>
<zipfileset includes="**/*.class" src="lib/automaton.jar"/>
<zipfileset includes="**/*.class" src="lib/javaparser.jar"/>
<zipfileset includes="**/*.class" src="lib/commons-cli-1.2.jar"/>
</jar>
</target>
<!--
==========================================================================
compile modeling
==========================================================================
-->
<target name="compile-model" description="Compile DroidSafe API Model."
depends="check-for-changes"
unless="droidsafe.model-uptodate">
<mkdir dir="modeling/classes/api"/>
<javac debug="true" debuglevel="source,lines,vars"
includeAntRuntime="false"
fork="true"
memoryinitialsize="1g"
memorymaximumsize="4g"
destdir="modeling/classes/api" srcdir="modeling/api" >
<compilerarg line="-Xmaxerrs 10000 -Xmaxwarns 10000 " />
<classpath>
<pathelement location="android-lib/android-impl.jar"/>
</classpath>
</javac>
<delete file="android-lib/droidsafe-api-model.jar"/>
<jar destfile="android-lib/droidsafe-api-model.jar" basedir="modeling/classes/api" includes="**/*.class">
</jar>
</target>
<!--
===================================================================================
generate VA templates from the api model based on the DSVAModeled annotations
===================================================================================
-->
<target name="generate-va-result-container-classes"
description="Generate VA result container classes from the api model based on the DSVAModeled annotations."
depends="compile-model">
<delete dir="${va-result-container-classes-dir}"/>
<mkdir dir="${va-result-container-classes-dir}"/>
<java
classname="droidsafe.analyses.value.VAResultContainerClassGenerator"
fork="true" classpathref="lib-jars">
<arg value="modeling/api"/>
<jvmarg value="-Xms1g"/>
<jvmarg value="-Xmx4g"/>
<classpath>
<pathelement path="classes/main"/>
</classpath>
</java>
</target>
<!--
==========================================================================
COMPILE MANUAL MODELING
==========================================================================
-->
<target name="compile-manual-model" description="Compile Manual Editing Models."
depends="check-for-changes"
unless="droidsafe.api-manual-uptodate">
<mkdir dir="modeling/classes/api-manual"/>
<javac debug="true" debuglevel="source,lines,vars" includeAntRuntime="false"
destdir="modeling/classes/api-manual" srcdir="modeling/api-manual">
<classpath>
<pathelement location="android-lib/android-impl.jar"/>
</classpath>
<compilerarg line="-Xmaxerrs 5"/>
</javac>
<delete file="android-lib/droidsafe-manual-api-model.jar"/>
<jar destfile="android-lib/droidsafe-manual-api-model.jar" basedir="modeling/classes/api-manual" includes="**/*.class">
</jar>
</target>
<!--
==========================================================================
COMPILE DROIDSAFE
==========================================================================
-->
<target name="compile-ds" description="Compile DroidSafe core." depends="build-libs,droidsafe-calls-build" unless="droidsafe.core-uptodate">
<mkdir dir="classes/main"/>
<mkdir dir="src/gen"/>
<javac memoryinitialsize="2g"
memorymaximumsize="6g"
fork="true"
debug="true" debuglevel="source,lines,vars" includeAntRuntime="false" includeJavaRuntime="false" destdir="classes/main" srcdir="src/main/java:src/gen" classpathref="lib-jars">
</javac>
<jar destfile="bin/droidsafe-core.jar" basedir="classes/main" includes="**/*.class">
<manifest>
<attribute name="Main-Class" value="droidsafe.main.Main"/>
<attribute name="Boot-Class-Path" value="droidsafe-core.jar"/>
</manifest>
</jar>
<antcall target="generate-va-result-container-classes"/>
<javac debug="true" debuglevel="source,lines,vars" includeAntRuntime="false" includeJavaRuntime="false" destdir="classes/main" srcdir="src/main/java:src/gen" classpathref="lib-jars">
</javac>
<jar destfile="bin/droidsafe-core.jar" basedir="classes/main" includes="**/*.class">
<manifest>
<attribute name="Main-Class" value="droidsafe.main.Main"/>
<attribute name="Boot-Class-Path" value="droidsafe-core.jar"/>
</manifest>
</jar>
</target>
<target name="compile" description="Compile DroidSafe." depends="build-libs,droidsafe-calls-build,compile-model,compile-manual-model,compile-ds" unless="droidsafe.core-uptodate">
</target>
<target name="clean" description="Clean all generated files.">
<delete dir="classes"/>
<delete dir="modeling/classes"/>
<delete file="bin/droidsafe-core.jar"/>
<delete file="bin/droidsafe-libs.jar"/>
<delete file="bin/droidsafe-test.jar"/>
<delete file="android-lib/droidsafe-api-model.jar"/>
<delete dir="test-reports"/>
<delete dir="${va-result-container-classes-dir}"/>
</target>
<target name="clean-model" description="Clean all generated files.">
<delete dir="modeling/classes"/>
<delete file="android-lib/droidsafe-api-model.jar"/>
</target>
<!--
==========================================================================
TEST DROIDSAFE ALL THIS IS DEPRECATED!!! Use regression tests
in system-tests/
==========================================================================
-->
<target name="compile-tests" depends="compile">
<mkdir dir="classes/test"/>
<javac debug="true" debuglevel="source,lines,vars" includeAntRuntime="false" includeJavaRuntime="false"
destdir="classes/test" srcdir="src/test/java">
<classpath id="path.classpath.compile">
<pathelement path="classes/main"/>
<pathelement path="lib/junit-4.11.jar"/>
<pathelement location="lib/commons-cli-1.2.jar"/>
<pathelement location="lib/slf4j-api-1.7.2.jar"/>
<pathelement location="lib/commons-lang3-3.1.jar"/>
</classpath>
</javac>
<jar destfile="bin/droidsafe-test.jar" basedir="classes/test" includes="**/*.class">
<manifest>
<attribute name="Main-Class" value="droidsafe.test.Main"/>
<attribute name="Boot-Class-Path" value="droidsafe-test.jar"/>
</manifest>
</jar>
</target>
<target name="run-tests"
description="Run a JUnit test under tests/java/droidsafe/test. Specify name or pattern with -Dtest.class=ClassName"
depends="compile-tests">
<property name="timeout" value="-1"/>
<fail unless="test.class"
message="Please define a test class with -Dtest.class=ClassName (no file extension) to run this target. This will run any tests under test/java/droidsafe/test matching the given class name to be run. May include wildcards."/>
<mkdir dir="test-reports"/>
<junit fork="true" forkmode="perTest" printsummary="on" logfailedtests="on">
<formatter type="xml"/>
<!-- let user set their desired per-test timeout value -->
<sysproperty key="timeout" value="${timeout}"/>
<classpath>
<pathelement path="classes/main"/>
<pathelement path="classes/test"/>
<path refid="lib-jars"/>
</classpath>
<batchtest todir="test-reports">
<fileset dir="test/java">
<include name="droidsafe/test/**/${test.class}.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="run-specdump-test" depends="compile-tests">
<!-- defaults for values users can specify-->
<property name="timeout" value="70"/>
<property name="dir.to.search" value=""/>
<mkdir dir="test-reports"/>
<junit fork="true" forkmode="perTest" printsummary="on" logfailedtests="on">
<formatter type="xml"/>
<!-- let user set their desired per-test timeout value -->
<sysproperty key="timeout" value="${timeout}"/>
<!-- let user limit app search to a particular subdirectory (wildcards allowed) -->
<sysproperty key="dir-to-search" value="${dir.to.search}"/>
<classpath>
<pathelement path="classes/main"/>
<pathelement path="classes/test"/>
<pathelement location="lib/junit-4.11.jar"/>
<pathelement location="lib/slf4j-api-1.7.2.jar"/>
<pathelement location="lib/hamcrest-core-1.3.jar"/>
<pathelement location="lib/logback-classic-1.0.7.jar"/>
<pathelement location="lib/logback-core-1.0.7.jar"/>
</classpath>
<batchtest todir="test-reports">
<fileset dir="src/test/java">
<include name="droidsafe/test/SpecdumpTestCase.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="run-regression-tests" description="Run regression tests." depends="compile-tests">
<antcall target="run-specdump-test"/>
<mkdir dir="test-reports/regression/"/>
<junit fork="true" forkmode="perTest" printsummary="on" logfailedtests="on">
<formatter type="xml"/>
<classpath>
<pathelement path="classes/main"/>
<pathelement path="classes/test"/>
<pathelement location="lib/junit-4.11.jar"/>
<pathelement location="lib/slf4j-api-1.7.2.jar"/>
<pathelement location="lib/hamcrest-core-1.3.jar"/>
<pathelement location="lib/logback-classic-1.0.7.jar"/>
<pathelement location="lib/logback-core-1.0.7.jar"/>
<pathelement location="lib/commons-lang3-3.1.jar"/>
</classpath>
<batchtest todir="test-reports/regression/">
<fileset dir="src/test/java">
<include name="droidsafe/test/regression/*TestCase.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="update-specdump-regression-values" depends="compile-tests">
<java classname="droidsafe.test.Main">
<arg value="-target"/>
<arg value="update-specdump-regression-values"/>
<classpath>
<pathelement location="bin/droidsafe-core.jar"/>
<pathelement location="bin/droidsafe-test.jar"/>
<pathelement location="lib/commons-cli-1.2.jar"/>
<pathelement location="lib/slf4j-api-1.7.2.jar"/>
<pathelement location="lib/logback-classic-1.0.7.jar"/>
<pathelement location="lib/logback-core-1.0.7.jar"/>
<pathelement location="lib/commons-lang3-3.1.jar"/>
</classpath>
</java>
</target>
<!--
==========================================================================
Generate Javadoc for DROIDSAFE source code
==========================================================================
-->
<target name="javadoc">
<mkdir dir="javadoc"/>
<javadoc
classpathref="lib-jars"
sourcepath="src/main/java"
destdir="javadoc"
windowtitle="Droidsafe API"
use="true"
useexternalfile="true"
/>
</target>
<!--
==========================================================================
Copy libraries for eclipse plugin
==========================================================================
-->
<target name="plugin-clean" description="Cleans the droidsafe eclipse jar files">
<delete file="${eclipse-plugin-path}/lib/droidsafe-core.jar"/>
<delete file="${eclipse-plugin-path}/lib//droidsafe-libs.jar"/>
<delete file="${eclipse-plugin-path}/android-lib/android-impl.jar"/>
<delete file="${eclipse-plugin-path}/android-lib/android.jar"/>
<delete file="${eclipse-plugin-path}/android-lib/droidcalls.jar"/>
<delete file="${eclipse-plugin-path}/android-lib/droidsafe-api-model.jar"/>
<delete file="${eclipse-plugin-path}/android-lib/effects.jar"/>
<delete file="${eclipse-plugin-path}/android-lib/maps.jar"/>
<delete file="${eclipse-plugin-path}/android-lib/usb.jar"/>
<delete dir="${eclipse-plugin-path}/android-lib/res"/>
</target>
<target name="plugin"
depends="compile"
description="Copy the droidsafe jar files to the plugin folders">
<copy todir="${eclipse-plugin-path}/lib" flatten="true">
<resources>
<file file="bin/droidsafe-core.jar"/>
<file file="bin/droidsafe-libs.jar"/>
</resources>
</copy>
<copy todir="${eclipse-plugin-path}/android-lib" flatten="true">
<resources>
<file file="android-lib/android-impl.jar"/>
<file file="android-lib/android.jar"/>
<file file="android-lib/droidcalls.jar"/>
<file file="android-lib/droidsafe-api-model.jar"/>
<file file="android-lib/effects.jar"/>
<file file="android-lib/maps.jar"/>
<file file="android-lib/usb.jar"/>
</resources>
</copy>
<copy todir="${eclipse-plugin-path}/android-lib/res">
<fileset dir="android-lib/res"/>
</copy>
<copy todir="${eclipse-plugin-path}/config-files">
<fileset dir="config-files">
<exclude name="**/*.xml"/>
</fileset>
</copy>
</target>
<!--
==========================================================================
Build package and deploy the eclipse plugin
==========================================================================
-->
<target name="plugin-build"
description="Package the eclipse plugin and add the jar files to the update site"
depends="plugin">
<ant antfile="src/eclipse/build-plugin.xml" target="build">
<property name="eclipse.plugin.location" value="${basedir}/src/eclipse"/>
</ant>
</target>
<target name="plugin-deploy"
description="Package and install the eclipse plugin"
depends="plugin">
<ant antfile="src/eclipse/build-plugin.xml" target="deploy">
<property name="eclipse.plugin.location" value="${basedir}/src/eclipse"/>
</ant>
</target>
</project>