Support rust analysis

This is supposed to enable rust analysis for the staff ship only.
This commit is contained in:
Paolo Tranquilli 2025-02-19 15:56:52 +01:00
parent d99c7e8e5b
commit a7b17782a9
16 changed files with 186 additions and 13 deletions

6
lib/feature-flags.js generated
View file

@ -68,6 +68,7 @@ var Feature;
Feature["ExtractToToolcache"] = "extract_to_toolcache";
Feature["PythonDefaultIsToNotExtractStdlib"] = "python_default_is_to_not_extract_stdlib";
Feature["QaTelemetryEnabled"] = "qa_telemetry_enabled";
Feature["RustAnalysis"] = "rust_analysis";
Feature["ZstdBundleStreamingExtraction"] = "zstd_bundle_streaming_extraction";
})(Feature || (exports.Feature = Feature = {}));
exports.featureConfig = {
@ -132,6 +133,11 @@ exports.featureConfig = {
minimumVersion: undefined,
toolsFeature: tools_features_1.ToolsFeature.PythonDefaultIsToNotExtractStdlib,
},
[Feature.RustAnalysis]: {
defaultValue: false,
envVar: "CODEQL_ACTION_RUST_ANALYSIS",
minimumVersion: "2.19.3",
},
[Feature.QaTelemetryEnabled]: {
defaultValue: false,
envVar: "CODEQL_ACTION_QA_TELEMETRY",

File diff suppressed because one or more lines are too long

23
lib/init-action.js generated
View file

@ -345,6 +345,29 @@ async function run() {
logger.info(`Setting C++ build-mode: none to ${value}`);
core.exportVariable(bmnVar, value);
}
// Set CODEQL_ENABLE_EXPERIMENTAL_FEATURES for rust
if (config.languages.includes(languages_1.Language.rust)) {
const feat = feature_flags_1.Feature.RustAnalysis;
const minVer = feature_flags_1.featureConfig[feat].minimumVersion;
if (!(await (0, util_1.codeQlVersionAtLeast)(codeql, minVer))) {
logger.error(`Experimental rust analysis requires CodeQL version ${minVer} or higher`);
}
else {
const envVar = feature_flags_1.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 ((0, caching_utils_1.shouldRestoreCache)(config.dependencyCachingEnabled)) {
await (0, dependency_caching_1.downloadDependencyCaches)(config.languages, logger);

File diff suppressed because one or more lines are too long