-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.xml
240 lines (214 loc) · 9.62 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
<?xml version='1.0' encoding='UTF-8'?>
<!-- Copyright: Copyright © 2006-2010 Ian Phillips and Örjan Lundberg. -->
<!-- License: Apache Software License (Version 2.0) -->
<!-- Build file tested with Ant version 1.7.0. -->
<!-- $Id$ -->
<project name="rvsnoop" default="dist" basedir=".">
<description>
A TIBCO Rendezvous message viewing utility.
</description>
<property name="version" value="1.6.2"/>
<tstamp/>
<tstamp><format property="tstamp.date" pattern="yyyy-MM-dd HH:mm:ss"/></tstamp>
<target name="init">
<property file="build.properties"/>
<!-- Override this to change the location of the build. -->
<property name="dir.build" value="build"/>
<!-- Override these to control the build. -->
<property name="javac.debug" value="true"/>
<property name="javac.optimize" value="true"/>
<property name="javac.deprecation" value="false"/>
<property name="javadoc.offline" value="false"/>
<!-- If you are building with a non-Sun JDK you may need to change this. -->
<property name="lib.java" value="${java.home}/lib/rt.jar"/>
<!-- Override these to change the locations of the dependencies. -->
<property name="lib.tibrv" value="/opt/tibco/tibrv/8.2/lib/tibrvj.jar"/>
<property name="lib.tibsdk" value="/opt/tibco/tra/5.6/lib/TIBCOrt.jar"/>
<!-- These are only used to run the analytics target. -->
<property name="lib.findbugs" value="${user.home}/Library/Java/findbugs-1.3.4"/>
<property name="lib.pmd" value="${user.home}/Library/Java/pmd-4.2.2"/>
<fileset id="include.classpath" dir="lib">
<include name="*.jar"/>
<exclude name="junit*"/>
</fileset>
<path id="compile.classpath">
<fileset refid="include.classpath"/>
<path location="${lib.tibrv}"/>
<path location="${lib.tibsdk}"/>
</path>
<path id="test.classpath">
<path refid="compile.classpath"/>
<path location="lib/junit-4.4.jar"/>
<path location="${dir.build}/classes/main"/>
<path location="${dir.build}/classes/test"/>
</path>
<fileset id="test.data" dir="src/test">
<include name="**/*.properties"/>
<include name="**/*.rbz"/>
<include name="**/*.txt"/>
</fileset>
<filterset id="filters">
<filter token="version" value="${version}"/>
<filter token="java.vendor" value="${java.vendor}"/>
<filter token="java.version" value="${java.version}"/>
<filter token="os.name" value="${os.name}"/>
<filter token="os.version" value="${os.version}"/>
<filter token="os.arch" value="${os.arch}"/>
<filter token="tstamp.date" value="${build.date}"/>
<filter token="suffix" value="${file.suffix}"/>
</filterset>
<mkdir dir="${dir.build}/classes/main/META-INF"/>
<mkdir dir="${dir.build}/classes/test"/>
<mkdir dir="${dir.build}/doc/user"/>
<mkdir dir="${dir.build}/doc/developer/test"/>
<mkdir dir="${dir.build}/dist/bin"/>
<mkdir dir="${dir.build}/dist/doc"/>
<mkdir dir="${dir.build}/dist/lib"/>
<mkdir dir="${dir.build}/dist/src"/>
</target>
<target name="compile" depends="init"
description="Compile all of the Java class files (excluding tests).">
<javac srcdir="src/main" destdir="${dir.build}/classes/main" includes="**/*.java"
debug="${javac.debug}" optimize="${javac.optimize}" encoding="UTF-8"
deprecation="${javac.deprecation}" source="1.5" target="1.5">
<classpath refid="compile.classpath"/>
</javac>
<propertyfile comment="Build Information" file="${dir.build}/classes/main/META-INF/build.properties">
<entry key="build.version" value="${version}"/>
<entry key="build.date" value="${tstamp.date}"/>
<entry key="build.java.vendor" value="${java.vendor}"/>
<entry key="build.java.version" value="${java.version}"/>
<entry key="build.os.name" value="${os.name}"/>
<entry key="build.os.arch" value="${os.arch}"/>
<entry key="build.os.version" value="${os.version}"/>
</propertyfile>
</target>
<target name="test" depends="compile"
description="Compile and run the unit tests.">
<javac srcdir="src/test" destdir="${dir.build}/classes/test" includes="**/*.java"
debug="true" optimize="false" encoding="UTF-8"
deprecation="${javac.deprecation}" source="1.5" target="1.5">
<classpath refid="test.classpath"/>
</javac>
<copy todir="${dir.build}/classes/test">
<fileset refid="test.data"/>
</copy>
<junit printsummary="true" haltonerror="true" fork="true" forkmode="perBatch">
<classpath refid="test.classpath"/>
<formatter type="xml"/>
<batchtest todir="${dir.build}/doc/developer/test">
<fileset dir="${dir.build}/classes/test">
<include name="**/*Test.class"/>
<!-- Exclude all of the abstract classes. -->
<exclude name="org/rvsnoop/RecordLedgerTest.class"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="${dir.build}/doc/developer/test">
<!-- Just the individual tests. -->
<fileset dir="${dir.build}/doc/developer/test">
<include name="TEST-*.xml"/>
</fileset>
<report todir="${dir.build}/doc/developer/test"/>
</junitreport>
<delete>
<!-- Both individual and aggregated tests. -->
<fileset dir="${dir.build}/doc/developer/test">
<include name="TEST*.xml"/>
</fileset>
</delete>
</target>
<target name="javadoc" depends="init"
description="Compile all of the Java API documentation.">
<mkdir dir="${dir.build}/doc/api"/>
<javadoc destdir="${dir.build}/doc/api" version="true" author="true"
use="true" source="1.5" access="protected"
windowtitle="RvSnoop ${version} API Documentation">
<doctitle><![CDATA[<h1>RvSnoop ${version}</h1>]]></doctitle>
<bottom><![CDATA[Copyright © 2002-2007 <a href="http://ianp.org/">Ian Phillips</a> and Örjan Lundberg.]]></bottom>
<packageset dir="src/main" defaultexcludes="true" includes="**"/>
<link href="http://java.sun.com/j2se/1.4.2/docs/api" offline="${javadoc.offline}"/>
<link href="http://www.xom.nu/apidocs" offline="${javadoc.offline}"/>
<classpath refid="compile.classpath"/>
</javadoc>
</target>
<target name="jar" depends="test">
<jar jarfile="${dir.build}/dist/lib/rvsnoop-${version}.jar" compress="false"
manifestencoding="UTF-8" index="true">
<manifest>
<attribute name="Implementation-Title" value="RvSnoop"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Örjan Lundberg & Ian Phillips"/>
<attribute name="Implementation-URL" value="http://rvsnoop.org/"/>
</manifest>
<fileset dir="${dir.build}/classes/main" includes="**/*.class"/>
<fileset dir="src/resources" includes="resources/**/*.png"/>
<fileset dir="src/main" includes="**/*.properties" excludes="commons-logging.properties"/>
</jar>
</target>
<target name="analyze" depends="compile"
description="Analyze the code base and generate reports.">
<echo>Analyzing with PMD...</echo>
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask">
<classpath>
<fileset dir="${lib.pmd}/lib" includes="*.jar"/>
</classpath>
</taskdef>
<pmd shortFilenames="true" encoding="UTF-8">
<ruleset>etc/rvsnoop.pmd</ruleset>
<formatter type="html" toFile="${dir.build}/doc/developer/pmd-report.html"
linkPrefix="file://../../src/main/"/>
<fileset dir="src/main" includes="**/*.java"/>
</pmd>
<echo>Analyzing with FindBugs...</echo>
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
<classpath>
<fileset dir="${lib.findbugs}/lib" includes="*.jar"/>
</classpath>
</taskdef>
<findbugs home="${lib.findbugs}" output="html" jvmargs="-Xmx256m"
outputFile="${dir.build}/doc/developer/fb-report.html">
<auxClasspath>
<path refid="compile.classpath"/>
</auxClasspath>
<sourcePath path="src/main"/>
<class location="${dir.build}/classes/main"/>
</findbugs>
</target>
<target name="dist" depends="jar, analyze"
description="Package all files required for a distribution.">
<copy todir="${dir.build}/dist/bin" encoding="utf-8">
<fileset dir="bin" includes="*"/>
</copy>
<chmod dir="${dir.build}/dist/bin" includes="*.sh" perm="750"/>
<copy todir="${dir.build}/dist/doc">
<fileset dir="${dir.build}/doc"/>
<fileset dir="doc">
<include name="**/*.html"/>
<include name="**/*.css"/>
<include name="**/*.png"/>
</fileset>
</copy>
<copy todir="${dir.build}/dist/lib">
<fileset refid="include.classpath"/>
<!-- No need to copy rvsnoop.jar as it is added by the jar target. -->
</copy>
<zip destfile="${dir.build}/dist/src/rvsnoop-${version}-src.zip">
<zipfileset dir="src/main" includes="**/*.java, **/*.properties"/>
</zip>
<echo>Creating the tarred and gzipped distributable.</echo>
<tar destfile="${dir.build}/rvsnoop-${version}.tgz" compression="gzip">
<tarfileset dir="${dir.build}/dist" mode="750" dirmode="550" prefix="rvsnoop-${version}">
<include name="bin/*.sh"/>
</tarfileset>
<tarfileset dir="${dir.build}/dist" mode="440" dirmode="550" prefix="rvsnoop-${version}">
<include name="**/*.*"/>
<exclude name="bin/*.sh"/>
</tarfileset>
</tar>
</target>
<target name="clean" depends="init"
description="Remove all of the generated files.">
<delete dir="${dir.build}"/>
</target>
</project>