Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Bump cargo_metadata from 0.6.4 to 0.7.0 #1252

Merged
merged 2 commits into from
Jan 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test = false

[dependencies]
cargo = { git = "https://github.com/rust-lang/cargo", rev = "907c0febe7045fa02dff2a35c5e36d3bd59ea50d" }
cargo_metadata = "0.6"
cargo_metadata = "0.7"
clippy_lints = { git = "https://github.com/rust-lang/rust-clippy", rev = "280069ddc750d8a20d075c76322c45d5db4a48f8", optional = true }
env_logger = "0.6"
failure = "0.1.1"
Expand Down
29 changes: 12 additions & 17 deletions src/build/cargo_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@ use cargo::core::{PackageId, Target, TargetKind};
use cargo::util::ProcessBuilder;
use cargo_metadata;
use log::{error, trace};
use url::Url;

use crate::build::PackageArg;
use crate::build::plan::{BuildKey, BuildGraph, JobQueue, WorkStatus};
use crate::build::plan::{BuildGraph, BuildKey, JobQueue, WorkStatus};
use crate::build::rustc::src_path;
use crate::lsp_data::parse_file_path;
use crate::build::PackageArg;

/// Main key type by which `Unit`s will be distinguished in the build plan.
/// In Target we're mostly interested in TargetKind (Lib, Bin, ...) and name
Expand Down Expand Up @@ -455,19 +453,16 @@ impl PackageMap {
// Find each package in the workspace and record the root directory and package name.
fn discover_package_paths(manifest_path: &Path) -> HashMap<PathBuf, String> {
trace!("read metadata {:?}", manifest_path);
let metadata = match cargo_metadata::metadata(Some(manifest_path)) {
Ok(metadata) => metadata,
Err(_) => return HashMap::new(),
};
metadata
.workspace_members
.into_iter()
.map(|wm| {
assert!(wm.url().starts_with("path+"));
let url = Url::parse(&wm.url()[5..]).expect("Bad URL");
let path = parse_file_path(&url).expect("URL not a path");
(path, wm.name().into())
}).collect()
cargo_metadata::MetadataCommand::new()
.manifest_path(manifest_path)
.exec()
.iter()
.flat_map(|meta| meta.workspace_members.iter().map(move |id| &meta[id]))
.filter_map(|pkg| {
let dir = pkg.manifest_path.parent()?.to_path_buf();
Some((dir, pkg.name.clone()))
})
.collect()
}

/// Given modified set of files, returns a set of corresponding dirty packages.
Expand Down