diff options
Diffstat (limited to 'lib/compilers')
-rw-r--r-- | lib/compilers/beebasm.ts | 14 | ||||
-rw-r--r-- | lib/compilers/dotnet.ts | 20 | ||||
-rw-r--r-- | lib/compilers/pony.ts | 7 | ||||
-rw-r--r-- | lib/compilers/rga.ts | 7 | ||||
-rw-r--r-- | lib/compilers/rust.ts | 11 |
5 files changed, 29 insertions, 30 deletions
diff --git a/lib/compilers/beebasm.ts b/lib/compilers/beebasm.ts index de250db63..f750604cf 100644 --- a/lib/compilers/beebasm.ts +++ b/lib/compilers/beebasm.ts @@ -63,16 +63,16 @@ export class BeebAsmCompiler extends BaseCompiler { const hasBootOption = options.some(opt => opt.includes('-boot')); - const result = await this.exec(compiler, options, execOptions); - result.inputFilename = inputFilename; - const transformedInput = result.filenameTransform(inputFilename); + const compilerExecResult = await this.exec(compiler, options, execOptions); - if (result.stdout.length > 0) { + if (compilerExecResult.stdout.length > 0) { const outputFilename = this.getOutputFilename(dirPath, this.outputFilebase); - fs.writeFileSync(outputFilename, result.stdout); - result.stdout = ''; + fs.writeFileSync(outputFilename, compilerExecResult.stdout); + compilerExecResult.stdout = ''; } + const result = this.transformToCompilationResult(compilerExecResult, inputFilename); + if (result.code === 0 && options.includes('-v')) { const diskfile = path.join(dirPath, 'disk.ssd'); if (await utils.fileExists(diskfile)) { @@ -89,8 +89,6 @@ export class BeebAsmCompiler extends BaseCompiler { } } - this.parseCompilationOutput(result, transformedInput); - const hasNoSaveError = result.stderr.some(opt => opt.text.includes('warning: no SAVE command in source file')); if (hasNoSaveError) { if (!result.hints) result.hints = []; diff --git a/lib/compilers/dotnet.ts b/lib/compilers/dotnet.ts index 28263bf42..264bad61e 100644 --- a/lib/compilers/dotnet.ts +++ b/lib/compilers/dotnet.ts @@ -26,6 +26,7 @@ import path from 'path'; import fs from 'fs-extra'; +import {CompilationResult, ExecutionOptions} from '../../types/compilation/compilation.interfaces'; import {BaseCompiler} from '../base-compiler'; import {DotNetAsmParser} from '../parsers/asm-parser-dotnet'; @@ -82,13 +83,18 @@ class DotNetCompiler extends BaseCompiler { ]; } - override async runCompiler(compiler, options, inputFileName, execOptions) { + override async runCompiler( + compiler: string, + options: string[], + inputFilename: string, + execOptions: ExecutionOptions, + ): Promise<CompilationResult> { if (!execOptions) { execOptions = this.getDefaultExecOptions(); } - const programDir = path.dirname(inputFileName); - const sourceFile = path.basename(inputFileName); + const programDir = path.dirname(inputFilename); + const sourceFile = path.basename(inputFilename); const projectFilePath = path.join(programDir, `CompilerExplorer${this.lang.extensions[0]}proj`); const crossgen2Path = path.join(this.clrBuildDir, 'crossgen2', 'crossgen2.dll'); @@ -149,7 +155,7 @@ class DotNetCompiler extends BaseCompiler { crossgen2Options.push(options[switchIndex]); } - const compilerResult = await super.runCompiler(compiler, this.compilerOptions, inputFileName, execOptions); + const compilerResult = await super.runCompiler(compiler, this.compilerOptions, inputFilename, execOptions); if (compilerResult.code !== 0) { return compilerResult; @@ -194,10 +200,8 @@ class DotNetCompiler extends BaseCompiler { '--compilebubblegenerics', ].concat(options); - const result = await this.exec(compiler, crossgen2Options, execOptions); - result.inputFilename = dllPath; - const transformedInput = result.filenameTransform(dllPath); - this.parseCompilationOutput(result, transformedInput); + const compilerExecResult = await this.exec(compiler, crossgen2Options, execOptions); + const result = this.transformToCompilationResult(compilerExecResult, dllPath); await fs.writeFile( outputPath, diff --git a/lib/compilers/pony.ts b/lib/compilers/pony.ts index 7909064ee..004f41cc7 100644 --- a/lib/compilers/pony.ts +++ b/lib/compilers/pony.ts @@ -94,10 +94,7 @@ export class PonyCompiler extends BaseCompiler { // So we must set the input to the directory rather than a file. options = _.map(options, arg => (arg.includes(inputFilename) ? path.dirname(arg) : arg)); - const result = await this.exec(compiler, options, execOptions); - result.inputFilename = inputFilename; - const transformedInput = result.filenameTransform(inputFilename); - this.parseCompilationOutput(result, transformedInput); - return result; + const compilerExecResult = await this.exec(compiler, options, execOptions); + return this.transformToCompilationResult(compilerExecResult, inputFilename); } } diff --git a/lib/compilers/rga.ts b/lib/compilers/rga.ts index aec9d2084..36ffcc206 100644 --- a/lib/compilers/rga.ts +++ b/lib/compilers/rga.ts @@ -116,10 +116,7 @@ Please supply an ASIC from the following options:`, } const result = await this.execDXCandRGA(compiler, options, execOptions); - result.inputFilename = inputFilename; - const transformedInput = result.filenameTransform(inputFilename); - this.parseCompilationOutput(result, transformedInput); - return result; + return this.transformToCompilationResult(result, inputFilename); } async execDXCandRGA(filepath: string, args: string[], execOptions: ExecutionOptions): Promise<any> { @@ -182,7 +179,7 @@ Please supply an ASIC from the following options:`, '-s', 'vk-spv-txt-offline', '-c', - asicSelection.asic, + asicSelection.asic || '', '--isa', outputFile, '--livereg', diff --git a/lib/compilers/rust.ts b/lib/compilers/rust.ts index f1d0d3a89..a9fc71d5a 100644 --- a/lib/compilers/rust.ts +++ b/lib/compilers/rust.ts @@ -26,9 +26,9 @@ import path from 'path'; import _ from 'underscore'; +import {BasicExecutionResult, UnprocessedExecResult} from '../../types/execution/execution.interfaces'; import {BaseCompiler} from '../base-compiler'; import {BuildEnvDownloadInfo} from '../buildenvsetup/buildenv.interfaces'; -import {logger} from '../logger'; import {parseRustOutput} from '../utils'; import {RustParser} from './argument-parsers'; @@ -160,8 +160,11 @@ export class RustCompiler extends BaseCompiler { return true; } - override parseCompilationOutput(result, inputFilename) { - result.stdout = parseRustOutput(result.stdout, inputFilename); - result.stderr = parseRustOutput(result.stderr, inputFilename); + override processExecutionResult(input: UnprocessedExecResult, inputFilename?: string): BasicExecutionResult { + return { + ...input, + stdout: parseRustOutput(input.stdout, inputFilename), + stderr: parseRustOutput(input.stderr, inputFilename), + }; } } |