@@ -47,7 +47,7 @@ function icon(result: TestResult) {
47
47
}
48
48
}
49
49
class Grader {
50
- private builder : Builder
50
+ private builder : Builder | undefined
51
51
private logger : Logger
52
52
constructor (
53
53
private solutionDir : string ,
@@ -57,11 +57,17 @@ class Grader {
57
57
private regressionTestJob ?: number
58
58
) {
59
59
this . logger = new Logger ( regressionTestJob )
60
- this . builder = new GradleBuilder (
61
- this . logger ,
62
- this . gradingDir ,
63
- this . regressionTestJob
64
- )
60
+ if ( this . config . build . preset == 'java-gradle' ) {
61
+ this . builder = new GradleBuilder (
62
+ this . logger ,
63
+ this . gradingDir ,
64
+ this . regressionTestJob
65
+ )
66
+ } else if ( this . config . build . preset == 'none' ) {
67
+ this . builder = undefined
68
+ } else {
69
+ throw new Error ( `Unsupported build preset: ${ this . config . build . preset } ` )
70
+ }
65
71
if ( regressionTestJob ) {
66
72
console . log (
67
73
`Autograder configuration: ${ JSON . stringify ( this . config , null , 2 ) } `
@@ -257,6 +263,18 @@ class Grader {
257
263
)
258
264
}
259
265
async grade ( ) : Promise < AutograderFeedback > {
266
+ if ( ! this . builder ) {
267
+ return {
268
+ lint : {
269
+ status : 'pass' ,
270
+ output : 'Linter is not enabled for this assignment'
271
+ } ,
272
+ output : this . logger . getEachOutput ( ) ,
273
+ tests : [ ] ,
274
+ score : 0 ,
275
+ artifacts : [ ]
276
+ }
277
+ }
260
278
// const tmpDir = await mkdtemp(path.join(tmpdir(), 'pawtograder-'));
261
279
console . log ( 'Beginning grading' )
262
280
const tmpDir = path . join ( process . cwd ( ) , 'pawtograder-grading' )
@@ -292,7 +310,8 @@ class Grader {
292
310
`Build failed, submission can not be graded. Please fix the above errors below and resubmit. This submission will not count towards any submisison limits (if applicable for this assignment).`
293
311
)
294
312
this . logger . log ( 'visible' , msg )
295
- const allTests : AutograderTestFeedback [ ] = this . config . gradedParts
313
+ const gradedParts = this . config . gradedParts || [ ]
314
+ const allTests : AutograderTestFeedback [ ] = gradedParts
296
315
. filter ( ( part ) => ! part . hide_until_released )
297
316
. map ( ( part ) =>
298
317
part . gradedUnits . map ( ( gradedUnit ) => {
@@ -399,7 +418,8 @@ class Grader {
399
418
studentTestResults = await this . builder . test ( )
400
419
}
401
420
console . log ( 'Wrapping up' )
402
- const testFeedbacks = this . config . gradedParts
421
+ const gradedParts = this . config . gradedParts || [ ]
422
+ const testFeedbacks = gradedParts
403
423
. map ( ( part ) =>
404
424
this . gradePart ( part , testResults , mutantResults , mutantFailureAdvice )
405
425
)
0 commit comments