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

Commit 6a14ed9

Browse files
committed
Auto merge of #1252 - rust-lang:dependabot/cargo/cargo_metadata-0.7.0, r=alexheretic
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. <details> <summary>Commits</summary> - See full diff in [compare view](https://github.com/oli-obk/cargo_metadata/commits) </details> <br /> [![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=cargo_metadata&package-manager=cargo&previous-version=0.6.4&new-version=0.7.0)](https://dependabot.com/compatibility-score.html?dependency-name=cargo_metadata&package-manager=cargo&previous-version=0.6.4&new-version=0.7.0) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- **Note:** This repo was added to Dependabot recently, so you'll receive a maximum of 5 PRs for your first few update runs. Once an update run creates fewer than 5 PRs we'll remove that limit. You can always request more updates by clicking `Bump now` in your [Dependabot dashboard](https://app.dependabot.com). <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot ignore this [patch|minor|major] version` will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language - `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com): - Update frequency (including time of day and day of week) - Automerge options (never/patch/minor, and dev/runtime dependencies) - Pull request limits (per update run and/or open at any time) - Out-of-range updates (receive only lockfile updates, if desired) - Security updates (receive only security updates, if desired) Finally, you can contact us by mentioning @dependabot. </details>
2 parents 6f63eb4 + df824c5 commit 6a14ed9

File tree

3 files changed

+27
-19
lines changed

3 files changed

+27
-19
lines changed

Cargo.lock

+14-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ test = false
2020

2121
[dependencies]
2222
cargo = { git = "https://github.com/rust-lang/cargo", rev = "907c0febe7045fa02dff2a35c5e36d3bd59ea50d" }
23-
cargo_metadata = "0.6"
23+
cargo_metadata = "0.7"
2424
clippy_lints = { git = "https://github.com/rust-lang/rust-clippy", rev = "280069ddc750d8a20d075c76322c45d5db4a48f8", optional = true }
2525
env_logger = "0.6"
2626
failure = "0.1.1"

src/build/cargo_plan.rs

+12-17
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,10 @@ use cargo::core::{PackageId, Target, TargetKind};
3535
use cargo::util::ProcessBuilder;
3636
use cargo_metadata;
3737
use log::{error, trace};
38-
use url::Url;
3938

40-
use crate::build::PackageArg;
41-
use crate::build::plan::{BuildKey, BuildGraph, JobQueue, WorkStatus};
39+
use crate::build::plan::{BuildGraph, BuildKey, JobQueue, WorkStatus};
4240
use crate::build::rustc::src_path;
43-
use crate::lsp_data::parse_file_path;
41+
use crate::build::PackageArg;
4442

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

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

0 commit comments

Comments
 (0)