-
Notifications
You must be signed in to change notification settings - Fork 45
/
build.xml
executable file
·350 lines (315 loc) · 20 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
<!-- sb-contrib Ant build script. Dave Brosius -->
<project name="sb-contrib" default="default">
<presetdef name="javac">
<javac encoding="UTF-8" />
</presetdef>
<presetdef name="javadoc">
<javadoc encoding="UTF-8" />
</presetdef>
<property file="user.properties" />
<property file="build.properties" />
<property file="version.properties" />
<property name="src.dir" value="${basedir}/src/main/java" />
<property name="lib.dir" value="${basedir}/lib" />
<property name="etc.dir" value="${basedir}/etc" />
<property name="test.dir" value="${basedir}/src/test/java" />
<property name="target.dir" value="${basedir}/target" />
<property name="samples.dir" value="${basedir}/src/samples/java" />
<property name="main.classes.dir" value="${target.dir}/classes/main" />
<property name="samples.classes.dir" value="${target.dir}/classes/samples" />
<property name="test.classes.dir" value="${target.dir}/classes/test" />
<property name="javadoc.dir" value="${target.dir}/javadoc" />
<property name="htdocs.dir" value="${basedir}/htdocs" />
<property name="javac.source" value="1.8" />
<property name="javac.target" value="1.8" />
<property name="javac.deprecation" value="on" />
<property name="javac.debug" value="on" />
<property name="test_reports.dir" value="${target.dir}/reports/test"/>
<property name="fb-contrib.version" value="7.6.8" />
<property name="sb-contrib.version" value="7.6.8" />
<property name="sonatype.dir" value="${user.home}/.sb-contrib-${sb-contrib.version}-sonatype" />
<target name="clean" description="removes all generated collateral">
<delete dir="${target.dir}" />
<delete file="${htdocs.dir}/bugdescriptions.html" />
</target>
<target name="infra_jars" description="pull jars needed to build sb-contrib to ${user.dir}/.ant/lib">
<mkdir dir="${user.home}/.ant/lib" />
<get src="https://repo1.maven.org/maven2/com/mebigfatguy/yank/yank/2.0.1/yank-2.0.1.jar" dest="${user.home}/.ant/lib"/>
<get src="https://bitbucket.org/kjlubick/bugrankcheckstyle/downloads/bug-rank-check-style-1.0.0.jar" dest="${user.home}/.ant/lib"/>
<get src="https://repo1.maven.org/maven2/com/mebigfatguy/vcsversion/vcsversion/0.4.0/vcsversion-0.4.0.jar" dest="${user.home}/.ant/lib"/>
<get src="https://repo1.maven.org/maven2/com/mebigfatguy/fb-delta/fb-delta/0.6.0/fb-delta-0.6.0.jar" dest="${user.home}/.ant/lib" ignoreerrors="true"/>
<get src="https://repo1.maven.org/maven2/com/mebigfatguy/stringliterals/stringliterals/0.2.0/stringliterals-0.2.0.jar" dest="${user.home}/.ant/lib" ignoreerrors="true"/>
</target>
<target name="yank" xmlns:yank="antlib:com.mebigfatguy.yank" unless="no.yank">
<mkdir dir="${lib.dir}" />
<yank:yank yankFile="${basedir}/yank.csv" destination="${lib.dir}" proxyServer="${proxy.server}" source="true" separateClassifierTypes="true" checkSHADigests="true">
<server url="https://repo1.maven.org/maven2" />
<generateVersions propertyFileName="${basedir}/version.properties" />
</yank:yank>
</target>
<target name="info">
<echo message="sb-contrib - a spotbugs plugin"/>
<echo message=""/>
<echo message=" This project requires three jars to build sb-contrib: yank, bug-rank-check-style, vcsversion and" />
<echo message=" and optionally fb-delta, to generate delta's of bug reports, as well as stringliterals to dump"/>
<echo message=" a report of all string literals used in the code"/>
<echo message=""/>
<echo message=" This project uses yank (https://github.com/mebigfatguy/yank) for dependency management"/>
<echo message=" download yank.jar and place in ~/.ant/lib directory"/>
<echo message=" http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.mebigfatguy.yank%22"/>
<echo message="===="/>
<echo message=" Additionally, this project uses bug-rank-check-style to validate etc/bugrank.txt"/>
<echo message=" bug-rank-check-style-1.0.0.jar can be downloaded at https://bitbucket.org/klubick/bugrankcheckstyle/downloads"/>
<echo message=" and put in ~/.ant/lib alongside yank"/>
<echo message="===="/>
<echo message=" Finally, this project uses vcsversion to inject the git version information into the manifest file"/>
<echo message=" and can be downloaded and placed in ~/.ant/lib as well"/>
<echo message=" http://search.maven.org/#search%7Cga%7C1%7Cvcsversion"/>
<echo message="===="/>
<echo message=" If you want to generate delta reports between two sample.xml runs, this project also uses fb-delta to do"/>
<echo message=" delta-ing between two samples.xml files, to report what has been 'fixed' and what is 'new'"/>
<echo message=" and can be downloaded and placed in ~/.ant/lib as well"/>
<echo message=" http://search.maven.org/#search%7Cga%7C1%7Cfb-delta"/>
<echo message="===="/>
<echo message=" If you want to generate a report of all string literals used in the code base, this project also uses stringliterals to do"/>
<echo message=" that, and can be downloaded and placed in ~/.ant/lib as well"/>
<echo message=" http://search.maven.org/#search%7Cga%7C1%7Cstringliterals"/>
<echo message="===="/>
<echo message=" This task can be automated by running ant infra_jars"/>
</target>
<target name="default" depends="info, install"/>
<target name="-init" depends="yank">
<mkdir dir="${lib.dir}" />
<mkdir dir="${main.classes.dir}" />
<mkdir dir="${test.classes.dir}" />
<mkdir dir="${samples.classes.dir}" />
<mkdir dir="${javadoc.dir}" />
<path id="sb-contrib.classpath">
<pathelement location="${lib.dir}/spotbugs-${spotbugs.version}.jar" />
<pathelement location="${lib.dir}/bcel-${bcel.version}.jar" />
<pathelement location="${lib.dir}/spotbugs-annotations-${spotbugs-annotations.version}.jar" />
<pathelement location="${lib.dir}/asm-${asm.version}.jar" />
<pathelement location="${lib.dir}/asm-tree-${asm-tree.version}.jar" />
<pathelement location="${lib.dir}/jsr305-${jsr305.version}.jar" />
<pathelement location="${main.classes.dir}" />
</path>
<path id="sb-contrib.test.classpath">
<pathelement location="${lib.dir}/testng-${testng.version}.jar" />
<pathelement location="${lib.dir}/jcommander-${jcommander.version}.jar" />
<pathelement location="${lib.dir}/mockito-core-${mockito-core.version}.jar" />
<pathelement location="${lib.dir}/byte-buddy-${byte-buddy.version}.jar" />
<pathelement location="${lib.dir}/objenesis-${objenesis.version}.jar" />
<pathelement location="${lib.dir}/hamcrest-core-${hamcrest-core.version}.jar" />
<pathelement location="${spotbugs.dir}/lib/dom4j-1.6.1.jar" />
<pathelement location="${spotbugs.dir}/lib/jaxen-1.1.6.jar" />
</path>
<path id="sb-contrib.samples.classpath">
<pathelement location="${lib.dir}/akka-actor_2.12-${akka-actor_2.12.version}.jar" />
<pathelement location="${lib.dir}/akka-http_2.12-${akka-http_2.12.version}.jar" />
<pathelement location="${lib.dir}/akka-http-core_2.12-${akka-http-core_2.12.version}.jar" />
<pathelement location="${lib.dir}/akka-stream_2.12-${akka-stream_2.12.version}.jar" />
<pathelement location="${lib.dir}/asm-debug-all-${asm-debug-all.version}.jar" />
<pathelement location="${lib.dir}/javax.servlet.jsp-api-${javax.servlet.jsp-api.version}.jar" />
<pathelement location="${lib.dir}/junit-${junit.version}.jar" />
<pathelement location="${lib.dir}/jsr305-${jsr305.version}.jar" />
<pathelement location="${lib.dir}/testng-${testng.version}.jar" />
<pathelement location="${lib.dir}/javax.servlet-api-${javax.servlet-api.version}.jar" />
<pathelement location="${lib.dir}/jakarta.xml.bind-api-${jakarta.xml.bind-api.version}.jar" />
<pathelement location="${lib.dir}/log4j-${log4j.version}.jar" />
<pathelement location="${lib.dir}/log4j-api-${log4j-api.version}.jar" />
<pathelement location="${lib.dir}/commons-collections-${commons-collections.version}.jar" />
<pathelement location="${lib.dir}/commons-lang3-${commons-lang3.version}.jar" />
<pathelement location="${lib.dir}/commons-io-${commons-io.version}.jar" />
<pathelement location="${lib.dir}/dom4j-${dom4j.version}.jar" />
<pathelement location="${lib.dir}/backport-util-concurrent-${backport-util-concurrent.version}.jar" />
<pathelement location="${lib.dir}/threetenbp-${threetenbp.version}.jar" />
<pathelement location="${lib.dir}/slf4j-api-${slf4j-api.version}.jar" />
<pathelement location="${lib.dir}/guava-${guava.version}.jar" />
<pathelement location="${lib.dir}/httpclient-cache-${httpclient-cache.version}.jar" />
<pathelement location="${lib.dir}/httpcore-${httpcore.version}.jar" />
<pathelement location="${lib.dir}/httpclient-${httpclient.version}.jar" />
<pathelement location="${lib.dir}/commons-codec-${commons-codec.version}.jar" />
<pathelement location="${lib.dir}/spring-beans-${spring-beans.version}.jar" />
<pathelement location="${lib.dir}/spring-context-${spring-context.version}.jar" />
<pathelement location="${lib.dir}/spring-tx-${spring-tx.version}.jar" />
<pathelement location="${lib.dir}/javax.persistence-${javax.persistence.version}.jar" />
<pathelement location="${lib.dir}/jaxen-${jaxen.version}.jar" />
<pathelement location="${lib.dir}/mockito-core-${mockito-core.version}.jar" />
<pathelement location="${lib.dir}/hamcrest-core-${hamcrest-core.version}.jar" />
<pathelement location="${lib.dir}/hamcrest-library-${hamcrest-library.version}.jar" />
<pathelement location="${lib.dir}/jena-shaded-guava-${jena-shaded-guava.version}.jar" />
<pathelement location="${lib.dir}/javax.ws.rs-api-${javax.ws.rs-api.version}.jar" />
<pathelement location="${lib.dir}/jersey-media-multipart-${jersey-media-multipart.version}.jar" />
<pathelement location="${lib.dir}/scala-library-${scala-library.version}.jar" />
</path>
</target>
<target name="validate_xml" depends="-init" unless="skip-validate" description="validates the xml files">
<taskdef name="bug-rank-check-style" classname="text.style.check.BugRankCheckStyleTask"/>
<xmlvalidate lenient="false" failonerror="yes">
<attribute name="http://apache.org/xml/features/validation/schema" value="true" />
<attribute name="http://xml.org/sax/features/namespaces" value="true" />
<fileset dir="${etc.dir}" includes="*.xml" excludes="findbugs-exclude.xml,pmd-rules.xml"/>
</xmlvalidate>
<bug-rank-check-style findbugsxml="etc/findbugs.xml" failOnMissingDetector="false" />
</target>
<target name="compile" depends="-init" description="compiles java files">
<javac srcdir="${src.dir}" destdir="${main.classes.dir}" source="${javac.source}" target="${javac.target}" deprecation="${javac.deprecation}" debug="${javac.debug}" includeantruntime="false">
<classpath refid="sb-contrib.classpath" />
</javac>
</target>
<target name="compile_test" depends="compile" description="compiles java test files">
<javac srcdir="${test.dir}" destdir="${test.classes.dir}" source="${javac.source}" target="${javac.target}" deprecation="${javac.deprecation}" debug="${javac.debug}" includeantruntime="false">
<classpath refid="sb-contrib.classpath" />
<classpath refid="sb-contrib.test.classpath" />
</javac>
</target>
<target name="compile_samples" depends="-init" description="compiles sample problem files">
<javac srcdir="${samples.dir}" destdir="${samples.classes.dir}" source="1.8" target="1.8" deprecation="${javac.deprecation}" debug="${javac.debug}" includeantruntime="false">
<compilerarg value="-XDignore.symbol.file"/>
<classpath refid="sb-contrib.classpath" />
<classpath refid="sb-contrib.samples.classpath" />
</javac>
<delete file="${samples.dir}/SJVU_Sample.class" />
<javac srcdir="${samples.dir}" destdir="${samples.classes.dir}" source="1.4" target="1.4" deprecation="${javac.deprecation}" debug="${javac.debug}" includeantruntime="false">
<include name="SJVU_Sample.java" />
<classpath refid="sb-contrib.classpath" />
<classpath refid="sb-contrib.samples.classpath" />
</javac>
</target>
<target name="test" depends="compile_test" unless="no.test" description="runs unit tests">
<mkdir dir="${test_reports.dir}" />
<taskdef resource="testngtasks" classpath="${lib.dir}/testng-${testng.version}.jar"/>
<testng outputDir="${test_reports.dir}">
<classfileset dir="${test.classes.dir}" includes="**/*.class"/>
<classpath refid="sb-contrib.classpath"/>
<classpath refid="sb-contrib.test.classpath"/>
<classpath location="${test.classes.dir}"/>
</testng>
</target>
<target name="jar" depends="compile" xmlns:vcs="antlib:com.mebigfatguy.vcsversion" description="produces the sb-contrib jar file">
<vcs:vcsversion vcs="git" revisionProperty="_rev_" dateProperty="_date_" branchProperty="_branch_" urlProperty="_url_"/>
<jar destfile="${target.dir}/sb-contrib-${sb-contrib.version}.jar">
<fileset dir="etc">
<include name="findbugs.xml" />
<include name="messages*.xml" />
<include name="bugrank.txt" />
<include name="*.license" />
</fileset>
<fileset dir="${main.classes.dir}">
<include name="**/*.class" />
</fileset>
<fileset dir="${basedir}">
<include name="plugin.xml" />
<include name="license.txt" />
</fileset>
<manifest>
<attribute name="sb-contrib-version" value="${sb-contrib.version}" />
<attribute name="Main-Class" value="com.mebigfatguy.fbcontrib.FBContrib" />
<attribute name="git-url" value="${_url_}" />
<attribute name="git-branch" value="${_branch_}" />
<attribute name="git-revision" value="${_rev_}" />
<attribute name="git-date" value="${_date_}" />
<attribute name="Eclipse-RegisterBuddy" value="edu.umd.cs.findbugs.plugin.eclipse" />
<attribute name="Bundle-ManifestVersion" value="2" />
<attribute name="Bundle-Name" value="sb-contrib plugin" />
<attribute name="Bundle-SymbolicName" value="sb-contrib; singleton:=true" />
<attribute name="Bundle-Version" value="${sb-contrib.version}" />
<attribute name="Bundle-ClassPath" value="." />
<attribute name="Bundle-Vendor" value="SB-Contrib Project" />
<attribute name="Require-Bundle" value="edu.umd.cs.findbugs.plugin.eclipse" />
<attribute name="Bundle-ActivationPolicy" value="lazy" />
<attribute name="Export-Package" value="com.mebigfatguy.fbcontrib, com.mebigfatguy.fbcontrib.collect, com.mebigfatguy.fbcontrib.detect, com.mebigfatguy.fbcontrib.debug, com.mebigfatguy.fbcontrib.utils" />
<attribute name="Import-Package" value="edu.umd.cs.findbugs, edu.umd.cs.findbugs.ba, edu.umd.cs.findbugs.ba.generic, edu.umd.cs.findbugs.bcel, edu.umd.cs.findbugs.visitclass, edu.umd.cs.findbugs.internalAnnotations, org.apache.bcel, org.apache.bcel.classfile, org.apache.bcel.generic" />
</manifest>
</jar>
</target>
<target name="html" depends="-init" description="generates dynamic html">
<xslt basedir="${etc.dir}" destdir="${htdocs.dir}" style="${etc.dir}/bugdescriptions.xsl" in="${etc.dir}/messages.xml" out="${htdocs.dir}/bugdescriptions.html" />
</target>
<target name="srczip" description="builds the source distribution zip file">
<zip destfile="${target.dir}/sb-contrib-src-${sb-contrib.version}.zip">
<fileset dir="${basedir}">
<include name="**/*.java" />
<include name="**/*.xml" />
<include name="**/*.xsd" />
<include name="**/*.license" />
<include name="**/*.txt" />
<include name="**/*.md" />
<include name="**/*.csv" />
<include name="**/*.example" />
<include name="**/*.fbp" />
</fileset>
</zip>
</target>
<target name="javadoc" depends="-init" description="build the javadoc for the project">
<javadoc packagenames="com.mebigfatguy.*" sourcepath="${src.dir}" classpathref="sb-contrib.classpath" destdir="${javadoc.dir}" windowtitle="fb-contrib api" access="private" failonerror="true">
<doctitle><![CDATA[<h1>sb-contrib javadoc</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright © 2005-2019 MeBigFatGuy.com. All Rights Reserved.</i>]]></bottom>
</javadoc>
</target>
<target name="build" depends="-init, validate_xml, compile, compile_test, compile_samples, test, jar" description="builds the plugin jar">
</target>
<target name="install" depends="build" description="installs the plugin into spotbugs">
<echo message="Spotbugs: ${spotbugs.dir}/plugin"/>
<copy todir="${spotbugs.dir}/plugin">
<fileset dir="${target.dir}">
<include name="sb-contrib-${sb-contrib.version}.jar" />
</fileset>
</copy>
</target>
<target name="sample_delta" depends="install" xmlns:fbdelta="antlib:com.mebigfatguy.fbdelta" description="compares this runs reported bugs on the sample classes set, against the stored report">
<taskdef resource="edu/umd/cs/findbugs/anttask/tasks.properties" classpath="${lib.dir}/findbugs-ant-${findbugs-ant.version}.jar"/>
<findbugs reportlevel="low" home="${spotbugs.dir}" auxClassPathRef="sb-contrib.samples.classpath" output="xml:withMessages" jvmargs="-ea -Xmx800m" projectName="Samples" outputFile="${target.dir}/samples.xml">
<class location="${samples.classes.dir}" />
</findbugs>
<fbdelta:fbdelta baseReport="${basedir}/samples.xml" updateReport="${target.dir}/samples.xml" outputReport="${target.dir}/samples_delta.xml" changed="delta"/>
<antcall target="report"/>
</target>
<target name="report" if="${delta}">
<loadfile property="diff" srcFile="${target.dir}/samples_delta.xml"/>
<echo>${diff}</echo>
</target>
<target name="literals" depends="jar" xmlns:stringliterals="antlib:com.mebigfatguy.stringliterals" description="generate report of string literals used in code">
<stringliterals:stringliterals>
<classpath id="source">
<fileset dir="${main.classes.dir}">
<include name="**/*.class"/>
</fileset>
</classpath>
</stringliterals:stringliterals>
</target>
<target name="release" depends="build, srczip, html, javadoc" description="prepares everything for a release" />
<target name="sonatype" depends="release" description="prepare an artifact bundle for sonatype">
<mkdir dir="${sonatype.dir}"/>
<copy todir="${sonatype.dir}" file="${target.dir}/sb-contrib-${sb-contrib.version}.jar"/>
<copy tofile="${sonatype.dir}/sb-contrib-${sb-contrib.version}-sources.jar" file="${target.dir}/sb-contrib-src-${sb-contrib.version}.zip"/>
<jar destfile="${sonatype.dir}/sb-contrib-${sb-contrib.version}-javadoc.jar" basedir="${target.dir}" includes="javadoc/**"/>
<copy tofile="${sonatype.dir}/sb-contrib-${sb-contrib.version}.pom" file="${basedir}/pom.xml"/>
<exec executable="gpg">
<arg value="-abi" />
<arg value="${sonatype.dir}/sb-contrib-${sb-contrib.version}.jar" />
</exec>
<exec executable="gpg">
<arg value="-abi" />
<arg value="${sonatype.dir}/sb-contrib-${sb-contrib.version}.pom" />
</exec>
<exec executable="gpg">
<arg value="-abi" />
<arg value="${sonatype.dir}/sb-contrib-${sb-contrib.version}-sources.jar" />
</exec>
<exec executable="gpg">
<arg value="-abi" />
<arg value="${sonatype.dir}/sb-contrib-${sb-contrib.version}-javadoc.jar" />
</exec>
<jar destfile="${sonatype.dir}/bundle.jar" basedir="${sonatype.dir}" includes="sb-contrib*">
</jar>
<echo message="" />
<echo message="" />
<echo message="====================================================================================================================================" />
<echo message="sonatype update bundle produced at ${sonatype.dir}/bundle.jar" />
<echo message="upload this jar at https://oss.sonatype.org" />
<echo message="" />
<echo message="see link for details-> https://central.sonatype.org/pages/ossrh-guide.html" />
<echo message="====================================================================================================================================" />
</target>
</project>