MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / runCompiler

Method runCompiler

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

Source from the content-addressed store, hash-verified

106 }
107
108 override async runCompiler(
109 compiler: string,
110 options: string[],
111 inputFilename: string,
112 execOptions: ExecutionOptionsWithEnv,
113 filters?: ParseFiltersAndOutputOptions,
114 ): Promise<CompilationResult> {
115 if (!execOptions) {
116 execOptions = this.getDefaultExecOptions();
117 }
118 if (!execOptions.customCwd) {
119 execOptions.customCwd = path.dirname(inputFilename);
120 }
121 const tmpDir = path.dirname(inputFilename);
122 execOptions.env.CLJ_CACHE = tmpDir;
123
124 // The items in 'options' before the source file are user inputs.
125 const sourceFileOptionIndex = options.findIndex(option => {
126 return option.endsWith('.clj');
127 });
128 const userOptions = options.slice(0, sourceFileOptionIndex);
129 const classpathArgument = await this.getClojureClasspathArgument(execOptions.customCwd, compiler, execOptions);
130 const wrapperInvokeArgument = ['-M', this.compilerWrapperPath];
131 const clojureOptions = _.compact([
132 '-Sdeps',
133 this.defaultDeps,
134 ...classpathArgument,
135 ...wrapperInvokeArgument,
136 ...userOptions,
137 inputFilename,
138 ]);
139 const result = await this.exec(compiler, clojureOptions, execOptions);
140 return {
141 ...this.transformToCompilationResult(result, inputFilename),
142 languageId: this.getCompilerResultLanguageId(filters),
143 instructionSet: this.getInstructionSetFromCompilerArgs(options),
144 };
145 }
146
147 override async generateClojureMacroExpansion(inputFilename: string, options: string[]): Promise<ResultLine[]> {
148 // The items in 'options' before the source file are user inputs.

Callers 1

Tested by

no test coverage detected