Rename is_member
to is_local
This commit is contained in:
parent
8a4c35a068
commit
e241015a75
@ -135,8 +135,8 @@ pub struct PackageData {
|
|||||||
pub manifest: ManifestPath,
|
pub manifest: ManifestPath,
|
||||||
/// Targets provided by the crate (lib, bin, example, test, ...)
|
/// Targets provided by the crate (lib, bin, example, test, ...)
|
||||||
pub targets: Vec<Target>,
|
pub targets: Vec<Target>,
|
||||||
/// Is this package a member of the current workspace
|
/// Does this package come from the local filesystem (and is editable)?
|
||||||
pub is_member: bool,
|
pub is_local: bool,
|
||||||
/// List of packages this package depends on
|
/// List of packages this package depends on
|
||||||
pub dependencies: Vec<PackageDependency>,
|
pub dependencies: Vec<PackageDependency>,
|
||||||
/// Rust edition for this package
|
/// Rust edition for this package
|
||||||
@ -308,7 +308,7 @@ impl CargoWorkspace {
|
|||||||
});
|
});
|
||||||
// We treat packages without source as "local" packages. That includes all members of
|
// We treat packages without source as "local" packages. That includes all members of
|
||||||
// the current workspace, as well as any path dependency outside the workspace.
|
// the current workspace, as well as any path dependency outside the workspace.
|
||||||
let is_member = meta_pkg.source.is_none();
|
let is_local = meta_pkg.source.is_none();
|
||||||
|
|
||||||
let pkg = packages.alloc(PackageData {
|
let pkg = packages.alloc(PackageData {
|
||||||
id: id.repr.clone(),
|
id: id.repr.clone(),
|
||||||
@ -316,7 +316,7 @@ impl CargoWorkspace {
|
|||||||
version: version.clone(),
|
version: version.clone(),
|
||||||
manifest: AbsPathBuf::assert(PathBuf::from(&manifest_path)).try_into().unwrap(),
|
manifest: AbsPathBuf::assert(PathBuf::from(&manifest_path)).try_into().unwrap(),
|
||||||
targets: Vec::new(),
|
targets: Vec::new(),
|
||||||
is_member,
|
is_local,
|
||||||
edition,
|
edition,
|
||||||
dependencies: Vec::new(),
|
dependencies: Vec::new(),
|
||||||
features: meta_pkg.features.clone().into_iter().collect(),
|
features: meta_pkg.features.clone().into_iter().collect(),
|
||||||
|
@ -53,8 +53,8 @@ impl CfgOverrides {
|
|||||||
/// the current workspace.
|
/// the current workspace.
|
||||||
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
|
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
|
||||||
pub struct PackageRoot {
|
pub struct PackageRoot {
|
||||||
/// Is a member of the current workspace
|
/// Is from the local filesystem and may be edited
|
||||||
pub is_member: bool,
|
pub is_local: bool,
|
||||||
pub include: Vec<AbsPathBuf>,
|
pub include: Vec<AbsPathBuf>,
|
||||||
pub exclude: Vec<AbsPathBuf>,
|
pub exclude: Vec<AbsPathBuf>,
|
||||||
}
|
}
|
||||||
@ -268,7 +268,7 @@ impl ProjectWorkspace {
|
|||||||
ProjectWorkspace::Json { project, sysroot, rustc_cfg: _ } => project
|
ProjectWorkspace::Json { project, sysroot, rustc_cfg: _ } => project
|
||||||
.crates()
|
.crates()
|
||||||
.map(|(_, krate)| PackageRoot {
|
.map(|(_, krate)| PackageRoot {
|
||||||
is_member: krate.is_workspace_member,
|
is_local: krate.is_workspace_member,
|
||||||
include: krate.include.clone(),
|
include: krate.include.clone(),
|
||||||
exclude: krate.exclude.clone(),
|
exclude: krate.exclude.clone(),
|
||||||
})
|
})
|
||||||
@ -276,7 +276,7 @@ impl ProjectWorkspace {
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.chain(sysroot.as_ref().into_iter().flat_map(|sysroot| {
|
.chain(sysroot.as_ref().into_iter().flat_map(|sysroot| {
|
||||||
sysroot.crates().map(move |krate| PackageRoot {
|
sysroot.crates().map(move |krate| PackageRoot {
|
||||||
is_member: false,
|
is_local: false,
|
||||||
include: vec![sysroot[krate].root.parent().to_path_buf()],
|
include: vec![sysroot[krate].root.parent().to_path_buf()],
|
||||||
exclude: Vec::new(),
|
exclude: Vec::new(),
|
||||||
})
|
})
|
||||||
@ -293,7 +293,7 @@ impl ProjectWorkspace {
|
|||||||
cargo
|
cargo
|
||||||
.packages()
|
.packages()
|
||||||
.map(|pkg| {
|
.map(|pkg| {
|
||||||
let is_member = cargo[pkg].is_member;
|
let is_local = cargo[pkg].is_local;
|
||||||
let pkg_root = cargo[pkg].manifest.parent().to_path_buf();
|
let pkg_root = cargo[pkg].manifest.parent().to_path_buf();
|
||||||
|
|
||||||
let mut include = vec![pkg_root.clone()];
|
let mut include = vec![pkg_root.clone()];
|
||||||
@ -319,23 +319,23 @@ impl ProjectWorkspace {
|
|||||||
include.extend(extra_targets);
|
include.extend(extra_targets);
|
||||||
|
|
||||||
let mut exclude = vec![pkg_root.join(".git")];
|
let mut exclude = vec![pkg_root.join(".git")];
|
||||||
if is_member {
|
if is_local {
|
||||||
exclude.push(pkg_root.join("target"));
|
exclude.push(pkg_root.join("target"));
|
||||||
} else {
|
} else {
|
||||||
exclude.push(pkg_root.join("tests"));
|
exclude.push(pkg_root.join("tests"));
|
||||||
exclude.push(pkg_root.join("examples"));
|
exclude.push(pkg_root.join("examples"));
|
||||||
exclude.push(pkg_root.join("benches"));
|
exclude.push(pkg_root.join("benches"));
|
||||||
}
|
}
|
||||||
PackageRoot { is_member, include, exclude }
|
PackageRoot { is_local, include, exclude }
|
||||||
})
|
})
|
||||||
.chain(sysroot.into_iter().map(|sysroot| PackageRoot {
|
.chain(sysroot.into_iter().map(|sysroot| PackageRoot {
|
||||||
is_member: false,
|
is_local: false,
|
||||||
include: vec![sysroot.root().to_path_buf()],
|
include: vec![sysroot.root().to_path_buf()],
|
||||||
exclude: Vec::new(),
|
exclude: Vec::new(),
|
||||||
}))
|
}))
|
||||||
.chain(rustc.into_iter().flat_map(|rustc| {
|
.chain(rustc.into_iter().flat_map(|rustc| {
|
||||||
rustc.packages().map(move |krate| PackageRoot {
|
rustc.packages().map(move |krate| PackageRoot {
|
||||||
is_member: false,
|
is_local: false,
|
||||||
include: vec![rustc[krate].manifest.parent().to_path_buf()],
|
include: vec![rustc[krate].manifest.parent().to_path_buf()],
|
||||||
exclude: Vec::new(),
|
exclude: Vec::new(),
|
||||||
})
|
})
|
||||||
@ -345,12 +345,12 @@ impl ProjectWorkspace {
|
|||||||
ProjectWorkspace::DetachedFiles { files, sysroot, .. } => files
|
ProjectWorkspace::DetachedFiles { files, sysroot, .. } => files
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|detached_file| PackageRoot {
|
.map(|detached_file| PackageRoot {
|
||||||
is_member: true,
|
is_local: true,
|
||||||
include: vec![detached_file.clone()],
|
include: vec![detached_file.clone()],
|
||||||
exclude: Vec::new(),
|
exclude: Vec::new(),
|
||||||
})
|
})
|
||||||
.chain(sysroot.crates().map(|krate| PackageRoot {
|
.chain(sysroot.crates().map(|krate| PackageRoot {
|
||||||
is_member: false,
|
is_local: false,
|
||||||
include: vec![sysroot[krate].root.parent().to_path_buf()],
|
include: vec![sysroot[krate].root.parent().to_path_buf()],
|
||||||
exclude: Vec::new(),
|
exclude: Vec::new(),
|
||||||
}))
|
}))
|
||||||
|
@ -294,7 +294,7 @@ impl GlobalState {
|
|||||||
.workspaces
|
.workspaces
|
||||||
.iter()
|
.iter()
|
||||||
.flat_map(|ws| ws.to_roots())
|
.flat_map(|ws| ws.to_roots())
|
||||||
.filter(|it| it.is_member)
|
.filter(|it| it.is_local)
|
||||||
.flat_map(|root| {
|
.flat_map(|root| {
|
||||||
root.include.into_iter().flat_map(|it| {
|
root.include.into_iter().flat_map(|it| {
|
||||||
[
|
[
|
||||||
@ -514,12 +514,12 @@ impl ProjectFolders {
|
|||||||
vfs::loader::Entry::Directories(dirs)
|
vfs::loader::Entry::Directories(dirs)
|
||||||
};
|
};
|
||||||
|
|
||||||
if root.is_member {
|
if root.is_local {
|
||||||
res.watch.push(res.load.len());
|
res.watch.push(res.load.len());
|
||||||
}
|
}
|
||||||
res.load.push(entry);
|
res.load.push(entry);
|
||||||
|
|
||||||
if root.is_member {
|
if root.is_local {
|
||||||
local_filesets.push(fsc.len());
|
local_filesets.push(fsc.len());
|
||||||
}
|
}
|
||||||
fsc.add_file_set(file_set_roots)
|
fsc.add_file_set(file_set_roots)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user