mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: auto add testlib.h to /w
This commit is contained in:
1 parent
d33401c4e9
commit
7fdcbc5220
2 files changed
+3
-1
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import fs from 'fs-extra';
|
||||
import { resolve } from 'path';
|
||||
import checkers from './checkers';
|
||||
import compile from './compile';
|
||||
import { SystemError } from './error';
|
||||
@@ -23,6 +24,7 @@ export async function check(config): Promise<[number, number, string]> {
|
||||
|
||||
export async function compileChecker(checkerType: string, checker: string, copyIn: any) {
|
||||
if (!checkers[checkerType]) throw new SystemError('Unknown checker type {0}.', [checkerType]);
|
||||
if (checkerType === 'testlib') copyIn['testlib.h'] = { src: resolve(__dirname, '../files/testlib.h') };
|
||||
const file = await fs.readFile(checker);
|
||||
// TODO cache compiled checker
|
||||
return await compile(parseFilename(checker).split('.')[1], file.toString(), 'checker', copyIn);
|
||||
|
||||
Reference in new issue
Block a user