Auto merge of #16380 - Veykril:sysroot-ci, r=Veykril

Run metadata on sysroot for CI metrics
This commit is contained in:
bors 2024-01-17 09:33:14 +00:00
commit 2b02df27c5
3 changed files with 10 additions and 1 deletions

View File

@ -63,6 +63,7 @@ pub fn run(self, verbosity: Verbosity) -> anyhow::Result<()> {
true => None,
false => Some(RustLibSource::Discover),
};
cargo_config.sysroot_query_metadata = self.query_sysroot_metadata;
let no_progress = &|_| ();
let mut db_load_sw = self.stop_watch();

View File

@ -71,6 +71,9 @@
optional --with-deps
/// Don't load sysroot crates (`std`, `core` & friends).
optional --no-sysroot
/// Run cargo metadata on the sysroot to analyze its third-pary dependencies.
/// Requires --no-sysroot to not be set.
optional --query-sysroot-metadata
/// Don't run build scripts or load `OUT_DIR` values by running `cargo check` before analysis.
optional --disable-build-scripts
@ -206,6 +209,7 @@ pub struct AnalysisStats {
pub only: Option<String>,
pub with_deps: bool,
pub no_sysroot: bool,
pub query_sysroot_metadata: bool,
pub disable_build_scripts: bool,
pub disable_proc_macros: bool,
pub skip_lowering: bool,

View File

@ -113,7 +113,11 @@ fn measure_analysis_stats_path(
) -> anyhow::Result<()> {
assert!(Path::new(path).exists(), "unable to find bench in {path}");
eprintln!("\nMeasuring analysis-stats/{name}");
let output = cmd!(sh, "./target/release/rust-analyzer -q analysis-stats {path}").read()?;
let output = cmd!(
sh,
"./target/release/rust-analyzer -q analysis-stats {path} --query-sysroot-metadata"
)
.read()?;
for (metric, value, unit) in parse_metrics(&output) {
self.report(&format!("analysis-stats/{name}/{metric}"), value, unit.into());
}