-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
build.xml
148 lines (127 loc) · 4.74 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
<project name="java-algorithms-implementation" default="dist" basedir=".">
<description>
java-algorithms-implementation build file
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="test" location="test"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<path id="class.path">
<fileset dir="lib">
<include name="**/*.jar" />
</fileset>
</path>
<path id="test.class.path">
<fileset dir="lib">
<include name="**/*.jar" />
</fileset>
<fileset dir="dist">
<include name="**/*.jar" />
</fileset>
</path>
<target name="echo.env_vars">
<property environment="env_vars"/>
<echo>CLASSPATH='${env_vars.CLASSPATH}'</echo>
<echo>JAVA_HOME='${env_vars.JAVA_HOME}'</echo>
<echo>JAVA_OPTS='${env_vars.JAVA_OPTS}'</echo>
</target>
<target name="clean">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
<target name="init" depends="clean, echo.env_vars">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by build -->
<mkdir dir="${build}"/>
<!-- Create the dist directory structure used by build -->
<mkdir dir="${dist}"/>
</target>
<target name="build" depends="init" description="build the source">
<!-- Compile the java code from ${src} into ${build} -->
<javac encoding="UTF-8" includeantruntime="false" srcdir="${src}" destdir="${build}">
<compilerarg value="-Xlint:unchecked"/>
<classpath refid="class.path" />
</javac>
</target>
<target name="dist" depends="build" description="generate the distribution">
<!-- Put everything in ${build} into the java-algorithms-implementation-${DSTAMP}.jar file -->
<jar jarfile="${dist}/java-algorithms-implementation-${DSTAMP}.jar" basedir="${build}"/>
</target>
<target name="build_tests" depends="dist" description="build the source">
<!-- Compile the java testing code from ${test} into ${build} -->
<javac encoding="UTF-8" includeantruntime="false" srcdir="${test}" destdir="${build}">
<compilerarg value="-Xlint:unchecked"/>
<classpath refid="class.path" />
</javac>
</target>
<target name="tests_jar" depends="build_tests" description="generate the tests jar">
<!-- Put everything in ${build} into the java-algorithms-implementation-tests-${DSTAMP}.jar file -->
<jar jarfile="${dist}/java-algorithms-implementation-tests-${DSTAMP}.jar" basedir="${build}"/>
</target>
<target name="run_tests" depends="tests_jar">
<junit printsummary="on" haltonfailure="yes">
<jvmarg value="-server"/>
<classpath>
<path refid="test.class.path" />
</classpath>
<formatter type="brief" usefile="false" />
<batchtest>
<fileset dir="${test}" includes="**/test/*.java" excludes="**/test/AllTests.java" />
</batchtest>
</junit>
</target>
<target name="data_structures" depends="tests_jar" >
<java classname="com.jwetherell.algorithms.data_structures.timing.DataStructuresTiming">
<classpath>
<path refid="test.class.path" />
</classpath>
</java>
</target>
<target name="mathematics" depends="tests_jar" >
<java classname="com.jwetherell.algorithms.mathematics.timing.MathematicsTiming">
<classpath>
<path refid="test.class.path" />
</classpath>
</java>
</target>
<target name="numbers" depends="tests_jar" >
<java classname="com.jwetherell.algorithms.numbers.timing.NumbersTiming">
<classpath>
<path refid="test.class.path" />
</classpath>
</java>
</target>
<target name="search" depends="tests_jar" >
<java classname="com.jwetherell.algorithms.search.timing.SearchTiming">
<classpath>
<path refid="test.class.path" />
</classpath>
</java>
</target>
<target name="sequences" depends="tests_jar" >
<java classname="com.jwetherell.algorithms.sequence.timing.SequencesTiming">
<classpath>
<path refid="test.class.path" />
</classpath>
</java>
</target>
<target name="sorts" depends="tests_jar" >
<java classname="com.jwetherell.algorithms.sorts.timing.SortsTiming">
<classpath>
<path refid="test.class.path" />
</classpath>
</java>
</target>
<target name="strings" depends="tests_jar" >
<java classname="com.jwetherell.algorithms.strings.timing.StringsTiming">
<classpath>
<path refid="test.class.path" />
</classpath>
</java>
</target>
<target name="run_timing" depends="mathematics, numbers, search, sequences, strings, sorts, data_structures" />
<target name="test" depends="run_tests, run_timing" />
</project>