Don't invoke CLI when command not supported
This commit is contained in:
parent
899b5a286f
commit
7a9f099940
6 changed files with 72 additions and 12 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { getCodeQL } from "./codeql";
|
||||
import { CODEQL_VERSION_RESOLVE_ENVIRONMENT, getCodeQL } from "./codeql";
|
||||
import { Language } from "./languages";
|
||||
import { Logger } from "./logging";
|
||||
import * as util from "./util";
|
||||
|
||||
export async function runResolveBuildEnvironment(
|
||||
cmd: string,
|
||||
|
|
@ -10,12 +11,29 @@ export async function runResolveBuildEnvironment(
|
|||
) {
|
||||
logger.startGroup(`Attempting to resolve build environment for ${language}`);
|
||||
|
||||
if (workingDir !== undefined) {
|
||||
logger.info(`Using ${workingDir} as the working directory.`);
|
||||
const codeql = await getCodeQL(cmd);
|
||||
let result = {};
|
||||
|
||||
// If the CodeQL version in use does not support the `resolve build-environment`
|
||||
// command, just return an empty configuration. Otherwise invoke the CLI.
|
||||
if (
|
||||
!(await util.codeQlVersionAbove(
|
||||
codeql,
|
||||
CODEQL_VERSION_RESOLVE_ENVIRONMENT
|
||||
))
|
||||
) {
|
||||
logger.warning(
|
||||
"Unsupported CodeQL CLI version for `resolve build-environment` command, " +
|
||||
"returning an empty configuration."
|
||||
);
|
||||
} else {
|
||||
if (workingDir !== undefined) {
|
||||
logger.info(`Using ${workingDir} as the working directory.`);
|
||||
}
|
||||
|
||||
result = await codeql.resolveBuildEnvironment(workingDir, language);
|
||||
}
|
||||
|
||||
const codeql = await getCodeQL(cmd);
|
||||
const result = await codeql.resolveBuildEnvironment(workingDir, language);
|
||||
logger.endGroup();
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue