diff options
-rw-r--r-- | lib/base-compiler.ts | 35 | ||||
-rw-r--r-- | types/compilation/compilation.interfaces.ts | 27 |
2 files changed, 47 insertions, 15 deletions
diff --git a/lib/base-compiler.ts b/lib/base-compiler.ts index 4631aa292..46a9465cd 100644 --- a/lib/base-compiler.ts +++ b/lib/base-compiler.ts @@ -31,7 +31,10 @@ import _ from 'underscore'; import { BuildResult, + CompilationCacheKey, + CompilationInfo, CompilationResult, + CustomInputForTool, ExecutionOptions, ToolResult, } from '../types/compilation/compilation.interfaces'; @@ -294,7 +297,7 @@ export class BaseCompiler { return exec.execute(filepath, args, execOptions); } - protected getCompilerCacheKey(compiler, args, options) { + protected getCompilerCacheKey(compiler, args, options): CompilationCacheKey { return {mtime: this.mtime, compiler, args, options}; } @@ -1599,20 +1602,22 @@ export class BaseCompiler { return cacheKey; } - getCompilationInfo(key, result, customBuildPath?) { - const compilationinfo = Object.assign({}, key, result); - compilationinfo.outputFilename = this.getOutputFilename( - customBuildPath || result.dirPath, - this.outputFilebase, - key, - ); - compilationinfo.executableFilename = this.getExecutableFilename( - customBuildPath || result.dirPath, - this.outputFilebase, - key, - ); - compilationinfo.asmParser = this.asm; - return compilationinfo; + getCompilationInfo( + key: CompilationCacheKey, + result: CompilationResult | CustomInputForTool, + customBuildPath?: string, + ): CompilationInfo { + return { + outputFilename: this.getOutputFilename(customBuildPath || result.dirPath || '', this.outputFilebase, key), + executableFilename: this.getExecutableFilename( + customBuildPath || result.dirPath || '', + this.outputFilebase, + key, + ), + asmParser: this.asm, + ...key, + ...result, + }; } tryAutodetectLibraries(libsAndOptions) { diff --git a/types/compilation/compilation.interfaces.ts b/types/compilation/compilation.interfaces.ts index 6d686ace5..1a4f77d94 100644 --- a/types/compilation/compilation.interfaces.ts +++ b/types/compilation/compilation.interfaces.ts @@ -23,6 +23,8 @@ // POSSIBILITY OF SUCH DAMAGE. import {BuildEnvDownloadInfo} from '../../lib/buildenvsetup/buildenv.interfaces'; +import {IAsmParser} from '../../lib/parsers/asm-parser.interfaces'; + import {LanguageKey} from '../languages.interfaces'; import {ResultLine} from '../resultline/resultline.interfaces'; @@ -122,3 +124,28 @@ export type ToolResult = { stdout: ResultLine[]; artifact?: Artifact; }; + +export type CompilationInfo = { + mtime: Date | null; + compiler: any; + args: string[]; + options: ExecutionOptions; + outputFilename: string; + executableFilename: string; + asmParser: IAsmParser; + inputFilename?: string; + dirPath?: string; +}; + +export type CompilationCacheKey = { + mtime: any; + compiler: any; + args: string[]; + options: ExecutionOptions; +}; + +export type CustomInputForTool = { + inputFilename: string; + dirPath: string; + outputFilename: string; +}; |