forked from soot-oss/soot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
330 lines (298 loc) · 12.5 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
<?xml version="1.0"?>
<project default="compile" name="Soot Build File">
<property file="ant.settings"/>
<target name="settings">
<fail
message="Please copy ant.settings.template to ant.settings, and set the variables in it."
unless="jasmin.jar"
/>
</target>
<target name="compile" depends="settings,sablecc,jastadd,copypeephole,settings,singletons,options">
<mkdir dir="classes"/>
<javac
destdir="classes"
debug="true"
includeantruntime="true"
deprecation="on"
source="1.6"
target="1.6"
fork="true"
memorymaximumsize="512m"
>
<compilerarg value="-Xlint:all"/>
<compilerarg value="-Xlint:-unchecked"/>
<compilerarg value="-Xlint:-serial"/>
<compilerarg value="-Xlint:-dep-ann"/>
<compilerarg value="-Xlint:-cast"/>
<classpath>
<pathelement location="classes"/>
<pathelement location="${polyglot.jar}"/>
<pathelement location="${xmlprinter.jar}"/>
<pathelement location="${jasmin.jar}"/>
<pathelement location="${heros.jar}"/>
<pathelement location="${axmlprinter2.jar}"/>
<pathelement location="${baksmali.jar}"/>
<pathelement location="${baksmali2.jar}"/>
<pathelement location="${slf4j-api.jar}"/>
<pathelement location="${slf4j-simple.jar}"/>
</classpath>
<src path="src"/>
<src path="generated/singletons"/>
<src path="generated/sablecc"/>
<src path="generated/jastadd"/>
<src path="generated/options"/>
</javac>
<copy file="src/soot/jbco/gui/jbco.jpg" tofile="classes/soot/jbco/gui/jbco.jpg"/>
</target>
<target name="singletons" depends="singletons-dep" unless="singletons-uptodate">
<xslt
style="${basedir}/src/make-singletons.xsl"
in="${basedir}/src/singletons.xml"
out="${basedir}/generated/singletons/soot/Singletons.java"
/>
</target>
<target name="singletons-dep">
<uptodate property="singletons-uptodate" targetfile="generated/singletons/soot/Singletons.java">
<srcfiles dir="src" includes="singletons.xml"/>
</uptodate>
</target>
<target name="options" depends="settings">
<xslt
style="${basedir}/src/soot/options/make-soot-options.xsl"
in="${basedir}/src/soot/options/soot_options.xml"
out="${basedir}/generated/options/soot/options/Options.java"
/>
<xslt
style="${basedir}/src/soot/options/ant-task.xsl"
in="${basedir}/src/soot/options/soot_options.xml"
out="${basedir}/generated/options/soot/AntTask.java"
/>
<xslt
style="${basedir}/src/soot/options/phase_options_dialog.xsl"
in="${basedir}/src/soot/options/soot_options.xml"
out="${basedir}/eclipse/ca.mcgill.sable.soot/src/ca/mcgill/sable/soot/ui/PhaseOptionsDialog.java"
/>
</target>
<target name="copypeephole" depends="sablecc,settings">
<copy file="src/soot/baf/toolkits/base/peephole.dat" tofile="classes/soot/baf/toolkits/base/peephole.dat"/>
<copy file="generated/sablecc/soot/jimple/parser/parser/parser.dat" tofile="classes/soot/jimple/parser/parser/parser.dat"/>
<copy file="generated/sablecc/soot/jimple/parser/lexer/lexer.dat" tofile="classes/soot/jimple/parser/lexer/lexer.dat"/>
</target>
<target name="determine-sablecc-uptodate">
<uptodate property="sablecc.uptodate" srcfile="src/jimple.scc" targetfile="generated/sablecc/soot/jimple/parser/parser/Parser.java"/>
</target>
<target name="sablecc" depends="determine-sablecc-uptodate,settings" unless="sablecc.uptodate">
</target>
<target name="determine-jastadd-uptodate" depends="settings" if="jastaddfrontend.loc">
<uptodate property="jastadd.uptodate" targetfile="generated/jastadd/beaver/Action.java">
<srcfiles dir= "${jastaddfrontend.loc}" includes="**/*.jrag,**/*.flex,**/*.parser,**/*.scanner"/>
</uptodate>
</target>
<target name="jastadd" depends="determine-jastadd-uptodate,settings" unless="jastadd.uptodate" if="jastaddfrontend.loc">
<ant antfile="${jastaddfrontend.loc}/build.xml" target="gen" inheritall="false"/>
<mkdir dir="generated/jastadd"/>
<copy todir="generated/jastadd/soot">
<fileset dir="${jastaddfrontend.loc}/soot" includes="**/*.java"/>
</copy>
<copy todir="generated/jastadd/beaver">
<fileset dir="${jastaddfrontend.loc}/beaver" includes="**/*.java"/>
</copy>
</target>
<target name="javadoc">
<javadoc
classpath="classes:${polyglot.jar}:${jasmin.jar}:${heros.jar}"
sourcepath="src:generated/singletons:generated/sablecc:generated/options"
destdir="doc"
maxmemory="400m"
link="${javaapi.url}"
windowtitle="Soot API"
verbose="true"
use="true"
>
<fileset dir="src" includes="**/*.java"/>
</javadoc>
</target>
<target name="clean">
<delete quiet="true">
<fileset dir="classes" includes="**/*.class" />
<fileset dir="testclasses" includes="**/*.class" />
<fileset dir="eclipse/ca.mcgill.sable.soot/classes" includes="**/*.class" />
<fileset dir="eclipse/ca.mcgill.sable.graph/classes" includes="**/*.class" />
</delete>
</target>
<target name="veryclean" depends="clean,veryclean-singletons,veryclean-options,veryclean-sablecc,veryclean-jastadd"/>
<target name="veryclean-singletons">
<delete quiet="true">
<fileset dir="generated/singletons" includes="**/*" />
</delete>
</target>
<target name="veryclean-options">
<delete quiet="true">
<fileset dir="generated/options" includes="**/*" />
<filename name="eclipse/ca.mcgill.sable.soot/src/ca/mcgill/sable/soot/ui/PhaseOptionsDialog.java"/>
</delete>
</target>
<target name="veryclean-sablecc">
<input
message="This will delete files that require SABLECC to be installed to regenerate. Are you sure?"
validargs="y,n"
addproperty="do.sablecc.delete"
/>
<condition property="do.sablecc.abort">
<equals arg1="n" arg2="${do.sablecc.delete}"/>
</condition>
<fail if="do.sablecc.abort">Build aborted by user.</fail>
<delete quiet="true">
<fileset dir="generated/sablecc" includes="**/*" />
</delete>
</target>
<target name="veryclean-jastadd">
<input
message="This will delete files that require JastAdd to be installed to regenerate. Are you sure?"
validargs="y,n"
addproperty="do.jastadd.delete"
/>
<condition property="do.jastadd.abort">
<equals arg1="n" arg2="${do.jastadd.delete}"/>
</condition>
<fail if="do.jastadd.abort">Build aborted by user.</fail>
<delete quiet="true" includeemptydirs="true">
<fileset dir="generated/jastadd" includes="**/*" />
</delete>
</target>
<target name="badfields" depends="compile,settings">
<java
classname="soot.tools.BadFields"
maxmemory="200m"
fork="true"
classpath="classes:${polyglot.jar}:${jasmin.jar}"
>
<arg value="-w"/>
<arg value="-f"/>
<arg value="none"/>
<arg value="-process-dir"/>
<arg value="classes"/>
<arg value="soot.Main"/>
</java>
</target>
<target name="buildtests" depends="compile,settings">
<mkdir dir="testclasses"/>
<javac
srcdir="tests"
destdir="testclasses"
classpath="classes:${polyglot.jar}:${jasmin.jar}:${junit.jar}:${hamcrest.jar}"
debug="true"
/>
</target>
<target name="runtests" depends="buildtests,settings">
<junit printsummary="yes">
<classpath>
<pathelement location="testclasses"/>
<pathelement location="classes"/>
<pathelement location="${polyglot.jar}"/>
<pathelement location="${jasmin.jar}"/>
<pathelement location="${junit.jar}"/>
<pathelement location="${hamcrest.jar}"/>
</classpath>
<formatter type="plain"/>
<batchtest>
<fileset dir="testclasses" includes="**/Test*.class"/>
<fileset dir="testclasses" includes="**/*Test.class"/>
</batchtest>
</junit>
</target>
<target name="release" depends="barebones,javadoc,settings">
</target>
<target name="barebones" depends="clean,options,sablecc,settings">
<tar destfile="${release.loc}/sootsrc-${soot.version}.tar.gz" compression="gzip" longfile="gnu">
<tarfileset dir="."/>
</tar>
<jar destfile="${release.loc}/sootsrc-${soot.version}.jar">
<fileset dir="."/>
</jar>
</target>
<target name="classesjar" depends="settings,compile">
<mkdir dir="META-INF"/>
<manifest file="META-INF/MANIFEST.MF">
<attribute name="Main-Class" value="soot.Main"/>
<attribute name="Implementation-Version" value="${soot.version}"/>
</manifest>
<jar destfile="${release.loc}/sootclasses-${soot.version}.jar" manifest="META-INF/MANIFEST.MF">
<fileset dir="classes"/>
</jar>
<delete dir="META-INF"/>
</target>
<target name="eclipse-plugin" depends="compile,settings,graph-plugin">
<xslt
style="src/soot/options/phase_options_dialog.xsl"
in="src/soot/options/soot_options.xml"
out="eclipse/ca.mcgill.sable.soot/src/ca/mcgill/sable/soot/ui/PhaseOptionsDialog.java"
/>
<javac
destdir="eclipse/ca.mcgill.sable.soot/classes"
debug="true"
>
<src path="eclipse/ca.mcgill.sable.soot/src"/>
<classpath>
<pathelement location="classes"/>
<pathelement location="eclipse/ca.mcgill.sable.graph/graph.jar"/>
<fileset dir="${eclipse.loc}/plugins/" includes="**/*.jar"/>
</classpath>
</javac>
<jar destfile="eclipse/ca.mcgill.sable.soot/soot-plugin.jar">
<fileset dir="eclipse/ca.mcgill.sable.soot/classes"/>
<fileset dir="eclipse/ca.mcgill.sable.soot/src" includes="**/*.properties"/>
</jar>
<replaceregexp
match="sootclasses-.*\.jar"
replace="sootclasses-${soot.version}.jar"
>
<fileset dir="eclipse/ca.mcgill.sable.soot" includes="plugin.xml"/>
</replaceregexp>
</target>
<!-- build the graph plugin-->
<target name="graph-plugin">
<javac
destdir="eclipse/ca.mcgill.sable.graph/classes"
debug="true"
>
<src path="eclipse/ca.mcgill.sable.graph/src"/>
<classpath>
<pathelement location="classes"/>
<fileset dir="${eclipse.loc}/plugins/" includes="**/*.jar"/>
</classpath>
</javac>
<jar destfile="eclipse/ca.mcgill.sable.graph/graph.jar">
<fileset dir="eclipse/ca.mcgill.sable.graph/classes"/>
</jar>
</target>
<target name="doc" depends="compile,settings">
<javadoc
sourcepath="src"
destdir="javadoc"
author="true"
version="true"
use="true"
windowtitle="Soot Documentation">
</javadoc>
<jar basedir="javadoc" destfile="${release.loc}/sootjavadoc-${soot.version}.jar" />
</target>
<target name="fulljar" depends="classesjar">
<mkdir dir="META-INF"/>
<manifest file="META-INF/MANIFEST.MF">
<attribute name="Main-Class" value="soot.Main"/>
<attribute name="Implementation-Version" value="${soot.version}"/>
</manifest>
<jar destfile="${release.loc}/soot-${soot.version}.jar" manifest="META-INF/MANIFEST.MF">
<zipfileset src="${release.loc}/sootclasses-${soot.version}.jar"/>
<zipfileset src="${jasmin.jar}"/>
<zipfileset src="${heros.jar}"/>
<zipfileset src="${polyglot.jar}"/>
<zipfileset src="${javacup.jar}"/>
<zipfileset src="${xmlprinter.jar}"/>
<zipfileset src="${baksmali.jar}"/>
<zipfileset src="${baksmali2.jar}"/>
</jar>
<delete dir="META-INF"/>
</target>
</project>