forked from rsanchez-wsu/sp16-ceg3120
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
167 lines (134 loc) · 5.1 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="sp16-ceg3120" 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="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>
<!--
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 ned 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 not cause an error.
-->
<path id="ivy.jar.path">
<pathelement location="/usr/share/java/ivy.jar"/>
</path>
<!-- ********************* -->
<!-- Declare the Ivy tasks -->
<!-- ********************* -->
<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 pattern="[conf]/[artifact]-[revision].[ext]" type="jar,bundle"/>
</target>
<target name="all"
depends="clean,init,build,test"
description="Execute the clean, init, build, and test targets"/>
<target name="build"
depends="init"
description="Build the code">
<mkdir dir="${classes.dir}"/>
<javac srcdir="src"
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="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"/>
</target>
<target name="test"
depends="init, build, checkstyle, findbugs"
description="Run tests on the code"/>
<target name="checkstyle" depends="init"
description="Runs CheckStyle over the code; 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-violationss" 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-violationss"/>
</condition>
</fail>
</target>
<target name="findbugs" depends="build"
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>
</project>