Use --force-overwrite for creating databases
...but only if the feature exists in the CLI.
This commit is contained in:
parent
c7964947b4
commit
0a64ae0929
6 changed files with 12 additions and 4 deletions
3
lib/codeql.js
generated
3
lib/codeql.js
generated
|
|
@ -283,10 +283,11 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||
else if (await util.codeQlVersionAtLeast(this, exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE)) {
|
||||
extraArgs.push("--no-sublanguage-file-coverage");
|
||||
}
|
||||
const overwriteFlag = (0, tools_features_1.isSupportedToolsFeature)(await this.getVersion(), tools_features_1.ToolsFeature.ForceOverwite) ? "--force-overwrite" : "--overwrite";
|
||||
await runTool(cmd, [
|
||||
"database",
|
||||
"init",
|
||||
"--overwrite",
|
||||
overwriteFlag,
|
||||
"--db-cluster",
|
||||
config.dbLocation,
|
||||
`--source-root=${sourceRoot}`,
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
1
lib/tools-features.js
generated
1
lib/tools-features.js
generated
|
|
@ -10,6 +10,7 @@ var ToolsFeature;
|
|||
ToolsFeature["SetsCodeqlRunnerEnvVar"] = "setsCodeqlRunnerEnvVar";
|
||||
ToolsFeature["TraceCommandUseBuildMode"] = "traceCommandUseBuildMode";
|
||||
ToolsFeature["SarifMergeRunsFromEqualCategory"] = "sarifMergeRunsFromEqualCategory";
|
||||
ToolsFeature["ForceOverwite"] = "forceOverwite";
|
||||
})(ToolsFeature || (exports.ToolsFeature = ToolsFeature = {}));
|
||||
/**
|
||||
* Determines if the given feature is supported by the CLI.
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"tools-features.js","sourceRoot":"","sources":["../src/tools-features.ts"],"names":[],"mappings":";;;AAEA,IAAY,YAQX;AARD,WAAY,YAAY;IACtB,uEAAuD,CAAA;IACvD,mDAAmC,CAAA;IACnC,+FAA+E,CAAA;IAC/E,yFAAyE,CAAA;IACzE,iEAAiD,CAAA;IACjD,qEAAqD,CAAA;IACrD,mFAAmE,CAAA;AACrE,CAAC,EARW,YAAY,4BAAZ,YAAY,QAQvB;AAED;;;;;;GAMG;AACH,SAAgB,uBAAuB,CACrC,WAAwB,EACxB,OAAqB;IAErB,OAAO,CAAC,CAAC,WAAW,CAAC,QAAQ,IAAI,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACjE,CAAC;AALD,0DAKC"}
|
||||
{"version":3,"file":"tools-features.js","sourceRoot":"","sources":["../src/tools-features.ts"],"names":[],"mappings":";;;AAEA,IAAY,YASX;AATD,WAAY,YAAY;IACtB,uEAAuD,CAAA;IACvD,mDAAmC,CAAA;IACnC,+FAA+E,CAAA;IAC/E,yFAAyE,CAAA;IACzE,iEAAiD,CAAA;IACjD,qEAAqD,CAAA;IACrD,mFAAmE,CAAA;IACnE,+CAA+B,CAAA;AACjC,CAAC,EATW,YAAY,4BAAZ,YAAY,QASvB;AAED;;;;;;GAMG;AACH,SAAgB,uBAAuB,CACrC,WAAwB,EACxB,OAAqB;IAErB,OAAO,CAAC,CAAC,WAAW,CAAC,QAAQ,IAAI,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACjE,CAAC;AALD,0DAKC"}
|
||||
|
|
@ -612,12 +612,17 @@ export async function getCodeQLForCmd(
|
|||
extraArgs.push("--no-sublanguage-file-coverage");
|
||||
}
|
||||
|
||||
const overwriteFlag = isSupportedToolsFeature(
|
||||
await this.getVersion(),
|
||||
ToolsFeature.ForceOverwite,
|
||||
) ? "--force-overwrite" : "--overwrite";
|
||||
|
||||
await runTool(
|
||||
cmd,
|
||||
[
|
||||
"database",
|
||||
"init",
|
||||
"--overwrite",
|
||||
overwriteFlag,
|
||||
"--db-cluster",
|
||||
config.dbLocation,
|
||||
`--source-root=${sourceRoot}`,
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ export enum ToolsFeature {
|
|||
SetsCodeqlRunnerEnvVar = "setsCodeqlRunnerEnvVar",
|
||||
TraceCommandUseBuildMode = "traceCommandUseBuildMode",
|
||||
SarifMergeRunsFromEqualCategory = "sarifMergeRunsFromEqualCategory",
|
||||
ForceOverwite = "forceOverwite",
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue