mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 13:33:31 +00:00
fix: Fix CI running analysis-stats incorrectly against the standard libraries
This commit is contained in:
parent
8dd53a3a46
commit
e5af3ae427
4 changed files with 13 additions and 8 deletions
4
.github/workflows/ci.yaml
vendored
4
.github/workflows/ci.yaml
vendored
|
@ -104,11 +104,11 @@ jobs:
|
||||||
if: matrix.os == 'ubuntu-latest'
|
if: matrix.os == 'ubuntu-latest'
|
||||||
run: target/${{ matrix.target }}/debug/rust-analyzer analysis-stats .
|
run: target/${{ matrix.target }}/debug/rust-analyzer analysis-stats .
|
||||||
|
|
||||||
- name: Run analysis-stats on rust std library
|
- name: Run analysis-stats on the rust standard libraries
|
||||||
if: matrix.os == 'ubuntu-latest'
|
if: matrix.os == 'ubuntu-latest'
|
||||||
env:
|
env:
|
||||||
RUSTC_BOOTSTRAP: 1
|
RUSTC_BOOTSTRAP: 1
|
||||||
run: target/${{ matrix.target }}/debug/rust-analyzer analysis-stats --with-deps $(rustc --print sysroot)/lib/rustlib/src/rust/library/std
|
run: target/${{ matrix.target }}/debug/rust-analyzer analysis-stats --with-deps --no-sysroot --no-test $(rustc --print sysroot)/lib/rustlib/src/rust/library/
|
||||||
|
|
||||||
- name: clippy
|
- name: clippy
|
||||||
if: matrix.os == 'windows-latest'
|
if: matrix.os == 'windows-latest'
|
||||||
|
|
|
@ -222,8 +222,6 @@ fn rust_project_is_proc_macro_has_proc_macro_dep() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
// FIXME Remove the ignore
|
|
||||||
#[ignore = "requires nightly until the sysroot ships a cargo workspace for library on stable"]
|
|
||||||
fn smoke_test_real_sysroot_cargo() {
|
fn smoke_test_real_sysroot_cargo() {
|
||||||
let file_map = &mut FxHashMap::<AbsPathBuf, FileId>::default();
|
let file_map = &mut FxHashMap::<AbsPathBuf, FileId>::default();
|
||||||
let meta: Metadata = get_test_json_file("hello-world-metadata.json");
|
let meta: Metadata = get_test_json_file("hello-world-metadata.json");
|
||||||
|
@ -235,7 +233,6 @@ fn smoke_test_real_sysroot_cargo() {
|
||||||
&Default::default(),
|
&Default::default(),
|
||||||
);
|
);
|
||||||
assert!(matches!(sysroot.mode(), SysrootMode::Workspace(_)));
|
assert!(matches!(sysroot.mode(), SysrootMode::Workspace(_)));
|
||||||
|
|
||||||
let project_workspace = ProjectWorkspace {
|
let project_workspace = ProjectWorkspace {
|
||||||
kind: ProjectWorkspaceKind::Cargo {
|
kind: ProjectWorkspaceKind::Cargo {
|
||||||
cargo: cargo_workspace,
|
cargo: cargo_workspace,
|
||||||
|
|
|
@ -6,6 +6,7 @@ use std::{
|
||||||
time::{SystemTime, UNIX_EPOCH},
|
time::{SystemTime, UNIX_EPOCH},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use cfg::{CfgAtom, CfgDiff};
|
||||||
use hir::{
|
use hir::{
|
||||||
db::{DefDatabase, ExpandDatabase, HirDatabase},
|
db::{DefDatabase, ExpandDatabase, HirDatabase},
|
||||||
Adt, AssocItem, Crate, DefWithBody, HasSource, HirDisplay, HirFileIdExt, ImportPathConfig,
|
Adt, AssocItem, Crate, DefWithBody, HasSource, HirDisplay, HirFileIdExt, ImportPathConfig,
|
||||||
|
@ -31,7 +32,7 @@ use itertools::Itertools;
|
||||||
use load_cargo::{load_workspace, LoadCargoConfig, ProcMacroServerChoice};
|
use load_cargo::{load_workspace, LoadCargoConfig, ProcMacroServerChoice};
|
||||||
use oorandom::Rand32;
|
use oorandom::Rand32;
|
||||||
use profile::{Bytes, StopWatch};
|
use profile::{Bytes, StopWatch};
|
||||||
use project_model::{CargoConfig, ProjectManifest, ProjectWorkspace, RustLibSource};
|
use project_model::{CargoConfig, CfgOverrides, ProjectManifest, ProjectWorkspace, RustLibSource};
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
use rustc_hash::{FxHashMap, FxHashSet};
|
use rustc_hash::{FxHashMap, FxHashSet};
|
||||||
use syntax::{AstNode, SyntaxNode};
|
use syntax::{AstNode, SyntaxNode};
|
||||||
|
@ -65,7 +66,11 @@ impl flags::AnalysisStats {
|
||||||
false => Some(RustLibSource::Discover),
|
false => Some(RustLibSource::Discover),
|
||||||
},
|
},
|
||||||
all_targets: true,
|
all_targets: true,
|
||||||
set_test: true,
|
set_test: !self.no_test,
|
||||||
|
cfg_overrides: CfgOverrides {
|
||||||
|
global: CfgDiff::new(vec![CfgAtom::Flag(hir::sym::miri.clone())], vec![]).unwrap(),
|
||||||
|
selective: Default::default(),
|
||||||
|
},
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
let no_progress = &|_| ();
|
let no_progress = &|_| ();
|
||||||
|
|
|
@ -71,6 +71,8 @@ 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
|
||||||
|
/// Don't set #[cfg(test)].
|
||||||
|
optional --no-test
|
||||||
|
|
||||||
/// 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
|
||||||
|
@ -233,6 +235,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 no_test: bool,
|
||||||
pub disable_build_scripts: bool,
|
pub disable_build_scripts: bool,
|
||||||
pub disable_proc_macros: bool,
|
pub disable_proc_macros: bool,
|
||||||
pub proc_macro_srv: Option<PathBuf>,
|
pub proc_macro_srv: Option<PathBuf>,
|
||||||
|
|
Loading…
Reference in a new issue