From b3a6ebb4f6ba486a898815bc59186bdef9e62754 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Wed, 23 Jan 2019 16:46:19 +0000 Subject: [PATCH 1/2] Bump cargo_metadata from 0.6.4 to 0.7.0 Bumps [cargo_metadata](https://github.com/oli-obk/cargo_metadata) from 0.6.4 to 0.7.0. - [Release notes](https://github.com/oli-obk/cargo_metadata/releases) - [Commits](https://github.com/oli-obk/cargo_metadata/commits) Signed-off-by: dependabot[bot] --- Cargo.lock | 15 ++++++++++++++- Cargo.toml | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d27a36c9e1e..d0a30b9d9df 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -170,6 +170,18 @@ dependencies = [ "serde_json 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "cargo_metadata" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "cc" version = "1.0.28" @@ -1344,7 +1356,7 @@ name = "rls" version = "1.33.0" dependencies = [ "cargo 0.34.0 (git+https://github.com/rust-lang/cargo?rev=907c0febe7045fa02dff2a35c5e36d3bd59ea50d)", - "cargo_metadata 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cargo_metadata 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "clippy_lints 0.0.212 (git+https://github.com/rust-lang/rust-clippy?rev=280069ddc750d8a20d075c76322c45d5db4a48f8)", "crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2228,6 +2240,7 @@ dependencies = [ "checksum bytesize 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "716960a18f978640f25101b5cbf1c6f6b0d3192fab36a2d98ca96f0ecbe41010" "checksum cargo 0.34.0 (git+https://github.com/rust-lang/cargo?rev=907c0febe7045fa02dff2a35c5e36d3bd59ea50d)" = "" "checksum cargo_metadata 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e5d1b4d380e1bab994591a24c2bdd1b054f64b60bef483a8c598c7c345bc3bbe" +"checksum cargo_metadata 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "95932a7ed5f2308fc00a46d2aa8eb1b06b402c896c2df424916ee730ba610c2e" "checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" diff --git a/Cargo.toml b/Cargo.toml index 8e8c79bac7b..0f250976d8d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" From df824c5a4c82ff3a92c5271541d1bce5aab16cf1 Mon Sep 17 00:00:00 2001 From: Alex Butler Date: Thu, 24 Jan 2019 11:36:25 +0000 Subject: [PATCH 2/2] Update cargo_metadata -> 0.7 --- Cargo.lock | 2 +- src/build/cargo_plan.rs | 29 ++++++++++++----------------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d0a30b9d9df..0649ff66db1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -179,7 +179,7 @@ dependencies = [ "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff --git a/src/build/cargo_plan.rs b/src/build/cargo_plan.rs index 035f5818035..3bdf7e3cd45 100644 --- a/src/build/cargo_plan.rs +++ b/src/build/cargo_plan.rs @@ -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 @@ -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 { 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.