forked from OWASP/OWASP-WebScarab
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
288 lines (263 loc) · 10 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
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="build" name="webscarab">
<target name="init">
<!-- reads in certain local properties that should be set -->
<!-- ${docbook.location} refers to the location of the -->
<!-- DocBook XSL stylesheets and DTD's, for building the -->
<!-- JavaHelp documentation -->
<!-- none of these are REQUIRED, if you are just building -->
<!-- for local use -->
<property file="local.properties"/>
<tstamp/>
<property name="project.name" value="${ant.project.name}"/>
<property name="project.version" value="${DSTAMP}-${TSTAMP}"/>
<property name="jar" location="${basedir}/${project.name}.jar"/>
<property name="build.dir" location="${basedir}/build"/>
<property name="src.dir" location="${basedir}/src"/>
<property name="dist.dir" location="${basedir}/dist"/>
<property name="javadoc.dir" location="${basedir}/doc/api"/>
<property
name="javahelpstyle"
value="${docbook.location}/javahelp/javahelp.xsl"
/>
<property name="mainclass" value="org.owasp.webscarab.Main"/>
<path id="webscarab-classpath">
<fileset dir="${basedir}/lib">
<include name="*.jar"/>
</fileset>
</path>
<pathconvert property="manifest.classpath" pathsep=" ">
<path refid="webscarab-classpath"/>
<mapper>
<chainedmapper>
<flattenmapper/>
<globmapper from="*.jar" to="lib/*.jar"/>
</chainedmapper>
</mapper>
</pathconvert>
<property name="onejar.jar.name" value="${basedir}/${project.name}-onejar_${project.version}"/>
<property name="onejar.jar" value="${onejar.jar.name}.jar"/>
<property name="onejar.tempdir" value="${basedir}/onejar-temp"/>
<property name="onejar.tempjar" value="${onejar.tempdir}/temp_final.jar" />
</target>
<target depends="init" description="clean up the build area" name="clean">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
<delete dir="${onejar.tempdir}"/>
<delete>
<fileset dir="${src.dir}" includes="**/*.class"/>
</delete>
<mkdir dir="${build.dir}"/>
<mkdir dir="${dist.dir}"/>
<delete>
<fileset dir="${basedir}" includes="webscarab*.jar"/>
<fileset dir="${basedir}" includes="webscarab*.zip"/>
</delete>
</target>
<target depends="init" description="prepare the build area" name="prepare">
<copy file="server.p12" todir="${build.dir}"/>
<copy
file="src/org/owasp/webscarab/plugin/scripted/script.bsh"
todir="${build.dir}/org/owasp/webscarab/plugin/scripted/"
/>
<copy
file="src/org/owasp/webscarab/webscarab_logo.gif"
todir="${build.dir}/org/owasp/webscarab/"
/>
</target>
<target depends="prepare" description="Compile the sources" name="compile">
<javac
classpathref="webscarab-classpath"
deprecation="yes"
destdir="${build.dir}"
excludes="**/test/**"
listfiles="no"
optimize="on"
srcdir="${src.dir}"
debug="on"
source="1.6"
target="1.6"
includeantruntime="false"
>
</javac>
</target>
<target depends="prepare" description="JavaHelp" name="javahelp">
<!-- Commented out until I can get Ant working properly
Using xsltproc in the meantime
Use "ant -lib path/to/saxon.jar javahelp" for ant 1.7.1 and earlier - ->
<xmlcatalog id="docbook_catalogs">
<catalogpath>
<fileset dir="${docbook.location}" includes="**/catalog.xml"/>
</catalogpath>
</xmlcatalog>
<xslt
basedir="doc/userguide/"
destdir="${build.dir}/help"
scanincludeddirectories="false"
includes="swing.xml"
style="${javahelpstyle}"
>
<classpath location="${saxon.location}"/>
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
<xmlcatalog refid="docbook_catalogs"/>
</xslt>
<!- - -->
<exec executable="xsltproc">
<arg line="-stringparam base.dir build/help/ -stringparam use.id.as.filename 1 ${docbook.location}/javahelp/javahelp.xsl doc/userguide/swing.xml"/>
</exec>
<!-- - ->
<copy todir="${build.dir}/help/">
<fileset dir="doc/userguide/javahelp/"/>
</copy>
<!- - -->
<copy todir="${build.dir}/help/">
<fileset dir="doc/userguide/" includes="*.png,*.jpg,*.gif,*.css"/>
</copy>
</target>
<target depends="compile" description="Build a jar file" name="build">
<jar basedir="${build.dir}" jarfile="${jar}">
<manifest>
<attribute name="Main-Class" value="${mainclass}"/>
<attribute name="Class-Path" value="${manifest.classpath}"/>
<attribute name="Built-By" value="${user.name}"/>
<section name="org/owasp/webscarab/">
<attribute name="Implementation-Title" value="org.owasp.webscarab"/>
<attribute name="Implementation-Vendor" value="OWASP Foundation."/>
<attribute name="Implementation-Version" value="${project.version}"/>
</section>
</manifest>
</jar>
</target>
<target depends="build" description="Sign the jar" name="sign">
<signjar
keystore="${keystore}"
storetype="${storetype}"
alias="${alias}"
storepass="${password}"
preservelastmodified="true"
jar="${jar}">
</signjar>
<signjar
keystore="${keystore}"
storetype="${storetype}"
alias="${alias}"
storepass="${password}"
preserveLastModified="true"
lazy="true"
destDir="${dist.dir}">
<fileset dir="${basedir}/lib" includes="*.jar" />
</signjar>
</target>
<target depends="build" description="run the program" name="run">
<java jar="${jar}" fork="on">
</java>
</target>
<target depends="init" description="JavaDoc" name="javadoc">
<mkdir dir="${javadoc.dir}"/>
<javadoc classpathref="webscarab-classpath" destdir="${javadoc.dir}/" packagenames="org.owasp.webscarab.*">
<sourcepath>
<pathelement location="${src.dir}"/>
</sourcepath>
</javadoc>
</target>
<target
depends="init,clean,build"
description="Package webscarab.jar and libs in a ZIP"
name="zip"
>
<zip destfile="${dist.dir}/webscarab-${project.version}.zip">
<zipfileset
dir="${basedir}"
includes="ChangeLog"
prefix="webscarab-${project.version}"
/>
<zipfileset
dir="${basedir}"
includes="LICENSE"
prefix="webscarab-${project.version}"
/>
<zipfileset
dir="${basedir}"
includes="README"
prefix="webscarab-${project.version}"
/>
<zipfileset
dir="${basedir}"
includes="webscarab.jar"
prefix="webscarab-${project.version}"
/>
<zipfileset
dir="${basedir}/lib"
prefix="webscarab-${project.version}/lib"
/>
</zip>
</target>
<target name="one-jar" depends="build">
<echo message="Packaging ${project.name} into a single JAR at ${onejar.jar}"/>
<delete dir="${onejar.tempdir}"/>
<mkdir dir="${onejar.tempdir}"/>
<jar destfile="${onejar.tempjar}" filesetmanifest="skip">
<zipgroupfileset dir="lib" includes="*.jar"/>
<zipfileset src="${jar}"/>
<manifest>
<attribute name="Main-Class" value="${mainclass}"/>
<attribute name="Class-Path" value="${manifest.classpath}"/>
<attribute name="Built-By" value="${user.name}"/>
</manifest>
</jar>
<zip destfile="${onejar.jar}">
<zipfileset src="${onejar.tempjar}"
excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/>
</zip>
<delete file="${onejar.tempjar}"/>
<delete dir="${onejar.tempdir}"/>
</target>
<target
depends="init,clean,javadoc"
description="packages up the source files"
name="source"
>
<zip destfile="${dist.dir}/webscarab-src-${project.version}.zip">
<zipfileset
dir="${basedir}"
includes="ChangeLog"
prefix="webscarab-${project.version}"
/>
<zipfileset
dir="${basedir}"
includes="LICENSE"
prefix="webscarab-${project.version}"
/>
<zipfileset
dir="${basedir}"
includes="README"
prefix="webscarab-${project.version}"
/>
<zipfileset
dir="${basedir}"
includes="INSTALL"
prefix="webscarab-${project.version}"
/>
<zipfileset
dir="${basedir}"
includes="build.xml"
prefix="webscarab-${project.version}"
/>
<zipfileset
dir="${src.dir}"
excludes="**/.*"
prefix="webscarab-${project.version}/src"
/>
<zipfileset
dir="${javadoc.dir}"
excludes="**/.*"
prefix="webscarab-${project.version}/doc/api"
/>
</zip>
</target>
<target
depends="clean,one-jar,source"
description="Build all distributables"
name="dist"
/>
</project>