forked from mebigfatguy/fb-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
executable file
·278 lines (248 loc) · 15.3 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
<!-- fb-contrib Ant build script. Dave Brosius -->
<project name="fb-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" />
<property name="lib.dir" value="${basedir}/lib" />
<property name="etc.dir" value="${basedir}/etc" />
<property name="target.dir" value="${basedir}/target" />
<property name="samples.dir" value="${basedir}/samples" />
<property name="main.classes.dir" value="${target.dir}/classes/main" />
<property name="samples.classes.dir" value="${target.dir}/classes/samples" />
<property name="javadoc.dir" value="${target.dir}/javadoc" />
<property name="htdocs.dir" value="${basedir}/htdocs" />
<property name="javac.source" value="1.7" />
<property name="javac.target" value="1.7" />
<property name="javac.deprecation" value="on" />
<property name="javac.debug" value="on" />
<property name="fb-contrib.version" value="6.7.0-SNAPSHOT" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-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 fb-contrib to ${user.dir}/.ant/lib">
<mkdir dir="${user.home}/.ant/lib" />
<get src="http://repo1.maven.org/maven2/com/mebigfatguy/yank/yank/1.6.1/yank-1.6.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="http://repo1.maven.org/maven2/com/mebigfatguy/vcsversion/vcsversion/0.4.0/vcsversion-0.4.0.jar" dest="${user.home}/.ant/lib"/>
<get src="http://repo1.maven.org/maven2/com/mebigfatguy/fb-delta/fb-delta/0.4.1/fb-delta-0.4.1.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.xls" destination="${lib.dir}" proxyServer="${proxy.server}" source="true" separateClassifierTypes="true">
<server url="http://repo1.maven.org/maven2" />
<generateVersions propertyFileName="${basedir}/version.properties" />
</yank:yank>
</target>
<target name="info">
<echo message="fb-contrib - a findbugs plugin"/>
<echo message=""/>
<echo message=" This project requires three jars to build fb-contrib: yank, bug-rank-check-style, vcsversion and" />
<echo message=" and optionally fb-delta, to generate delta's of bug reports"/>
<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=" 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="${samples.classes.dir}" />
<mkdir dir="${javadoc.dir}" />
<path id="fb-contrib.classpath">
<pathelement location="${lib.dir}/findbugs-${findbugs.version}.jar" />
<pathelement location="${lib.dir}/bcel-findbugs-${bcel-findbugs.version}.jar" />
<pathelement location="${lib.dir}/annotations-${annotations.version}.jar" />
<pathelement location="${lib.dir}/asm-debug-all-${asm-debug-all.version}.jar" />
</path>
<path id="fb-contrib.samples.classpath">
<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}/testng-${testng.version}.jar" />
<pathelement location="${lib.dir}/javax.servlet-api-${javax.servlet-api.version}.jar" />
<pathelement location="${lib.dir}/log4j-${log4j.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}/backport-util-concurrent-${backport-util-concurrent.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}/jsr311-api-${jsr311-api.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}/mockito-all-${mockito-all.version}.jar" />
</path>
</target>
<target name="validate_xml" depends="-init" 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"/>
</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="fb-contrib.classpath" />
</javac>
</target>
<target name="compile_samples" depends="-init" description="compiles sample problem files">
<javac srcdir="${samples.dir}" destdir="${samples.classes.dir}" source="1.7" target="1.7" deprecation="${javac.deprecation}" debug="${javac.debug}" includeantruntime="false">
<compilerarg value="-XDignore.symbol.file"/>
<classpath refid="fb-contrib.classpath" />
<classpath refid="fb-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="fb-contrib.classpath" />
<classpath refid="fb-contrib.samples.classpath" />
</javac>
</target>
<target name="jar" depends="compile" xmlns:vcs="antlib:com.mebigfatguy.vcsversion" description="produces the fb-contrib jar file">
<vcs:vcsversion vcs="git" revisionProperty="_rev_" dateProperty="_date_" branchProperty="_branch_" urlProperty="_url_"/>
<jar destfile="${target.dir}/fb-contrib-${fb-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="fb-contrib-version" value="${fb-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="fb-contrib plugin" />
<attribute name="Bundle-SymbolicName" value="fb-contrib; singleton:=true" />
<attribute name="Bundle-Version" value="${fb-contrib.version}" />
<attribute name="Bundle-ClassPath" value="." />
<attribute name="Bundle-Vendor" value="FB-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}/fb-contrib-src-${fb-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="**/*.xls" />
<include name="**/*.example" />
</fileset>
</zip>
</target>
<target name="javadoc" depends="-init" description="build the javadoc for the project">
<javadoc packagenames="com.mebigfatguy.*" sourcepath="${src.dir}" classpathref="fb-contrib.classpath" destdir="${javadoc.dir}" windowtitle="fb-contrib api" access="private">
<doctitle><![CDATA[<h1>fb-contrib javadoc</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright © 2005-2016 MeBigFatGuy.com. All Rights Reserved.</i>]]></bottom>
</javadoc>
</target>
<target name="build" depends="clean, -init, validate_xml, compile, compile_samples, jar" description="builds the plugin jar">
</target>
<target name="install" depends="build" description="installs the plugin into FindBugs">
<echo message="Findbugs: ${findbugs.dir}/plugin"/>
<copy todir="${findbugs.dir}/plugin">
<fileset dir="${target.dir}">
<include name="fb-contrib-${fb-contrib.version}.jar" />
</fileset>
</copy>
</target>
<target name="sample_delta" depends="build" 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="${findbugs.dir}" auxClassPathRef="fb-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="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}/fb-contrib-${fb-contrib.version}.jar"/>
<copy tofile="${sonatype.dir}/fb-contrib-${fb-contrib.version}-sources.jar" file="${target.dir}/fb-contrib-src-${fb-contrib.version}.zip"/>
<jar destfile="${sonatype.dir}/fb-contrib-${fb-contrib.version}-javadoc.jar" basedir="${target.dir}" includes="javadoc/**"/>
<copy tofile="${sonatype.dir}/fb-contrib-${fb-contrib.version}.pom" file="${basedir}/pom.xml"/>
<exec executable="gpg">
<arg value="-abi" />
<arg value="${sonatype.dir}/fb-contrib-${fb-contrib.version}.jar" />
</exec>
<exec executable="gpg">
<arg value="-abi" />
<arg value="${sonatype.dir}/fb-contrib-${fb-contrib.version}.pom" />
</exec>
<exec executable="gpg">
<arg value="-abi" />
<arg value="${sonatype.dir}/fb-contrib-${fb-contrib.version}-sources.jar" />
</exec>
<exec executable="gpg">
<arg value="-abi" />
<arg value="${sonatype.dir}/fb-contrib-${fb-contrib.version}-javadoc.jar" />
</exec>
<jar destfile="${sonatype.dir}/bundle.jar" basedir="${sonatype.dir}" includes="fb-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://docs.sonatype.org/display/Repository/Uploading+3rd-party+Artifacts+to+The+Central+Repository" />
<echo message="====================================================================================================================================" />
</target>
</project>