Support rust analysis
This is supposed to enable rust analysis for the staff ship only.
This commit is contained in:
parent
d99c7e8e5b
commit
a7b17782a9
16 changed files with 186 additions and 13 deletions
|
|
@ -53,6 +53,7 @@ export enum Feature {
|
|||
ExtractToToolcache = "extract_to_toolcache",
|
||||
PythonDefaultIsToNotExtractStdlib = "python_default_is_to_not_extract_stdlib",
|
||||
QaTelemetryEnabled = "qa_telemetry_enabled",
|
||||
RustAnalysis = "rust_analysis",
|
||||
ZstdBundleStreamingExtraction = "zstd_bundle_streaming_extraction",
|
||||
}
|
||||
|
||||
|
|
@ -148,6 +149,11 @@ export const featureConfig: Record<
|
|||
minimumVersion: undefined,
|
||||
toolsFeature: ToolsFeature.PythonDefaultIsToNotExtractStdlib,
|
||||
},
|
||||
[Feature.RustAnalysis]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_RUST_ANALYSIS",
|
||||
minimumVersion: "2.19.3",
|
||||
},
|
||||
[Feature.QaTelemetryEnabled]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_QA_TELEMETRY",
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import {
|
|||
makeDiagnostic,
|
||||
} from "./diagnostics";
|
||||
import { EnvVar } from "./environment";
|
||||
import { Feature, Features } from "./feature-flags";
|
||||
import { Feature, featureConfig, Features } from "./feature-flags";
|
||||
import {
|
||||
checkInstallPython311,
|
||||
cleanupDatabaseClusterDirectory,
|
||||
|
|
@ -576,6 +576,34 @@ async function run() {
|
|||
core.exportVariable(bmnVar, value);
|
||||
}
|
||||
|
||||
// Set CODEQL_ENABLE_EXPERIMENTAL_FEATURES for rust
|
||||
if (config.languages.includes(Language.rust)) {
|
||||
const feat = Feature.RustAnalysis;
|
||||
const minVer = featureConfig[feat].minimumVersion as string;
|
||||
if (!(await codeQlVersionAtLeast(codeql, minVer))) {
|
||||
logger.error(
|
||||
`Experimental rust analysis requires CodeQL version ${minVer} or higher`,
|
||||
);
|
||||
} else {
|
||||
const envVar = featureConfig[feat].envVar;
|
||||
const expVar = "CODEQL_ENABLE_EXPERIMENTAL_FEATURES";
|
||||
if (
|
||||
process.env[envVar] === "true" ||
|
||||
(await features.getValue(feat, codeql))
|
||||
) {
|
||||
core.exportVariable(expVar, "true");
|
||||
}
|
||||
if (process.env[expVar] === "true") {
|
||||
logger.info("Experimental rust analysis enabled");
|
||||
} else {
|
||||
logger.error(
|
||||
"Experimental rust analysis requested but not enabled. " +
|
||||
"You must set the CODEQL_ENABLE_EXPERIMENTAL_FEATURES environment variable to true",
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Restore dependency cache(s), if they exist.
|
||||
if (shouldRestoreCache(config.dependencyCachingEnabled)) {
|
||||
await downloadDependencyCaches(config.languages, logger);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue