From 0d919e1cd860ee81069995b2f32b637e319d68a3 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Wed, 3 Mar 2021 10:27:54 +0000 Subject: [PATCH] Upgrade cargo-metadata and fix usages --- Cargo.lock | 26 ++++++++++++++++++-------- Cargo.toml | 6 +++--- src/crate_metadata.rs | 6 +++--- src/workspace/manifest.rs | 16 ++-------------- src/workspace/mod.rs | 5 +++-- 5 files changed, 29 insertions(+), 30 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 945c9d7f..6d9fee0e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -478,6 +478,15 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" +[[package]] +name = "camino" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd065703998b183ed0b348a22555691373a9345a1431141e5778b48bb17e4703" +dependencies = [ + "serde", +] + [[package]] name = "cargo-contract" version = "0.10.0" @@ -497,7 +506,7 @@ dependencies = [ "hex", "impl-serde", "log", - "parity-scale-codec 2.0.0", + "parity-scale-codec 2.0.1", "parity-wasm 0.42.1", "pretty_assertions", "pwasm-utils", @@ -528,10 +537,11 @@ dependencies = [ [[package]] name = "cargo_metadata" -version = "0.12.3" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7714a157da7991e23d90686b9524b9e12e0407a108647f52e9328f4b3d51ac7f" +checksum = "081e3f0755c1f380c2d010481b6fa2e02973586d5f2b24eebb7a2a1d98b143d8" dependencies = [ + "camino", "cargo-platform", "semver 0.11.0", "semver-parser 0.10.2", @@ -2021,14 +2031,14 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75c823fdae1bb5ff5708ee61a62697e6296175dc671710876871c853f48592b3" +checksum = "0cd3dab59b5cf4bc81069ade0fc470341a1ef3ad5fa73e5a8943bed2ec12b2e8" dependencies = [ "arrayvec 0.5.2", "bitvec 0.20.1", "byte-slice-cast 1.0.0", - "parity-scale-codec-derive 2.0.0", + "parity-scale-codec-derive 2.0.1", "serde", ] @@ -2046,9 +2056,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9029e65297c7fd6d7013f0579e193ec2b34ae78eabca854c9417504ad8a2d214" +checksum = "fa04976a81fde04924b40cc4036c4d12841e8bb04325a5cf2ada75731a150a7d" dependencies = [ "proc-macro-crate", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index 5b83e1d7..c85ba857 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,14 +21,14 @@ include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE", "build.rs", "tem [dependencies] env_logger = "0.8.3" anyhow = "1.0.38" -structopt = "0.3.20" +structopt = "0.3.21" log = "0.4.14" heck = "0.3.2" zip = { version = "0.5.11", default-features = false } pwasm-utils = "0.17.0" parity-wasm = "0.42.1" -cargo_metadata = "0.12.3" -codec = { package = "parity-scale-codec", version = "2.0.0", features = ["derive"] } +cargo_metadata = "0.13.1" +codec = { package = "parity-scale-codec", version = "2.0.1", features = ["derive"] } which = "4.0.2" colored = "2.0.0" toml = "0.5.8" diff --git a/src/crate_metadata.rs b/src/crate_metadata.rs index 95e11d13..26bf7f5f 100644 --- a/src/crate_metadata.rs +++ b/src/crate_metadata.rs @@ -92,13 +92,13 @@ impl CrateMetadata { cargo_meta: metadata, root_package, package_name, - original_wasm, - dest_wasm, + original_wasm: original_wasm.into(), + dest_wasm: dest_wasm.into(), ink_version, documentation, homepage, user, - target_directory, + target_directory: target_directory.into(), }; Ok(crate_metadata) } diff --git a/src/workspace/manifest.rs b/src/workspace/manifest.rs index 69d9a272..dc1699bb 100644 --- a/src/workspace/manifest.rs +++ b/src/workspace/manifest.rs @@ -17,7 +17,7 @@ use anyhow::{Context, Result}; use super::{metadata, Profile}; -use std::convert::{TryFrom, TryInto}; +use std::convert::TryFrom; use std::{ collections::HashSet, fs, @@ -77,14 +77,6 @@ impl ManifestPath { } } -impl TryFrom<&PathBuf> for ManifestPath { - type Error = anyhow::Error; - - fn try_from(value: &PathBuf) -> Result { - ManifestPath::new(value) - } -} - impl

TryFrom> for ManifestPath where P: AsRef, @@ -126,11 +118,7 @@ impl Manifest { /// Create new Manifest for the given manifest path. /// /// The path *must* be to a `Cargo.toml`. - pub fn new

(path: P) -> Result - where - P: TryInto, - { - let manifest_path = path.try_into()?; + pub fn new(manifest_path: ManifestPath) -> Result { let toml = fs::read_to_string(&manifest_path).context("Loading Cargo.toml")?; let toml: value::Table = toml::from_str(&toml)?; diff --git a/src/workspace/mod.rs b/src/workspace/mod.rs index bc461d0d..7f242d2a 100644 --- a/src/workspace/mod.rs +++ b/src/workspace/mod.rs @@ -58,7 +58,8 @@ impl Workspace { package_id ) }); - let manifest = Manifest::new(&package.manifest_path)?; + let manifest_path = ManifestPath::new(&package.manifest_path)?; + let manifest = Manifest::new(manifest_path)?; Ok((package_id.clone(), (package.clone(), manifest))) }; @@ -73,7 +74,7 @@ impl Workspace { } Ok(Workspace { - workspace_root: metadata.workspace_root.clone(), + workspace_root: metadata.workspace_root.clone().into(), root_package: root_package.clone(), members, }) -- GitLab