Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitee8a8c4

Browse files
committed
config-utils: populate getOverlayDatabaseMode()
This commit populates getOverlayDatabaseMode() in config-utils with thesame code from getOverlayDatabaseMode() in init.
1 parent9022c73 commitee8a8c4

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

‎src/config-utils.ts

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,21 @@ import { CachingKind, getCachingKind } from "./caching-utils";
1010
import{CodeQL}from"./codeql";
1111
import{shouldPerformDiffInformedAnalysis}from"./diff-informed-analysis-utils";
1212
import{Feature,FeatureEnablement}from"./feature-flags";
13+
import{getGitRoot}from"./git-utils";
1314
import{Language,parseLanguage}from"./languages";
1415
import{Logger}from"./logging";
15-
import{OverlayDatabaseMode}from"./overlay-database-utils";
16+
import{
17+
CODEQL_OVERLAY_MINIMUM_VERSION,
18+
OverlayDatabaseMode,
19+
}from"./overlay-database-utils";
1620
import{RepositoryNwo}from"./repository";
1721
import{downloadTrapCaches}from"./trap-caching";
1822
import{
1923
GitHubVersion,
2024
prettyPrintPack,
2125
ConfigurationError,
2226
BuildMode,
27+
codeQlVersionAtLeast,
2328
}from"./util";
2429

2530
// Property names from the user-supplied config file.
@@ -744,6 +749,38 @@ async function getOverlayDatabaseMode(
744749
buildMode:BuildMode|undefined,
745750
logger:Logger,
746751
):Promise<OverlayDatabaseMode>{
752+
constoverlayDatabaseMode=process.env.CODEQL_OVERLAY_DATABASE_MODE;
753+
754+
if(
755+
overlayDatabaseMode===OverlayDatabaseMode.Overlay||
756+
overlayDatabaseMode===OverlayDatabaseMode.OverlayBase
757+
){
758+
if(buildMode!==BuildMode.None){
759+
logger.warning(
760+
`Cannot build an${overlayDatabaseMode} database because `+
761+
`build-mode is set to "${buildMode}" instead of "none". `+
762+
"Falling back to creating a normal full database instead.",
763+
);
764+
returnOverlayDatabaseMode.None;
765+
}
766+
if(!(awaitcodeQlVersionAtLeast(codeql,CODEQL_OVERLAY_MINIMUM_VERSION))){
767+
logger.warning(
768+
`Cannot build an${overlayDatabaseMode} database because `+
769+
`the CodeQL CLI is older than${CODEQL_OVERLAY_MINIMUM_VERSION}. `+
770+
"Falling back to creating a normal full database instead.",
771+
);
772+
returnOverlayDatabaseMode.None;
773+
}
774+
if((awaitgetGitRoot(sourceRoot))===undefined){
775+
logger.warning(
776+
`Cannot build an${overlayDatabaseMode} database because `+
777+
`the source root "${sourceRoot}" is not inside a git repository. `+
778+
"Falling back to creating a normal full database instead.",
779+
);
780+
returnOverlayDatabaseMode.None;
781+
}
782+
returnoverlayDatabaseModeasOverlayDatabaseMode;
783+
}
747784
returnOverlayDatabaseMode.None;
748785
}
749786

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp