-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.xml
96 lines (80 loc) · 3.22 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
<?xml version="1.0"?>
<project name="Notes01" basedir=".">
<!-- Initialisation of properties -->
<property name="lib" value="lib"/>
<property name="bin" value="bin"/>
<property name="src" value="src"/>
<property name="testsrc" value="test"/>
<!-- Third party libraries needed if unit tests are to be run -->
<property name="junit.jar" location="${lib}/junit.jar"/>
<property name="org.hamcrest.core_1.1.0.v20090501071000.jar" location="${lib}/org.hamcrest.core_1.1.0.v20090501071000.jar"/>
<!--
Classpath
The test classes require "junit.jar" and a "hamcrest" jar. the Eclipse build will pull from
Eclipse's Junit plugin, but I've included a reference to a "junit.jar" in "lib" for the
benefit of non-Eclipse users building with "ant".
-->
<path id="classpath">
<pathelement location="${bin}"/>
<pathelement path="${junit.jar}"/>
<pathelement path="${org.hamcrest.core_1.1.0.v20090501071000.jar}"/>
</path>
<!-- Setup - create bin directory if does not exist -->
<target name="setup">
<mkdir dir="${bin}"/>
</target>
<!-- Clean - delete the bin directory, containing all build classes and libraries -->
<target name="clean">
<delete dir="${bin}"/>
</target>
<target name="compile" description="compilation">
<javac srcdir="${src}" destdir="${bin}" debug="yes" includeantruntime="false">
<include name="**/*.java"/>
<classpath refid="classpath"/>
</javac>
</target>
<target name="compiletest" description="compilation">
<javac srcdir="${src}" destdir="${bin}" debug="yes" includeantruntime="false">
<include name="**/*.java"/>
<classpath refid="classpath"/>
</javac>
<javac srcdir="${testsrc}" destdir="${bin}" debug="yes" includeantruntime="false">
<include name="**/*.java"/>
<classpath refid="classpath"/>
</javac>
</target>
<target name="create_run_jar">
<jar destfile="${bin}/Notes01.jar" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Main-Class" value="Notes01"/>
<attribute name="Class-Path" value="."/>
</manifest>
<fileset dir="${bin}/"/>
</jar>
</target>
<target name="create_test_jar">
<jar destfile="${bin}/Notes01.jar" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Main-Class" value="Notes01"/>
<attribute name="Class-Path" value="."/>
</manifest>
<fileset dir="${bin}/"/>
<zipfileset excludes="META-INF/*.SF" src="${lib}/junit.jar"/>
<zipfileset excludes="META-INF/*.SF" src="${lib}/org.hamcrest.core_1.1.0.v20090501071000.jar"/>
</jar>
</target>
<!--
Include libraries for Junit testing
To run a unit test built this way do "ant buildtest" followed by:
java -cp Notes01.jar org.junit.runner.JUnitCore Notes01TestAmpersand01
-->
<target name="buildtest" depends="setup,compiletest,create_test_jar">
</target>
<!--
Main
Use "ant clean" followed by "ant build" to create a simple Notes01.class
without any unit testing libraries.
-->
<target name="build" depends="setup,compile,create_run_jar">
</target>
</project>