mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-28 05:53:45 +00:00
Auto merge of #16380 - Veykril:sysroot-ci, r=Veykril
Run metadata on sysroot for CI metrics
This commit is contained in:
commit
2b02df27c5
3 changed files with 10 additions and 1 deletions
|
@ -63,6 +63,7 @@ impl flags::AnalysisStats {
|
||||||
true => None,
|
true => None,
|
||||||
false => Some(RustLibSource::Discover),
|
false => Some(RustLibSource::Discover),
|
||||||
};
|
};
|
||||||
|
cargo_config.sysroot_query_metadata = self.query_sysroot_metadata;
|
||||||
let no_progress = &|_| ();
|
let no_progress = &|_| ();
|
||||||
|
|
||||||
let mut db_load_sw = self.stop_watch();
|
let mut db_load_sw = self.stop_watch();
|
||||||
|
|
|
@ -71,6 +71,9 @@ xflags::xflags! {
|
||||||
optional --with-deps
|
optional --with-deps
|
||||||
/// Don't load sysroot crates (`std`, `core` & friends).
|
/// Don't load sysroot crates (`std`, `core` & friends).
|
||||||
optional --no-sysroot
|
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.
|
/// Don't run build scripts or load `OUT_DIR` values by running `cargo check` before analysis.
|
||||||
optional --disable-build-scripts
|
optional --disable-build-scripts
|
||||||
|
@ -206,6 +209,7 @@ pub struct AnalysisStats {
|
||||||
pub only: Option<String>,
|
pub only: Option<String>,
|
||||||
pub with_deps: bool,
|
pub with_deps: bool,
|
||||||
pub no_sysroot: bool,
|
pub no_sysroot: bool,
|
||||||
|
pub query_sysroot_metadata: bool,
|
||||||
pub disable_build_scripts: bool,
|
pub disable_build_scripts: bool,
|
||||||
pub disable_proc_macros: bool,
|
pub disable_proc_macros: bool,
|
||||||
pub skip_lowering: bool,
|
pub skip_lowering: bool,
|
||||||
|
|
|
@ -113,7 +113,11 @@ impl Metrics {
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
assert!(Path::new(path).exists(), "unable to find bench in {path}");
|
assert!(Path::new(path).exists(), "unable to find bench in {path}");
|
||||||
eprintln!("\nMeasuring analysis-stats/{name}");
|
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) {
|
for (metric, value, unit) in parse_metrics(&output) {
|
||||||
self.report(&format!("analysis-stats/{name}/{metric}"), value, unit.into());
|
self.report(&format!("analysis-stats/{name}/{metric}"), value, unit.into());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue