Allow rust files to be used linkedProjects

This commit is contained in:
Lukas Wirth 2024-04-21 14:40:10 +02:00
parent 55d9a533b3
commit a2ed6837bc
21 changed files with 203 additions and 180 deletions

View file

@ -32,6 +32,7 @@ pub struct CargoWorkspace {
targets: Arena<TargetData>,
workspace_root: AbsPathBuf,
target_directory: AbsPathBuf,
manifest_path: ManifestPath,
}
impl ops::Index<Package> for CargoWorkspace {
@ -334,7 +335,7 @@ impl CargoWorkspace {
.with_context(|| format!("Failed to run `{:?}`", meta.cargo_command()))
}
pub fn new(mut meta: cargo_metadata::Metadata) -> CargoWorkspace {
pub fn new(mut meta: cargo_metadata::Metadata, manifest_path: ManifestPath) -> CargoWorkspace {
let mut pkg_by_id = FxHashMap::default();
let mut packages = Arena::default();
let mut targets = Arena::default();
@ -448,7 +449,7 @@ impl CargoWorkspace {
let target_directory = AbsPathBuf::assert(meta.target_directory);
CargoWorkspace { packages, targets, workspace_root, target_directory }
CargoWorkspace { packages, targets, workspace_root, target_directory, manifest_path }
}
pub fn packages(&self) -> impl ExactSizeIterator<Item = Package> + '_ {
@ -466,6 +467,10 @@ impl CargoWorkspace {
&self.workspace_root
}
pub fn manifest_path(&self) -> &ManifestPath {
&self.manifest_path
}
pub fn target_directory(&self) -> &AbsPath {
&self.target_directory
}