-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
148 lines (132 loc) · 4.46 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
<?xml version="1.0"?>
<!-- ant build file for scheduler project
Copyright (C) 2008-2016 Minnesota Department of Transportation
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. -->
<project default="jar" basedir=".">
<!-- Base directory configuration -->
<property name="src.dir" value="src"/>
<property name="test.dir" location="test"/>
<!-- Property configuration -->
<property file="project.properties"/>
<property file="${user.home}/.ant.properties"/>
<!-- Build directory configuration -->
<property name="build.dir" value="build"/>
<property name="build.lib" value="${build.dir}/lib"/>
<property name="build.src" value="${build.dir}/src"/>
<property name="build.classes" value="${build.dir}/classes"/>
<property name="build.docs" value="${build.dir}/docs"/>
<property name="build.test" location="${build.dir}/test"/>
<property name="build.reports" location="${build.dir}/reports"/>
<!-- Compiler configuration -->
<property name="build.compiler.pedantic" value="true"/>
<path id="junit.classpath">
<pathelement location="${build.dir}/classes"/>
<pathelement location="${build.dir}/test"/>
</path>
<!-- Prepare the build directory -->
<target name="prepare">
<tstamp/>
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.lib}"/>
<mkdir dir="${build.src}"/>
<mkdir dir="${build.docs}"/>
<copy todir="${build.src}">
<fileset dir="${src.dir}">
<include name = "**/*.java" />
</fileset>
</copy>
</target>
<!-- Compile the source code -->
<target name="compile"
depends="prepare"
description="Compile the source code">
<mkdir dir="${build.classes}"/>
<javac srcdir="${build.src}"
destdir="${build.classes}"
debug="${debug}"
deprecation="on"
includeantruntime="false"
source="1.7"
target="1.7">
<compilerarg value="-Xlint:unchecked"/>
</javac>
</target>
<!-- Create the jar file -->
<target name="jar"
depends="compile"
description="Generate the jar file">
<jar jarfile="${build.lib}/${name}-${version}.jar">
<fileset dir="${build.classes}">
<include name="us/mn/state/dot/sched/**"/>
</fileset>
</jar>
</target>
<!-- Create API documentation -->
<target name="docs"
depends="prepare"
description="Create the javadocs">
<mkdir dir="${build.docs}"/>
<javadoc packagenames="${packages}"
sourcepath="${basedir}/${build.src}"
destdir="${build.docs}"
author="true"
version="true"
windowtitle="${name} API"
doctitle="${name}"
bottom="Copyright © Minnesota Department of
Transportation. All Rights Reserved.">
</javadoc>
</target>
<!-- Prepare junit test directories -->
<target name="prepare-junit"
depends="prepare">
<delete dir="${build.reports}" />
<mkdir dir="${build.test}" />
<mkdir dir="${build.reports}" />
</target>
<!-- Compile junit test cases -->
<target name="compile-junit"
depends="compile, prepare-junit">
<javac srcdir="${test.dir}"
destdir="${build.test}"
debug="true"
includeantruntime="true"
source="1.7"
target="1.7">
<classpath refid="junit.classpath"/>
</javac>
</target>
<!-- Run junit test cases -->
<target name="test" depends="compile-junit"
description="Run junit test cases">
<junit printsummary="yes"
fork="yes"
haltonfailure="yes"
errorProperty="test.failed"
failureProperty="test.failed">
<assertions><enable/></assertions>
<classpath refid="junit.classpath"/>
<formatter type="plain" usefile="false"/>
<formatter type="xml" usefile="true"/>
<jvmarg value="-Ddebug=true"/>
<batchtest todir="${build.reports}">
<fileset dir="${build.test}"
includes="**/*Test.class"/>
</batchtest>
</junit>
<fail message="Junit tests failed. Check log and/or reports."
if="test.failed"/>
</target>
<!-- Clean up build and distribution directories -->
<target name="clean"
description="Clean up the created directories">
<delete dir="${build.dir}"/>
</target>
</project>