针对Testlib支持的编译方法
(source, name, binRoot, configDir, libraryDir, typeName string)
| 15 | |
| 16 | // 针对Testlib支持的编译方法 |
| 17 | func compileTestlibCodeFile(source, name, binRoot, configDir, libraryDir, typeName string) error { |
| 18 | fmt.Printf("build %s [%s]...", typeName, name) |
| 19 | prefix, ok := constants.TestlibBinaryPrefixs[typeName] |
| 20 | if !ok { |
| 21 | prefix = "" |
| 22 | } |
| 23 | genCodeFile := path.Join(configDir, source) |
| 24 | compileTarget := path.Join(binRoot, prefix+name) |
| 25 | _, err := os.Stat(genCodeFile) |
| 26 | if err != nil && os.IsNotExist(err) { |
| 27 | return errors.Errorf("cannot find %s's source code", typeName) |
| 28 | } |
| 29 | compiler := provider.NewGnucppCompileProvider() |
| 30 | ok, ceinfo := compiler.ManualCompile(genCodeFile, compileTarget, []string{libraryDir}) |
| 31 | if ok { |
| 32 | fmt.Println("Done.") |
| 33 | } else { |
| 34 | fmt.Printf("Error.\n\n%s", ceinfo) |
| 35 | } |
| 36 | return nil |
| 37 | } |
| 38 | |
| 39 | // 编译作业代码 |
| 40 | func compileWorkCodeFiles(config structs.JudgeConfiguration, libraryDir string) error { |
no test coverage detected