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

Method runCompiler

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

Source from the content-addressed store, hash-verified

91 }
92
93 override async runCompiler(
94 compiler: string,
95 options: string[],
96 inputFilename: string,
97 execOptions: ExecutionOptionsWithEnv,
98 filters?: ParseFiltersAndOutputOptions,
99 ): Promise<CompilationResult> {
100 const preliminaryCompilePath = path.dirname(inputFilename);
101 let outputFilename = '';
102 let initialResult: CompilationResult | null = null;
103
104 const javaCompiler = this.env.findCompiler('java', this.javaId) as JavaCompiler | undefined;
105 if (!javaCompiler) {
106 return {
107 ...this.handleUserError(
108 {message: `Compiler ${this.lang.id} ${this.javaId} not configured correctly`},
109 '',
110 ),
111 timedOut: false,
112 };
113 }
114
115 // Instantiate Java or Kotlin compiler based on the current language.
116 if (this.lang.id === 'android-java') {
117 outputFilename = javaCompiler.getOutputFilename(preliminaryCompilePath);
118 const javaOptions = _.compact(
119 javaCompiler.prepareArguments(
120 this.getClasspathArgument(),
121 javaCompiler.getDefaultFilters(),
122 {}, // backendOptions
123 inputFilename,
124 outputFilename,
125 [], // libraries
126 [], // overrides
127 ),
128 );
129 initialResult = await javaCompiler.runCompiler(
130 javaCompiler.getInfo().exe,
131 javaOptions,
132 this.filename(inputFilename),
133 javaCompiler.getDefaultExecOptions(),
134 );
135 } else if (this.lang.id === 'android-kotlin') {
136 const kotlinCompiler = unwrap(this.env.findCompiler('kotlin', this.kotlinId)) as KotlinCompiler;
137 outputFilename = kotlinCompiler.getOutputFilename(preliminaryCompilePath);
138 const kotlinOptions = _.compact(
139 kotlinCompiler.prepareArguments(
140 this.getClasspathArgument(),
141 kotlinCompiler.getDefaultFilters(),
142 {}, // backendOptions
143 inputFilename,
144 outputFilename,
145 [], // libraries
146 [], // overrides
147 ),
148 );
149 initialResult = await kotlinCompiler.runCompiler(
150 kotlinCompiler.getInfo().exe,

Callers

nothing calls this directly

Calls 15

getClasspathArgumentMethod · 0.95
getMinApiArgumentMethod · 0.95
handleUserErrorMethod · 0.80
errorMethod · 0.80
testMethod · 0.80
pushMethod · 0.80
getOutputFilenameMethod · 0.65
unwrapFunction · 0.50
findCompilerMethod · 0.45
prepareArgumentsMethod · 0.45
getDefaultFiltersMethod · 0.45

Tested by

no test coverage detected