MCPcopy Create free account
hub / github.com/LanceLRQ/deer-executor / GetCompiler

Method GetCompiler

executor/compile.go:49–67  ·  view source on GitHub ↗

GetCompiler get a compiler provider from session.CodeLangName 如果不设置codeStr,默认会读取配置文件里的code_file字段并打开对应文件

(codeStr string)

Source from the content-addressed store, hash-verified

47// GetCompiler get a compiler provider from session.CodeLangName
48// 如果不设置codeStr,默认会读取配置文件里的code_file字段并打开对应文件
49func (session *JudgeSession) GetCompiler(codeStr string) (provider.CodeCompileProviderInterface, error) {
50 if codeStr == "" {
51 codeFileBytes, err := ioutil.ReadFile(session.CodeFile)
52 if err != nil {
53 return nil, err
54 }
55 codeStr = string(codeFileBytes)
56 }
57
58 compiler, err := matchCodeLanguage(session.CodeLangName, session.CodeFile)
59 if err != nil {
60 return nil, err
61 }
62 err = compiler.Init(codeStr, session.SessionDir)
63 if err != nil {
64 return nil, err
65 }
66 return compiler, err
67}
68
69// 编译目标程序
70func (session *JudgeSession) compileTargetProgram(judgeResult *commonStructs.JudgeResult) error {

Callers 2

compileTargetProgramMethod · 0.95
initWorkFunction · 0.80

Calls 2

matchCodeLanguageFunction · 0.85
InitMethod · 0.65

Tested by

no test coverage detected