forked from rsanchez-wsu/jfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
234 lines (180 loc) · 6.15 KB
/
Copy pathbuild.xml
File metadata and controls
234 lines (180 loc) · 6.15 KB
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
<?xml version="1.0" encoding="UTF-8"?>
<project name="jfiles" default="all" xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="src.dir" value="src" />
<property name="build.dir" value="build" />
<property name="lib.dir" value="lib" />
<property name="tools.dir" value="tools" />
<property name="dist.dir" value="dist" />
<property name="classes.dir" value="${build.dir}/classes" />
<path id="build.lib.path">
<fileset dir="${lib.dir}" includes="*.jar" />
</path>
<path id="tools.lib.path">
<fileset dir="${tools.dir}" includes="*.jar" />
</path>
<path id="runtime.classpath">
<fileset dir="${dist.dir}" includes="*.jar" />
<fileset dir="${lib.dir}" includes="*.jar" />
</path>
<!--
In order to use the Ivy tasks, it is necessary for Ant to be able to find
the Ivy jar. If you install the Ivy plugin for your IDE, then the Ivy
instance in your IDE will handle resolving the necessary dependencies. If
you want to be able to run the Ant tasks from the command line, you need to
make sure to install the ivy.jar in your ${ANT_HOME}/lib directory so that
Ant can find it.
Instructions for installing Apache Ivy can be obtained here:
For use with command-line Ant: http://ant.apache.org/ivy/download.cgi
For use with an IDE: http://ant.apache.org/ivy/ivyde/download.cgi
-->
<!--
This location is set to that Ant is able to locate the ivy.jar on systems
(like Linux) that use a package manager but do not install every .jar into
the system classpath by default (or that don't have a system classpath).
If the ivy.jar is in ${ANT_HOME}/lib, then it will be found there first
and this path will be ignored. If this path does not exist on your system
its declaration here will have no effect.
-->
<path id="ivy.jar.path">
<pathelement location="/usr/share/java/ivy.jar" />
</path>
<!-- ******************** -->
<!-- Declare the Ivy task -->
<!-- ******************** -->
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant"
classpathref="ivy.jar.path" />
<target name="init"
depends="resolve"
description="Initialize the build environment">
<taskdef name="checkstyle"
classname="com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask"
classpathref="tools.lib.path" />
<taskdef name="findbugs"
classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
classpathref="tools.lib.path" />
</target>
<target name="resolve"
description="Retrieve dependencies with Ivy">
<ivy:configure />
<ivy:resolve />
<ivy:retrieve type="jar,bundle"
pattern="[conf]/[artifact]-[revision].[ext]" />
</target>
<target name="all"
depends="clean, init, build, test"
description="Execute the clean, init, build, and test targets" />
<target name="build"
depends="build-java, build-jar"
description="Compile the code">
</target>
<target name="build-java"
depends="init"
description="Compile the code">
<mkdir dir="${classes.dir}" />
<javac srcdir="src"
classpathref="build.lib.path"
destdir="${classes.dir}"
includeantruntime="false"
debug="on"
deprecation="on">
<compilerarg value="-Xlint:all" />
<compilerarg value="-Xlint:-path" />
<compilerarg value="-Werror" />
</javac>
<copy todir="build">
<fileset dir="src">
<exclude name="**/*.java" />
</fileset>
</copy>
</target>
<target name="build-jar"
depends="build-java"
description="Pack the class files into a JAR">
<mkdir dir="${dist.dir}"/>
<jar destfile="${dist.dir}/${ant.project.name}.jar"
basedir="${classes.dir}"/>
</target>
<target name="clean"
description="Remove compiled artifacts and clean up work files">
<delete dir="${lib.dir}" quiet="true" />
<delete dir="${tools.dir}" quiet="true" />
<delete dir="${build.dir}" quiet="true" />
<delete dir="${dist.dir}" quiet="true" />
</target>
<target name="test"
depends="init, build, checkstyle, findbugs"
description="Run tests on the code" />
<target name="checkstyle"
depends="init"
description="Runs CheckStyle; fails if violations are found">
<mkdir dir="${build.dir}/checkstyle" />
<checkstyle config="${basedir}/.checkstyle.xml">
<fileset dir="${src.dir}" includes="**/*.java" />
<formatter type="plain" />
<formatter type="xml"
toFile="${build.dir}/checkstyle/${ant.project.name}.xml" />
</checkstyle>
<fileset id="cs-violations" dir="${build.dir}/checkstyle">
<patternset>
<include name="*.xml" />
</patternset>
<contains text="<error" />
</fileset>
<fail message="CheckStyle violation found!">
<condition>
<resourcecount when="greater" count="0" refid="cs-violations" />
</condition>
</fail>
</target>
<target name="findbugs"
depends="build-java"
description="Runs FindBugs over the code; fails if bugs are found">
<mkdir dir="${build.dir}/findbugs" />
<pathconvert property="tools.lib.prop" refid="tools.lib.path" />
<findbugs classpath="${tools.lib.prop}"
reportLevel="low"
effort="max"
failOnError="true"
warningsProperty="findbugs-warning"
output="html"
outputFile="${build.dir}/findbugs/${ant.project.name}.html">
<sourcePath>
<fileSet dir="${src.dir}">
<include name="**/*.java" />
</fileSet>
</sourcePath>
<auxClasspath>
<fileSet dir="${lib.dir}">
<include name="**/*.jar" />
</fileSet>
</auxClasspath>
<class location="${classes.dir}" />
</findbugs>
<fail if="findbugs-warning" message="FindBugs has found bugs!" />
</target>
<target name="run-client-gui"
depends="build-jar"
description="Executes the JFiles client GUI application">
<java classname="edu.wright.cs.jfiles.client.JFilesGui"
classpathref="runtime.classpath"
fork="true"
failonerror="true"/>
</target>
<target name="run-client-text"
depends="build-jar"
description="Executes the JFiles client text-mode application">
<java classname="edu.wright.cs.jfiles.client.JFilesClient"
classpathref="runtime.classpath"
fork="true"
failonerror="true"/>
</target>
<target name="run-server"
depends="build-jar"
description="Executes the JFiles server application">
<java classname="edu.wright.cs.jfiles.server.JFilesServer"
classpathref="runtime.classpath"
fork="true"
failonerror="true"/>
</target>
</project>