MCPcopy
hub / github.com/compiler-explorer/compiler-explorer / runCompiler

Method runCompiler

lib/compilers/java.ts:77–104  ·  view source on GitHub ↗
(
        compiler: string,
        options: string[],
        inputFilename: string,
        execOptions: ExecutionOptionsWithEnv,
        filters?: ParseFiltersAndOutputOptions,
    )

Source from the content-addressed store, hash-verified

75 }
76
77 override async runCompiler(
78 compiler: string,
79 options: string[],
80 inputFilename: string,
81 execOptions: ExecutionOptionsWithEnv,
82 filters?: ParseFiltersAndOutputOptions,
83 ): Promise<CompilationResult> {
84 if (!execOptions) {
85 execOptions = this.getDefaultExecOptions();
86 }
87
88 if (!execOptions.customCwd) {
89 execOptions.customCwd = path.dirname(inputFilename);
90 }
91
92 // The items in 'options' before the source file are user inputs.
93 const sourceFileOptionIndex = options.findIndex(option => {
94 return option.endsWith('.java');
95 });
96 const userOptions = options.slice(0, sourceFileOptionIndex);
97 const javaOptions = _.compact([...this.getClasspathArgument(), ...userOptions, inputFilename]);
98 const result = await this.exec(compiler, javaOptions, execOptions);
99 return {
100 ...this.transformToCompilationResult(result, inputFilename),
101 languageId: this.getCompilerResultLanguageId(filters),
102 instructionSet: this.getInstructionSetFromCompilerArgs(options),
103 };
104 }
105
106 async readdir(dirPath: string): Promise<string[]> {
107 // Separate method allows override to find classfiles

Callers

nothing calls this directly

Calls 6

getClasspathArgumentMethod · 0.95
getDefaultExecOptionsMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected