forked from clarkware/jdepend
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
executable file
·253 lines (201 loc) · 7.2 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
<?xml version="1.0"?>
<project name="jdepend" default="test">
<description>
Builds and tests JDepend - the Java package dependency analyzer.
</description>
<property file="build.properties"/>
<property environment="env"/>
<property name="Name" value="${ant.project.name}"/>
<property name="version" value="2.9.1"/>
<property name="src.dir" location="src"/>
<property name="test.dir" location="test"/>
<property name="build.dir" location="build"/>
<property name="docs.dir" location="docs"/>
<property name="dist.dir" location="dist"/>
<property name="run.dir" location="${build.dir}"/>
<property name="javadoc.dir" location="${build.dir}/docs/api"/>
<property name="dist.name" value="${Name}-${version}"/>
<property name="package.dir" location="${dist.dir}/${dist.name}"/>
<property name="build.debug" value="true"/>
<path id="project.classpath">
<pathelement location="${build.dir}"/>
</path>
<target name="prepare">
<tstamp />
<mkdir dir="${build.dir}"/>
<available property="junit.available"
classname="junit.framework.TestCase"/>
</target>
<target name="compile" depends="prepare"
description="Compiles the source code">
<javac srcdir="${src.dir}"
destdir="${build.dir}"
debug="${build.debug}">
<classpath refid="project.classpath"/>
</javac>
</target>
<target name="compile-sample" depends="prepare"
description="Compiles the sample code">
<javac srcdir="sample"
destdir="${build.dir}"
debug="${build.debug}">
<classpath refid="project.classpath"/>
</javac>
</target>
<target name="compile-tests" depends="compile"
if="junit.available"
description="Compiles the test code">
<javac srcdir="${test.dir}"
destdir="${build.dir}"
debug="${build.debug}">
<classpath refid="project.classpath"/>
</javac>
<copy todir="${build.dir}/data">
<fileset dir="${test.dir}/data" />
</copy>
</target>
<target name="test" depends="compile-tests"
if="junit.available"
description="Runs all the tests (need to have JUnit available for instance using -lib junit-4.3.1.jar)">
<junit haltonfailure="yes" fork="yes">
<test name="jdepend.framework.AllTests"/>
<formatter type="plain" usefile="false"/>
<sysproperty key="jdepend.home" value="${basedir}"/>
<classpath refid="project.classpath"/>
</junit>
</target>
<target name="run-jdepend" depends="compile"
description="Runs JDepend on itself">
<java classname="jdepend.textui.JDepend" fork="yes">
<classpath refid="project.classpath"/>
<arg file="${run.dir}"/>
</java>
</target>
<target name="run-jdepend-components" depends="compile"
description="Runs JDepend on itself">
<java classname="jdepend.textui.JDepend" fork="yes">
<classpath refid="project.classpath"/>
<arg value="-components"/>
<arg value="jdepend,java,junit"/>
<arg value="${run.dir}"/>
</java>
</target>
<target name="validate-jdepend-task">
<fail message="ANT_HOME must be set" unless="env.ANT_HOME"/>
<available property="jdependtask.available"
classname="org.apache.tools.ant.taskdefs.optional.jdepend.JDependTask"/>
<fail message="Missing jdepend.jar in system CLASSPATH"
unless="jdependtask.available"/>
</target>
<target name="run-jdepend-task"
if="jdependtask.available"
depends="validate-jdepend-task, compile"
description="Runs the JDepend Ant task">
<jdepend fork="yes"
outputfile="${docs.dir}/jdepend-report.txt">
<exclude name="java.*"/>
<exclude name="javax.*"/>
<classespath>
<pathelement location="${run.dir}"/>
</classespath>
<classpath refid="project.classpath"/>
</jdepend>
</target>
<target name="run-jdepend-task-html"
if="jdependtask.available"
depends="validate-jdepend-task, compile"
description="Runs the JDepend Ant task producing HTML">
<jdepend fork="yes"
format="xml"
outputfile="${docs.dir}/jdepend-report.xml">
<classespath>
<pathelement location="${run.dir}"/>
</classespath>
<classpath refid="project.classpath"/>
</jdepend>
<style basedir="${docs.dir}"
destdir="${docs.dir}"
includes="jdepend-report.xml"
style="${ant.home}/etc/jdepend.xsl"/>
</target>
<target name="jdepend-to-graphviz"
depends="compile"
description="Runs JDepend and converts XML output into Graphviz">
<java classname="jdepend.xmlui.JDepend" fork="yes">
<classpath refid="project.classpath"/>
<arg value="-file"/>
<arg value="${docs.dir}/jdepend-report.xml"/>
<arg value="${run.dir}"/>
</java>
<style basedir="${docs.dir}"
destdir="${docs.dir}"
includes="jdepend-report.xml"
extension=".dot"
style="contrib/jdepend2dot.xsl"/>
</target>
<target name="javadoc" depends="compile"
description="Generates JavaDoc">
<mkdir dir="${javadoc.dir}"/>
<javadoc packagenames="*"
sourcepath="${src.dir}"
destdir="${javadoc.dir}"
author="true"
version="true"
windowtitle="JDepend ${version} API"
doctitle="JDepend ${version} API"
bottom="Copyright © 1999-2005 Clarkware Consulting, Inc.">
<classpath refid="project.classpath"/>
</javadoc>
</target>
<target name="jar" depends="compile"
description="Creates a JAR file">
<mkdir dir="${dist.dir}"/>
<jar destfile="${dist.dir}/${dist.name}.jar"
basedir="${build.dir}" />
</target>
<target name="package"
depends="clean, test, jar, javadoc"
description="Creates a distribution file">
<copy todir="${package.dir}">
<fileset dir="${basedir}">
<include name="build.xml"/>
<include name="README"/>
<include name="CHANGES"/>
<include name="LICENSE"/>
</fileset>
</copy>
<copy todir="${package.dir}/docs">
<fileset dir="${docs.dir}"/>
</copy>
<copy todir="${package.dir}/src">
<fileset dir="${src.dir}"/>
</copy>
<copy todir="${package.dir}/test">
<fileset dir="${test.dir}"/>
</copy>
<copy todir="${package.dir}/sample">
<fileset dir="sample"/>
</copy>
<copy todir="${package.dir}/contrib">
<fileset dir="contrib">
<include name="jdepend2dot.sh"/>
<include name="jdepend2dot.xsl"/>
<include name="**/fitnesse/*"/>
</fileset>
</copy>
<copy todir="${package.dir}/lib"
file="${dist.dir}/${dist.name}.jar"/>
<tar tarfile="${dist.dir}/${dist.name}.tar.gz"
basedir="${dist.dir}/"
compression="gzip"
includes="${dist.name}/**" />
<zip destfile="${dist.dir}/${dist.name}.zip"
basedir="${dist.dir}/"
includes="${dist.name}/**" />
</target>
<target name="clean"
description="Deletes all build artifacts">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
</project>