Add target_directory
path to CargoWorkspace
This commit is contained in:
parent
a48e0e14e1
commit
fc888b583d
@ -32,6 +32,7 @@ pub struct CargoWorkspace {
|
||||
packages: Arena<PackageData>,
|
||||
targets: Arena<TargetData>,
|
||||
workspace_root: AbsPathBuf,
|
||||
target_directory: AbsPathBuf,
|
||||
}
|
||||
|
||||
impl ops::Index<Package> for CargoWorkspace {
|
||||
@ -414,7 +415,10 @@ pub fn new(mut meta: cargo_metadata::Metadata) -> CargoWorkspace {
|
||||
let workspace_root =
|
||||
AbsPathBuf::assert(PathBuf::from(meta.workspace_root.into_os_string()));
|
||||
|
||||
CargoWorkspace { packages, targets, workspace_root }
|
||||
let target_directory =
|
||||
AbsPathBuf::assert(PathBuf::from(meta.target_directory.into_os_string()));
|
||||
|
||||
CargoWorkspace { packages, targets, workspace_root, target_directory }
|
||||
}
|
||||
|
||||
pub fn packages(&self) -> impl Iterator<Item = Package> + ExactSizeIterator + '_ {
|
||||
@ -432,6 +436,10 @@ pub fn workspace_root(&self) -> &AbsPath {
|
||||
&self.workspace_root
|
||||
}
|
||||
|
||||
pub fn target_directory(&self) -> &AbsPath {
|
||||
&self.target_directory
|
||||
}
|
||||
|
||||
pub fn package_flag(&self, package: &PackageData) -> String {
|
||||
if self.is_unique(&package.name) {
|
||||
package.name.clone()
|
||||
|
Loading…
Reference in New Issue
Block a user