-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.xml
139 lines (120 loc) · 4.39 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
<project default="compile"
xmlns:if="ant:if"
xmlns:unless="ant:unless"
>
<!-- for explanation of
xmlns:if="ant:if"
xmlns:unless="ant:unless"
see: https://ant.apache.org/manual/ifunless.html
-->
<path id="project.class.path">
<pathelement location="jars/hamcrest-core-1.3.jar"/>
<pathelement location="jars/junit-4.12.jar"/>
<pathelement location="build/classes"/>
</path>
<property name="jar.file" value="build/jar/CS56Parser.jar"/>
<property name="javadoc.dest" location="docs"/>
<target name="clean" description="clean up">
<delete dir="build" quiet="true" />
<delete dir="temp.d" quiet="true" />
</target>
<target name="compile" description="compile the code">
<mkdir dir="build/classes"/>
<javac includeantruntime="false" srcdir="src" destdir="build/classes" debug="on">
<compilerarg value="-Xlint:unchecked"/>
<classpath refid="project.class.path" />
</javac>
</target>
<target name="javadoc" depends="compile" description="generate javadoc">
<delete quiet="true" dir="${javadoc.dest}" />
<mkdir dir="${javadoc.dest}" />
<javadoc destdir="${javadoc.dest}">
<fileset dir="src">
<include name="**/*.java"/>
</fileset>
<classpath refid="project.class.path"/>
<link href="http://docs.oracle.com/javase/8/docs/api/"/>
</javadoc>
</target>
<target name="jar" depends="compile" description="create a jar">
<mkdir dir="build/jar"/>
<jar destfile="${jar.file}" basedir="build/classes">
<manifest>
<attribute name="Main-Class" value="edu.ucsb.cs56.pconrad.parsing.Main"/>
</manifest>
</jar>
</target>
<target name="run" depends="jar" description="run the main">
<java jar="${jar.file}" fork="true"/>
</target>
<target name="test" depends="compile" description="run JUnit tests">
<junit haltonerror="no" haltonfailure="no">
<classpath refid="project.class.path" />
<batchtest fork="yes">
<fileset dir="src">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
<formatter type="brief" usefile="false" />
</junit>
</target>
<target name="diff-tests" depends="jar" description="run tests using CLI, diffing actual and expected output ">
<delete dir="temp.d" quiet="true" />
<mkdir dir="temp.d" />
<java jar="${jar.file}" fork="true">
<redirector
input="testdata/test01.input.txt"
output="temp.d/test01.output.txt" />
</java>
<condition property="test01passed" value="true">
<filesmatch file1="testdata/test01.expected.txt"
file2="temp.d/test01.output.txt" />
</condition>
<echo if:set="test01passed">test01 passed</echo>
<echo unless:set="test01passed">test01 failed</echo>
<java jar="${jar.file}" fork="true">
<redirector
input="testdata/test02.input.txt"
output="temp.d/test02.output.txt" />
</java>
<condition property="test02passed" value="true">
<filesmatch file1="testdata/test02.expected.txt"
file2="temp.d/test02.output.txt" />
</condition>
<echo if:set="test02passed">test02 passed</echo>
<echo unless:set="test02passed">test02 failed</echo>
<java jar="${jar.file}" fork="true">
<redirector
input="testdata/test03.input.txt"
output="temp.d/test03.output.txt" />
</java>
<condition property="test03passed" value="true">
<filesmatch file1="testdata/test03.expected.txt"
file2="temp.d/test03.output.txt" />
</condition>
<echo if:set="test03passed">test03 passed</echo>
<echo unless:set="test03passed">test03 failed</echo>
<java jar="${jar.file}" fork="true">
<redirector
input="testdata/test04.input.txt"
output="temp.d/test04.output.txt" />
</java>
<condition property="test04passed" value="true">
<filesmatch file1="testdata/test04.expected.txt"
file2="temp.d/test04.output.txt" />
</condition>
<echo if:set="test04passed">test04 passed</echo>
<echo unless:set="test04passed">test04 failed</echo>
<java jar="${jar.file}" fork="true">
<redirector
input="testdata/test05.input.txt"
output="temp.d/test05.output.txt" />
</java>
<condition property="test05passed" value="true">
<filesmatch file1="testdata/test05.expected.txt"
file2="temp.d/test05.output.txt" />
</condition>
<echo if:set="test05passed">test05 passed</echo>
<echo unless:set="test05passed">test05 failed</echo>
</target>
</project>