@@ -477,7 +477,6 @@ export async function getDefaultConfig({
477477 repository,
478478 tempDir,
479479 codeql,
480- sourceRoot,
481480 githubVersion,
482481 features,
483482 logger,
@@ -498,14 +497,11 @@ export async function getDefaultConfig({
498497
499498 const augmentationProperties = await calculateAugmentation (
500499 codeql ,
501- repository ,
502500 features ,
503501 packsInput ,
504502 queriesInput ,
505503 qualityQueriesInput ,
506504 languages ,
507- sourceRoot ,
508- buildMode ,
509505 logger ,
510506 ) ;
511507
@@ -584,15 +580,12 @@ async function loadUserConfig(
584580 * the config file sent to the CLI.
585581 *
586582 * @param codeql The CodeQL object.
587- * @param repository The repository to analyze.
588583 * @param features The feature enablement object.
589584 * @param rawPacksInput The packs input from the action configuration.
590585 * @param rawQueriesInput The queries input from the action configuration.
591586 * @param languages The languages that the config file is for. If the packs input
592587 * is non-empty, then there must be exactly one language. Otherwise, an
593588 * error is thrown.
594- * @param sourceRoot The source root of the repository.
595- * @param buildMode The build mode to use.
596589 * @param logger The logger to use for logging.
597590 *
598591 * @returns The properties that need to be augmented in the config file.
@@ -603,14 +596,11 @@ async function loadUserConfig(
603596// exported for testing.
604597export async function calculateAugmentation (
605598 codeql : CodeQL ,
606- repository : RepositoryNwo ,
607599 features : FeatureEnablement ,
608600 rawPacksInput : string | undefined ,
609601 rawQueriesInput : string | undefined ,
610602 rawQualityQueriesInput : string | undefined ,
611603 languages : Language [ ] ,
612- sourceRoot : string ,
613- buildMode : BuildMode | undefined ,
614604 logger : Logger ,
615605) : Promise < AugmentationProperties > {
616606 const packsInputCombines = shouldCombine ( rawPacksInput ) ;
@@ -624,20 +614,6 @@ export async function calculateAugmentation(
624614 rawQueriesInput ,
625615 queriesInputCombines ,
626616 ) ;
627- const { overlayDatabaseMode, useOverlayDatabaseCaching } =
628- await getOverlayDatabaseMode (
629- codeql ,
630- repository ,
631- features ,
632- languages ,
633- sourceRoot ,
634- buildMode ,
635- logger ,
636- ) ;
637- logger . info (
638- `Using overlay database mode: ${ overlayDatabaseMode } ` +
639- `${ useOverlayDatabaseCaching ? "with" : "without" } caching.` ,
640- ) ;
641617
642618 const qualityQueriesInput = parseQueriesFromInput (
643619 rawQualityQueriesInput ,
@@ -658,8 +634,8 @@ export async function calculateAugmentation(
658634 queriesInputCombines,
659635 qualityQueriesInput,
660636 extraQueryExclusions,
661- overlayDatabaseMode,
662- useOverlayDatabaseCaching,
637+ overlayDatabaseMode : OverlayDatabaseMode . None ,
638+ useOverlayDatabaseCaching : false ,
663639 } ;
664640}
665641
@@ -999,8 +975,30 @@ export async function initConfig(inputs: InitConfigInputs): Promise<Config> {
999975 }
1000976
1001977 const config = await getDefaultConfig ( inputs ) ;
978+ const augmentationProperties = config . augmentationProperties ;
1002979 config . originalUserInput = userConfig ;
1003980
981+ // The choice of overlay database mode depends on the selection of languages
982+ // and queries, which in turn depends on the user config and the augmentation
983+ // properties. So we need to calculate the overlay database mode after the
984+ // rest of the config has been populated.
985+ const { overlayDatabaseMode, useOverlayDatabaseCaching } =
986+ await getOverlayDatabaseMode (
987+ inputs . codeql ,
988+ inputs . repository ,
989+ inputs . features ,
990+ config . languages ,
991+ inputs . sourceRoot ,
992+ config . buildMode ,
993+ logger ,
994+ ) ;
995+ logger . info (
996+ `Using overlay database mode: ${ overlayDatabaseMode } ` +
997+ `${ useOverlayDatabaseCaching ? "with" : "without" } caching.` ,
998+ ) ;
999+ augmentationProperties . overlayDatabaseMode = overlayDatabaseMode ;
1000+ augmentationProperties . useOverlayDatabaseCaching = useOverlayDatabaseCaching ;
1001+
10041002 // Save the config so we can easily access it again in the future
10051003 await saveConfig ( config , logger ) ;
10061004 return config ;
0 commit comments