-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrader.xml
152 lines (133 loc) · 5.22 KB
/
grader.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
149
150
151
152
<project default="all">
<property name="problem.set" value="ps1"/>
<property name="project.name" value="${problem.set}-expressivo"/>
<property name="ant.build.javac.target" value="1.8"/>
<property name="build.sysclasspath" value="ignore"/>
<property name="beta.grader.jar" value="${problem.set}-beta-grader.jar"/>
<property name="final.grader.jar" value="${problem.set}-final-grader.jar"/>
<property name="grader.dir" value=".grader"/>
<property name="grader.report.file" value="my-grader-report.xml"/>
<property name="zipfile" value="my-submission.zip"/>
<condition property="final.grading">
<available file="${final.grader.jar}"/>
</condition>
<condition property="which.tests.ran" value="BETA + FINAL" else="BETA">
<isset property="final.grading"/>
</condition>
<path id="junit.jars">
<pathelement location="lib/junit-4.12.jar"/>
<pathelement location="lib/hamcrest-core-1.3.jar"/>
<pathelement location="lib/parserlib.jar"/>
</path>
<target name="all" depends="clean, beta, final, report">
<echo>
Your code has been compiled and run against the ${which.tests.ran} grading tests.
To see the test results, double-click on ${grader.report.file}.
To submit your problem set, upload ${zipfile} to the problem set's submission page in edX.
(If you don't see ${grader.report.file} or ${zipfile} in Eclipse, right-click on ${project.name} and choose Refresh.)
</echo>
</target>
<target name="clean">
<delete dir="${grader.dir}"/>
<delete file="${grader.report.file}"/>
</target>
<target name="unjar-beta">
<unjar src="${beta.grader.jar}" dest="${grader.dir}" />
</target>
<target name="compile" depends="unjar-beta">
<mkdir dir="${grader.dir}/bin-student"/>
<javac srcdir="src" destdir="${grader.dir}/bin-student" debug="on">
<include name="expressivo/*.java"/>
<classpath>
<path refid="junit.jars"/>
</classpath>
</javac>
<javac srcdir="test" destdir="${grader.dir}/bin-student" debug="on">
<include name="expressivo/*.java"/>
<classpath>
<path refid="junit.jars"/>
</classpath>
</javac>
<javac srcdir="${grader.dir}/tests-beta" destdir="${grader.dir}/bin-student" debug="on">
<include name="expressivo/beta/*Test.java"/>
<classpath>
<path refid="junit.jars"/>
<pathelement location="${grader.dir}/bin-student"/>
</classpath>
</javac>
</target>
<target name="unjar-final" if="${final.grading}">
<unjar src="${final.grader.jar}" dest="${grader.dir}" />
</target>
<target name="compile-final" depends="unjar-final" if="${final.grading}">
<echo message="${final.grading}"/>
<mkdir dir="${grader.dir}/bin-tests-final"/>
<javac srcdir="${grader.dir}/tests-final" destdir="${grader.dir}/bin-tests-final" debug="on">
<include name="expressivo/staff/*.java"/>
<include name="expressivo/grader/*.java"/>
<classpath>
<path refid="junit.jars"/>
<pathelement location="${grader.dir}/bin-student"/>
</classpath>
</javac>
</target>
<target name="beta" depends="compile">
<junit tempdir="${grader.dir}" fork="yes" timeout="8000">
<jvmarg value="-Ddidit.desc=Running your tests against your implementation."/>
<formatter type="xml" usefile="true"/>
<batchtest todir="${grader.dir}">
<fileset dir="${grader.dir}/bin-student" includes="expressivo/*Test.class"/>
</batchtest>
<classpath>
<path refid="junit.jars"/>
<pathelement location="${grader.dir}/bin-student"/>
</classpath>
<assertions>
<enable/>
</assertions>
</junit>
<junit tempdir="${grader.dir}" fork="yes" timeout="8000">
<jvmarg value="-Ddidit.desc=Running our beta tests against your implementation."/>
<formatter type="xml" usefile="true"/>
<batchtest todir="${grader.dir}">
<fileset dir="${grader.dir}/bin-student" includes="expressivo/beta/*Test.class"/>
</batchtest>
<classpath>
<path refid="junit.jars"/>
<pathelement location="${grader.dir}/bin-student"/>
</classpath>
<assertions>
<enable/>
</assertions>
</junit>
</target>
<target name="final" depends="compile, compile-final" if="${final.grading}">
<junit tempdir="${grader.dir}" fork="yes" timeout="40000">
<jvmarg value="-Ddidit.desc=Running our tests against your implementation"/>
<formatter type="xml" usefile="true"/>
<batchtest todir="${grader.dir}">
<fileset dir="${grader.dir}/bin-tests-final" includes="expressivo/grader/*Test.class"/>
</batchtest>
<classpath>
<path refid="junit.jars"/>
<pathelement location="${grader.dir}/bin-tests-final"/>
<pathelement location="${grader.dir}/bin-student"/>
</classpath>
<assertions>
<enable/>
</assertions>
</junit>
</target>
<target name="report">
<junitreport tofile="${grader.report.file}">
<fileset dir="${grader.dir}" includes="TEST-*.xml"/>
</junitreport>
<zip destfile="${zipfile}" fallbacktoUTF8="true">
<fileset dir=".">
<include name="**/*.java"/>
<include name="**/*.class"/>
<include name="**/*.xml"/>
</fileset>
</zip>
</target>
</project>