Defer language aliasing to CLI when appropriate
This commit is contained in:
parent
0ac7669167
commit
e26ed57a22
8 changed files with 45 additions and 29 deletions
17
lib/resolve-environment.js
generated
17
lib/resolve-environment.js
generated
|
|
@ -25,10 +25,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.runResolveBuildEnvironment = void 0;
|
||||
const codeql_1 = require("./codeql");
|
||||
const languages_1 = require("./languages");
|
||||
const util = __importStar(require("./util"));
|
||||
async function runResolveBuildEnvironment(cmd, logger, workingDir, language) {
|
||||
logger.startGroup(`Attempting to resolve build environment for ${language}`);
|
||||
async function runResolveBuildEnvironment(cmd, logger, workingDir, languageInput) {
|
||||
logger.startGroup(`Attempting to resolve build environment for ${languageInput}`);
|
||||
const codeql = await (0, codeql_1.getCodeQL)(cmd);
|
||||
let language = languageInput;
|
||||
if (await util.codeQlVersionAbove(codeql, codeql_1.CODEQL_VERSION_LANGUAGE_ALIASING)) {
|
||||
// Delegate to the CodeQL CLI to handle aliasing.
|
||||
}
|
||||
else {
|
||||
// Handle aliasing in the Action using `parseLanguage`.
|
||||
const parsedLanguage = (0, languages_1.parseLanguage)(languageInput)?.toString();
|
||||
if (parsedLanguage === undefined) {
|
||||
throw new Error(`Did not recognize the language '${languageInput}'.`);
|
||||
}
|
||||
language = parsedLanguage;
|
||||
}
|
||||
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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue