Skip to content

Commit 7db038e

Browse files
Merge #72
72: Update Dependencies r=therealprof a=ZeroErrors ## Changes - Updated `cargo_metadata`, `clap` and `regex` to their latest versions - Replaced usage of deprecated `cargo_metadata` function with new function ## Description `cargo_metadata` had a minor change in API which the code has been updated for. `clap` has had a bug fix and improvement for building on windows. They also changed their minimum required rust to `1.36.0` however I have tested and still works on `1.38.0` which is `cargo-binutils` current minimum required rust. `regex` has had no notable changes. Co-authored-by: Zero <nick@zero.dev>
2 parents 862c82a + b4ff08a commit 7db038e

3 files changed

Lines changed: 17 additions & 14 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2626

2727
- Changed help output to more closely reflect the help command of `cargo` subcommands
2828
- Removed `walkdir` dependency by using expected path to tool executable
29+
- Updated `cargo_metadata 0.9 -> 0.10`
2930

3031
## [v0.2.0] - 2020-04-11
3132

Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ repository = "https://github.com/rust-embedded/cargo-binutils/"
1212
version = "0.2.0"
1313

1414
[dependencies]
15-
cargo_metadata = "0.9.1"
16-
clap = "2.33.0"
17-
failure = "0.1.7"
18-
regex = "1.3.6"
19-
rustc-cfg = "0.4.0"
20-
rustc-demangle = "0.1.16"
21-
rustc_version = "0.2.3"
15+
cargo_metadata = "0.10"
16+
clap = "2.33"
17+
failure = "0.1"
18+
regex = "1.3"
19+
rustc-cfg = "0.4"
20+
rustc-demangle = "0.1"
21+
rustc_version = "0.2"
2222
serde = "1.0"
23-
toml = "0.5.6"
23+
toml = "0.5"

src/lib.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#![deny(warnings)]
22

3-
use std::io::{self, Write};
3+
use std::io::{self, BufReader, Write};
44
use std::path::{Component, Path};
55
use std::process::{Command, Stdio};
66
use std::{env, str};
77

8-
use cargo_metadata::{parse_messages, Artifact, CargoOpt, Message, Metadata, MetadataCommand};
8+
use cargo_metadata::{Artifact, CargoOpt, Message, Metadata, MetadataCommand};
99
use clap::{App, AppSettings, Arg};
1010
use failure::bail;
1111
use rustc_cfg::Cfg;
@@ -241,10 +241,10 @@ fn determine_artifact(
241241
}
242242

243243
let mut child = cargo.spawn()?;
244-
let stdout = child.stdout.take().expect("Pipe to cargo process failed");
244+
let stdout = BufReader::new(child.stdout.take().expect("Pipe to cargo process failed"));
245245

246246
// Note: We call `collect` to ensure we don't block stdout which could prevent the process from exiting
247-
let messages = parse_messages(stdout).collect::<Vec<_>>();
247+
let messages = Message::parse_stream(stdout).collect::<Vec<_>>();
248248

249249
let status = child.wait()?;
250250
if !status.success() {
@@ -255,7 +255,9 @@ fn determine_artifact(
255255
for message in messages {
256256
match message? {
257257
Message::CompilerArtifact(artifact) => {
258-
if metadata.workspace_members.contains(&artifact.package_id) && build_type.matches(&artifact) {
258+
if metadata.workspace_members.contains(&artifact.package_id)
259+
&& build_type.matches(&artifact)
260+
{
259261
if wanted_artifact.is_some() {
260262
bail!("Can only have one matching artifact but found several");
261263
}
@@ -452,7 +454,7 @@ To see all the flags the proxied tool accepts run `cargo-{} -- -help`.{}",
452454

453455
match tool {
454456
// Tools that don't need a build
455-
Tool::Ar | Tool::Lld | Tool::Profdata => {},
457+
Tool::Ar | Tool::Lld | Tool::Profdata => {}
456458
// for some tools we change the CWD (current working directory) and
457459
// make the artifact path relative. This makes the path that the
458460
// tool will print easier to read. e.g. `libfoo.rlib` instead of

0 commit comments

Comments
 (0)