Add the feature to bypass the toolcache for kotlin and swift

This works by moving the logic to check for toolcache bypass out of
creating the codeql instance. The logic now _may_ perform an API request
in order to check what languages are in the repository. This check is
redundant because the same call is being made later in the action when
the actual list of languages is calculated.
This commit is contained in:
Andrew Eisenberg 2022-11-23 14:53:40 -08:00
parent 5b7c9daecd
commit f79028af27
27 changed files with 471 additions and 78 deletions

9
lib/languages.js generated
View file

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isScannedLanguage = exports.isTracedLanguage = exports.parseLanguage = exports.Language = void 0;
exports.isScannedLanguage = exports.isTracedLanguage = exports.parseLanguage = exports.KOTLIN_SWIFT_BYPASS = exports.LANGUAGE_ALIASES = exports.Language = void 0;
// All the languages supported by CodeQL
var Language;
(function (Language) {
@ -14,13 +14,14 @@ var Language;
Language["swift"] = "swift";
})(Language = exports.Language || (exports.Language = {}));
// Additional names for languages
const LANGUAGE_ALIASES = {
exports.LANGUAGE_ALIASES = {
c: Language.cpp,
"c++": Language.cpp,
"c#": Language.csharp,
kotlin: Language.java,
typescript: Language.javascript,
};
exports.KOTLIN_SWIFT_BYPASS = ["kotlin", "swift"];
// Translate from user input or GitHub's API names for languages to CodeQL's names for languages
function parseLanguage(language) {
// Normalise to lower case
@ -30,8 +31,8 @@ function parseLanguage(language) {
return language;
}
// Check language aliases
if (language in LANGUAGE_ALIASES) {
return LANGUAGE_ALIASES[language];
if (language in exports.LANGUAGE_ALIASES) {
return language;
}
return undefined;
}