@@ -16,7 +16,7 @@ import {
1616} from "./analyses" ;
1717import * as api from "./api-client" ;
1818import { CachingKind , getCachingKind } from "./caching-utils" ;
19- import { type CodeQL } from "./codeql" ;
19+ import { type BetterResolveLanguagesOutput , type CodeQL } from "./codeql" ;
2020import { shouldPerformDiffInformedAnalysis } from "./diff-informed-analysis-utils" ;
2121import { Feature , FeatureEnablement } from "./feature-flags" ;
2222import { getGitRoot , isAnalyzingDefaultBranch } from "./git-utils" ;
@@ -27,6 +27,7 @@ import {
2727 OverlayDatabaseMode ,
2828} from "./overlay-database-utils" ;
2929import { RepositoryNwo } from "./repository" ;
30+ import * as resolvedLanguages from "./resolved-languages.json" ;
3031import { downloadTrapCaches } from "./trap-caching" ;
3132import {
3233 GitHubVersion ,
@@ -331,6 +332,30 @@ export async function getSupportedLanguageMap(
331332 `The CodeQL CLI supports the following languages: ${ Object . keys ( resolveResult . extractors ) . join ( ", " ) } ` ,
332333 ) ;
333334 }
335+ return buildSupportedLanguageMap (
336+ resolveResult ,
337+ resolveSupportedLanguagesUsingCli ,
338+ ) ;
339+ }
340+
341+ // This function serves the same purpose as getSupportedLanguageMap(), but it
342+ // uses the stored resolved-languages.json file instead of calling out to the
343+ // CodeQL CLI.
344+ export function getStoredSupportedLanguageMap ( ) : Record < string , string > {
345+ return buildSupportedLanguageMap (
346+ resolvedLanguages ,
347+ // resolveSupportedLanguagesUsingCli is false because we currently generate
348+ // resolved-languages.json without the --filter-to-languages-with-queries
349+ // flag (see .github/workflows/validate-resolved-languages.yml). Once that
350+ // changes, we should set this to true.
351+ false ,
352+ ) ;
353+ }
354+
355+ function buildSupportedLanguageMap (
356+ resolveResult : BetterResolveLanguagesOutput ,
357+ resolveSupportedLanguagesUsingCli : boolean ,
358+ ) : Record < string , string > {
334359 const supportedLanguages : Record < string , string > = { } ;
335360 // Populate canonical language names
336361 for ( const extractor of Object . keys ( resolveResult . extractors ) ) {
0 commit comments