/
build.xml
315 lines (277 loc) · 11.4 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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="build" name="SimpleAnalysisPluginLibDexLib" xmlns:jacoco="antlib:org.jacoco.ant" xmlns:ivy="antlib:org.apache.ivy.ant">
<property environment="env" />
<property name="LIBS" value="${basedir}/lib" />
<property name="WALA" value="${basedir}/wala" />
<property name="debuglevel" value="source,lines,vars" />
<property name="target" value="1.6" />
<property name="source" value="1.6" />
<property name="src-dir" value="src" />
<property name="test-src-dir" value="test" />
<!--
here is the version of ivy we will use. change this property to try a newer
version if you want
-->
<property name="ivy.install.version" value="2.0.0-beta1"/>
<property name="ivy.jar.dir" value="${LIBS}/ivy"/>
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>
<target name="download-ivy" unless="skip.download">
<mkdir dir="${ivy.jar.dir}"/>
<!--
download Ivy from web site so that it can be used even without any special installation
-->
<echo message="installing ivy..."/>
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<!--
=================================
target: install-ivy
this target is not necessary if you put ivy.jar in your ant lib directory
if you already have ivy in your ant lib, you can simply remove this
target and the dependency the 'go' target has on it
=================================
-->
<target name="install-ivy" depends="download-ivy" description="--> install ivy">
<!--
try to load ivy here from local ivy dir, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir.
-->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<!-- =================================
target: retrieve
================================= -->
<target name="retrieve" depends="install-ivy" description="download project dependencies">
<ivy:settings />
<ivy:retrieve />
<ivy:cachepath pathid="IvyDeps.classpath" />
</target>
<path id="SimpleAnalysisPlugin.classpath">
<path refid="IvyDeps.classpath" />
<pathelement location="bin" />
<pathelement location="${basedir}" />
<!-- <pathelement location="${LIBS}/android_modeled2.jar"/> -->
<pathelement location="${WALA}/wala_cast.jar" />
<pathelement location="${WALA}/wala_cast_java.jar" />
<pathelement location="${WALA}/wala_cast_java_jdt.jar" />
<pathelement location="${WALA}/wala_core_tests.jar" />
<pathelement location="${WALA}/wala_core.jar" />
<pathelement location="${WALA}/wala_ide.jar" />
<pathelement location="${WALA}/wala_shrike.jar" />
<pathelement location="${WALA}/wala_util.jar" />
<pathelement location="${LIBS}/dexlib-1.3.4-dev.jar" />
</path>
<target name="init" depends="retrieve,init-mac,init-linux,init-windows">
<mkdir dir="bin" />
<copy includeemptydirs="false" todir="bin">
<fileset dir="${src-dir}">
<exclude name="**/*.launch" />
<exclude name="**/*.svn" />
<exclude name="**/*.java" />
</fileset>
</copy>
</target>
<!-- Init wala.properties file -->
<target name="init-mac" depends="cond-os" if="ismac">
<copy overwrite="true" file="conf/wala.properties.mac" tofile="wala.properties" />
</target>
<target name="init-linux" depends="cond-os" if="islinux">
<copy overwrite="true" file="conf/wala.properties.linux" tofile="wala.properties" />
</target>
<target name="init-windows" depends="cond-os" if="iswindows">
<copy overwrite="true" file="conf/wala.properties.windows" tofile="wala.properties" />
</target>
<target name="cond-os">
<condition property="iswindows">
<os family="windows" />
</condition>
<condition property="ismac">
<os family="mac" />
</condition>
<condition property="islinux">
<and>
<os family="unix" />
<not>
<os family="mac" />
</not>
</and>
</condition>
</target>
<!-- Clean the project -->
<target name="clean">
<delete dir="bin" />
<delete file="sap.jar" />
<delete file="sap_project.zip" />
<delete file="sap_project-src.zip" />
</target>
<target depends="clean" name="cleanall" />
<!-- Build the project -->
<target depends="build-subprojects,build-project" name="build" />
<target name="build-subprojects" />
<target depends="init" name="build-project">
<echo message="${ant.project.name}: ${ant.file}" />
<javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}" includeantruntime="false">
<src path="${src-dir}" />
<classpath refid="SimpleAnalysisPlugin.classpath" />
</javac>
</target>
<target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects" />
<target depends="build" name="build-tests">
<echo message="${ant.project.name}: ${ant.file}" />
<javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}" includeantruntime="false">
<src path="${src-dir}" />
<src path="${test-src-dir}" />
<classpath refid="SimpleAnalysisPlugin.classpath" />
</javac>
</target>
<!-- Run a default analysis-->
<target name="run">
<java classname="CombinedAnalysis" failonerror="true" fork="yes">
<arg line="apks/com.infonow.bofa.apk:${LIBS}/android_modeled2.jar android_flow.examples" />
<classpath refid="SimpleAnalysisPlugin.classpath" />
</java>
</target>
<target name="run-init" depends="init">
<mkdir dir="bin/conf" />
<copy includeemptydirs="false" todir="bin/conf">
<fileset dir="${basedir}/conf" includes="*" />
</copy>
</target>
<!-- practice -->
<target name="practice.dex.CG" depends="run-init,build">
<java classname="practice.dex.PDFCallGraphTest" failonerror="true" fork="yes">
<arg line="-apk ${basedir}/apks/Hello.apk" />
<classpath refid="SimpleAnalysisPlugin.classpath" />
</java>
</target>
<target name="practice.dex.TI" depends="run-init,build">
<java classname="practice.dex.TypeInferenceTest" failonerror="true" fork="yes">
<arg line="-apk ${basedir}/apks/Hello.apk" />
<classpath refid="SimpleAnalysisPlugin.classpath" />
</java>
</target>
<target name="practice.dex.IR" depends="run-init,build">
<java classname="practice.dex.PDFWalaIRTest" failonerror="true" fork="yes">
<arg line="-apk ${basedir}/apks/Hello.apk" />
<classpath refid="SimpleAnalysisPlugin.classpath" />
</java>
</target>
<!-- Create the jar -->
<target depends="build" name="jar">
<jar destfile="sap.jar" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Main-Class" value="org.scandroid.SeparateEntryAnalysis" />
<attribute name="Class-Path" value="." />
</manifest>
<fileset dir="${basedir}/bin" />
<zipfileset excludes="META-INF/*.SF" src="${WALA}/wala_cast.jar" />
<zipfileset excludes="META-INF/*.SF" src="${WALA}/wala_cast_java.jar" />
<zipfileset excludes="META-INF/*.SF" src="${WALA}/wala_cast_java_jdt.jar" />
<zipfileset excludes="META-INF/*.SF" src="${WALA}/wala_core.jar" />
<zipfileset excludes="META-INF/*.SF" src="${WALA}/wala_core_tests.jar" />
<zipfileset excludes="META-INF/*.SF" src="${WALA}/wala_ide.jar" />
<zipfileset excludes="META-INF/*.SF" src="${WALA}/wala_shrike.jar" />
<zipfileset excludes="META-INF/*.SF" src="${WALA}/wala_util.jar" />
<zipfileset excludes="META-INF/*.SF" src="${LIBS}/dexlib-1.3.4-dev.jar" />
<zipfileset excludes="META-INF/*.SF" src="${LIBS}/guava-13.0.1.jar" />
<zipfileset excludes="META-INF/*.SF" src="${LIBS}/jgrapht-0.8.3.jar" />
<zipfileset excludes="META-INF/*.SF" src="${LIBS}/commons-cli-1.2.jar" />
<zipfileset excludes="META-INF/*.SF" src="${LIBS}/commons-io-2.4.jar" />
<zipfileset excludes="META-INF/*.SF" src="${LIBS}/commons-lang3-3.1.jar" />
<zipfileset excludes="META-INF/*.SF" src="${LIBS}/slf4j-api-1.7.2.jar" />
<zipfileset excludes="META-INF/*.SF" src="${LIBS}/logback-classic-1.0.9.jar" />
<zipfileset excludes="META-INF/*.SF" src="${LIBS}/logback-core-1.0.9.jar" />
</jar>
</target>
<!-- Zip the project -->
<target depends="jar" name="zip">
<zip destfile="${basedir}/sap_project.zip">
<zipfileset dir="conf/" includes="*" prefix="conf/" />
<zipfileset dir="tools/" includes="script.pl,apktool.jar" prefix="tools" />
<fileset dir="." includes="sap.jar" />
</zip>
</target>
<target name="zip-src" depends="clean">
<zip destfile="${basedir}/sap_project-src.zip">
<zipfileset dir="conf/" includes="*" prefix="conf/" />
<zipfileset dir="tools/" includes="script.pl,apktool.jar" prefix="tools" />
<zipfileset dir="${src-dir}/" includes="**/*.java" prefix="${src-dir}" />
<zipfileset dir="lib/" includes="*.jar" prefix="lib" />
<fileset dir="." includes="build.xml" />
</zip>
</target>
<target name="test" depends="build, build-tests">
<junit haltonerror="false"
haltonfailure="false"
fork="yes"
maxmemory="6G"
printsummary="withOutAndErr">
<!-- Use the basic SCanDroid classpath: -->
<classpath refid="SimpleAnalysisPlugin.classpath" />
<batchtest>
<fileset dir="${test-src-dir}" includes="**/*Test.java" />
<!-- basic output -->
<formatter type="plain" usefile="false" />
</batchtest>
</junit>
</target>
<target name="test-jenkins" depends="build, build-tests">
<junit haltonerror="false"
haltonfailure="false"
fork="yes"
maxmemory="6G"
printsummary="withOutAndErr"
outputtoformatters="false">
<!-- Use the basic SCanDroid classpath: -->
<classpath refid="SimpleAnalysisPlugin.classpath" />
<batchtest>
<fileset dir="${test-src-dir}" includes="**/*Test.java" />
<!-- basic output -->
<formatter type="xml" />
</batchtest>
</junit>
</target>
<taskdef uri="antlib:org.jacoco.ant"
resource="org/jacoco/ant/antlib.xml">
<classpath path="lib/jacocoant.jar" />
</taskdef>
<target name="test-jenkins-coverage" depends="build, build-tests">
<jacoco:coverage append="false">
<junit haltonerror="false"
haltonfailure="false"
fork="yes"
maxmemory="6G"
printsummary="withOutAndErr"
outputtoformatters="false">
<!-- Use the basic SCanDroid classpath: -->
<classpath refid="SimpleAnalysisPlugin.classpath" />
<batchtest>
<fileset dir="${test-src-dir}" includes="**/*Test.java" />
<!-- basic output -->
<formatter type="xml" />
</batchtest>
</junit>
</jacoco:coverage>
</target>
<target name="test-jenkins-coverage-report" depends="test-jenkins-coverage">
<jacoco:report>
<executiondata>
<file file="jacoco.exec" />
</executiondata>
<structure name="SCanDroid">
<classfiles>
<fileset dir="bin" />
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="src" />
</sourcefiles>
</structure>
<html destdir="report" />
</jacoco:report>
</target>
</project>