diff options
author | Patrick Quist <partouf@gmail.com> | 2021-10-15 18:22:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-15 18:22:33 +0200 |
commit | 1ca884c3670f5a12d2918fc1849e25d4570136f7 (patch) | |
tree | 83e27effdd48eab51898b297b3185813e5a38dd8 /lib/base-compiler.js | |
parent | 60217a8e61269df7aab0220ed754f19846f6cd71 (diff) | |
download | compiler-explorer-1ca884c3670f5a12d2918fc1849e25d4570136f7.tar.gz compiler-explorer-1ca884c3670f5a12d2918fc1849e25d4570136f7.zip |
Seperate compiler finding process (#3022)gh-1168
Diffstat (limited to 'lib/base-compiler.js')
-rw-r--r-- | lib/base-compiler.js | 64 |
1 files changed, 38 insertions, 26 deletions
diff --git a/lib/base-compiler.js b/lib/base-compiler.js index 97ca4d3b0..777e81eb1 100644 --- a/lib/base-compiler.js +++ b/lib/base-compiler.js @@ -1782,33 +1782,36 @@ Please select another pass or change filters.`; clientOptions.libs[this.lang.id]); } - async initialise(mtime, clientOptions) { + async initialise(mtime, clientOptions, isPrediscovered = false) { this.mtime = mtime; if (this.getRemote()) return this; - const compiler = this.compiler.exe; - const versionRe = new RegExp(this.compiler.versionRe || '.*', 'i'); - const result = await this.getVersion(); - if (!result) return null; - if (result.code !== 0) { - logger.warn(`Compiler '${compiler}' - non-zero result ${result.code}`); - } - let version = ''; - let fullVersion = result.stdout + result.stderr; - _.each(utils.splitLines(fullVersion), line => { - if (version) return; - const match = line.match(versionRe); - if (match) version = match[0]; - }); - if (!version) { - logger.error(`Unable to find compiler version for '${compiler}' with re ${versionRe}:`, result); - return null; + + let compiler = this.compiler.exe; + let version = this.compiler.version || ''; + if (!isPrediscovered) { + const versionRe = new RegExp(this.compiler.versionRe || '.*', 'i'); + const result = await this.getVersion(); + if (!result) return null; + if (result.code !== 0) { + logger.warn(`Compiler '${compiler}' - non-zero result ${result.code}`); + } + let fullVersion = result.stdout + result.stderr; + _.each(utils.splitLines(fullVersion), line => { + if (version) return; + const match = line.match(versionRe); + if (match) version = match[0]; + }); + if (!version) { + logger.error(`Unable to find compiler version for '${compiler}' with re ${versionRe}:`, result); + return null; + } + logger.debug(`${compiler} is version '${version}'`); + this.compiler.version = version; + this.compiler.fullVersion = fullVersion; + this.compiler.supportsCfg = this.isCfgCompiler(version); + this.compiler.supportsAstView = this.couldSupportASTDump(version); } - logger.debug(`${compiler} is version '${version}'`); - this.compiler.version = version; - this.compiler.fullVersion = fullVersion; - this.compiler.supportsCfg = this.isCfgCompiler(version); - this.compiler.supportsAstView = this.couldSupportASTDump(version); try { this.cmakeBaseEnv = await this.getCmakeBaseEnv(); @@ -1818,9 +1821,18 @@ Please select another pass or change filters.`; this.initialiseLibraries(clientOptions); - const initResult = await this.getArgumentParser().parse(this); - logger.info(`${compiler} ${version} is ready`); - return initResult; + if (!isPrediscovered) { + const initResult = await this.getArgumentParser().parse(this); + logger.info(`${compiler} ${version} is ready`); + return initResult; + } else { + logger.info(`${compiler} ${version} is ready`); + if (this.compiler.cachedPossibleArguments) { + this.possibleArguments.populateOptions(this.compiler.cachedPossibleArguments); + delete this.compiler.cachedPossibleArguments; + } + return this; + } } getInfo() { |