-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
131 lines (111 loc) · 4.08 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
<!--
Project directory structure:
build.xml : this file
.gitignore: git ignore files for Java (EECS 293 version).
This is a hidden file, but do not ignore!
src/ : source .java files
Generated directories
build/ : .class files
report/
junit/index.html : JUnit report
jacoco/index.html: JaCoCo report
doc/ : JavaDoc
$ANT_HOME/lib must contain (see Ant-JUnit and JaCoCo installation guides):
ant-junit4.jar
ant-junit.jar
hamcrest-core-1.3.jar
junit-4.12.jar
jacocoant.jar
-->
<project name="wireframe" xmlns:jacoco="antlib:org.jacoco.ant">
<!-- Directory with source files -->
<property name="src.dir" value="src"/>
<!-- Directory with test source files -->
<property name="test-src.dir" value="test"/>
<!-- Directories with the class files -->
<property name="build.dir" value="build"/>
<!-- Directories with the log files -->
<property name="log.dir" value="log"/>
<property name="log.file" value="${log.dir}/log.txt"/>
<!-- Directories and files with the reports on unit test and code coverage -->
<property name="report.dir" value="report"/>
<property name="junit.dir" value="${report.dir}/junit"/>
<property name="jacoco.dir" value="${report.dir}/jacoco"/>
<property name="jacoco.file" value="${jacoco.dir}/jacoco.exec"/>
<!-- Directory for JavaDoc output -->
<property name="doc.dir" value="doc"/>
<!-- Class containing the main method: define ONLY IF your project has a main -->
<property name="main-class" value="Wireframe"/>
<!-- Additional jar that may be needed for properly runnign junit -->
<path id="hamcrest.classpath">
<pathelement location="${ant.home}/lib/hamcrest-core-1.3.jar"/>
</path>
<!-- ant clean : remove generated files -->
<target name="clean">
<delete dir="${build.dir}"/>
<delete dir="${report.dir}"/>
<delete dir="${doc.dir}"/>
<delete dir="${log.dir}"/>
</target>
<!-- ant build : compile the src -->
<target name="build">
<mkdir dir="${build.dir}"/>
<mkdir dir="${log.dir}"/>
<touch file="${log.file}"/>
<javac srcdir="${src.dir}" destdir="${build.dir}" debug="true" includeAntRuntime="yes"/>
</target>
<!-- ant run : define run target ONLY IF your project has a main -->
<target name="run" depends="build">
<java fork="true" classname="${main-class}" classpath="${build.dir}">
<arg value="${arg0}"/>
</java>
</target>
<!-- ant test : run unit tests -->
<target name="test" depends="build">
<mkdir dir="${report.dir}"/>
<mkdir dir="${junit.dir}"/>
<mkdir dir="${jacoco.dir}"/>
<jacoco:coverage destfile="${jacoco.file}">
<junit fork="yes" includeAntRuntime="yes" printsummary="withOutAndErr">
<formatter type="xml"/>
<batchtest fork="yes" filtertrace="off" todir="${junit.dir}">
<fileset dir="${build.dir}" includes="**/*Test.class"/>
</batchtest>
<classpath refid="hamcrest.classpath"/>
<classpath path="${build.dir}"/>
</junit>
</jacoco:coverage>
</target>
<!-- ant report : generate the JUnit and code coverage reports -->
<target name="report" depends="test">
<junitreport todir="${junit.dir}">
<fileset dir="${junit.dir}" includes="TEST-*.xml"/>
<report todir="${junit.dir}"/>
</junitreport>
<jacoco:report>
<executiondata>
<file file="${jacoco.file}"/>
</executiondata>
<structure name="${ant.project.name}">
<classfiles>
<fileset dir="${build.dir}">
<exclude name="**/*Test*.class"/>
</fileset>
</classfiles>
<sourcefiles>
<fileset dir="${src.dir}"/>
</sourcefiles>
</structure>
<html destdir="${jacoco.dir}"/>
</jacoco:report>
</target>
<!-- ant doc: generate JavaDoc documentation -->
<target name="doc">
<mkdir dir="${doc.dir}"/>
<javadoc destdir="${doc.dir}">
<fileset dir="${src.dir}" defaultexcludes="yes">
<exclude name="**/*Test.java"/>
</fileset>
</javadoc>
</target>
</project>