From 66ad1ed974a8aaf1d39ea3e53cef55d4da44860f Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Thu, 20 Dec 2018 00:47:10 +0800 Subject: [PATCH] Avoid duplicate depencency declare via package re-export (#1287) * node/runtime: Avoid duplicate dependency via package reexport * core/test-runtime: Avoid duplicate dependency via package reexport * Update lock file --- substrate/Cargo.lock | 1 + substrate/core/test-runtime/Cargo.toml | 4 +- substrate/core/test-runtime/wasm/Cargo.lock | 10 ++++ substrate/core/test-runtime/wasm/Cargo.toml | 34 +++--------- substrate/core/test-runtime/wasm/src | 1 - substrate/core/test-runtime/wasm/src/lib.rs | 22 ++++++++ substrate/node/runtime/Cargo.toml | 59 +++++++++++---------- substrate/node/runtime/wasm/Cargo.lock | 17 ++++++ substrate/node/runtime/wasm/Cargo.toml | 53 ++---------------- substrate/node/runtime/wasm/src | 1 - substrate/node/runtime/wasm/src/lib.rs | 22 ++++++++ 11 files changed, 117 insertions(+), 107 deletions(-) delete mode 120000 substrate/core/test-runtime/wasm/src create mode 100644 substrate/core/test-runtime/wasm/src/lib.rs delete mode 120000 substrate/node/runtime/wasm/src create mode 100644 substrate/node/runtime/wasm/src/lib.rs diff --git a/substrate/Cargo.lock b/substrate/Cargo.lock index 597721c4d0..7a1c5a65b9 100644 --- a/substrate/Cargo.lock +++ b/substrate/Cargo.lock @@ -1866,6 +1866,7 @@ name = "node-runtime" version = "0.1.0" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "node-primitives 0.1.0", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/substrate/core/test-runtime/Cargo.toml b/substrate/core/test-runtime/Cargo.toml index bc5bfe4905..d43cb5d0cf 100644 --- a/substrate/core/test-runtime/Cargo.toml +++ b/substrate/core/test-runtime/Cargo.toml @@ -11,7 +11,7 @@ serde_derive = { version = "1.0", optional = true } parity-codec = { version = "2.1", default-features = false } parity-codec-derive = { version = "2.1", default-features = false } substrate-keyring = { path = "../keyring", optional = true } -substrate-client = { path = "../client", optional = true } +substrate-client = { path = "../client", default-features = false } substrate-primitives = { path = "../primitives", default-features = false } substrate-consensus-aura-primitives = { path = "../consensus/aura/primitives", default-features = false } sr-std = { path = "../sr-std", default-features = false } @@ -27,7 +27,7 @@ std = [ "hex-literal", "serde", "serde_derive", - "substrate-client", + "substrate-client/std", "substrate-keyring", "parity-codec/std", "sr-std/std", diff --git a/substrate/core/test-runtime/wasm/Cargo.lock b/substrate/core/test-runtime/wasm/Cargo.lock index 03a7ef0a00..7f0940028b 100644 --- a/substrate/core/test-runtime/wasm/Cargo.lock +++ b/substrate/core/test-runtime/wasm/Cargo.lock @@ -1215,6 +1215,8 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0", "sr-primitives 0.1.0", "sr-std 0.1.0", @@ -1222,9 +1224,17 @@ dependencies = [ "srml-support 0.1.0", "substrate-client 0.1.0", "substrate-consensus-aura-primitives 0.1.0", + "substrate-keyring 0.1.0", "substrate-primitives 0.1.0", ] +[[package]] +name = "substrate-test-runtime-wasm" +version = "0.1.0" +dependencies = [ + "substrate-test-runtime 0.1.0", +] + [[package]] name = "substrate-trie" version = "0.4.0" diff --git a/substrate/core/test-runtime/wasm/Cargo.toml b/substrate/core/test-runtime/wasm/Cargo.toml index 0d8894e8cf..5efaa01cf8 100644 --- a/substrate/core/test-runtime/wasm/Cargo.toml +++ b/substrate/core/test-runtime/wasm/Cargo.toml @@ -1,41 +1,21 @@ [package] -name = "substrate-test-runtime" +name = "substrate-test-runtime-wasm" version = "0.1.0" authors = ["Parity Technologies "] +[lib] +name = "substrate_test_runtime" +crate-type = ["cdylib"] + [dependencies] -log = { version = "0.4", optional = true } -hex-literal = { version = "0.1.0", optional = true } -parity-codec = { version = "2.1", default-features = false } -parity-codec-derive = { version = "2.1", default-features = false } -substrate-primitives = { path = "../../primitives", default-features = false } -substrate-consensus-aura-primitives = { path = "../../consensus/aura/primitives", default-features = false } -substrate-client = { path = "../../client", default-features = false } -sr-std = { path = "../../sr-std", default-features = false } -sr-io = { path = "../../sr-io", default-features = false } -sr-version = { path = "../../sr-version", default-features = false } -sr-primitives = { path = "../../sr-primitives", default-features = false } -srml-support = { path = "../../../srml/support", default-features = false } +substrate-test-runtime = { path = "..", default-features = false } [features] default = [] std = [ - "log", - "hex-literal", - "parity-codec/std", - "sr-std/std", - "sr-io/std", - "srml-support/std", - "sr-version/std", - "substrate-primitives/std", - "substrate-client/std", - "sr-primitives/std", - "substrate-consensus-aura-primitives/std", + "substrate-test-runtime/std", ] -[lib] -crate-type = ["cdylib"] - [profile.release] panic = "abort" lto = true diff --git a/substrate/core/test-runtime/wasm/src b/substrate/core/test-runtime/wasm/src deleted file mode 120000 index 5cd551cf26..0000000000 --- a/substrate/core/test-runtime/wasm/src +++ /dev/null @@ -1 +0,0 @@ -../src \ No newline at end of file diff --git a/substrate/core/test-runtime/wasm/src/lib.rs b/substrate/core/test-runtime/wasm/src/lib.rs new file mode 100644 index 0000000000..3238cca84f --- /dev/null +++ b/substrate/core/test-runtime/wasm/src/lib.rs @@ -0,0 +1,22 @@ +// Copyright 2017-2018 Parity Technologies (UK) Ltd. +// This file is part of Substrate. + +// Substrate is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Substrate is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Substrate. If not, see . + +//! The Substrate test runtime reexported for WebAssembly compile. + +#![cfg_attr(not(feature = "std"), no_std)] + +extern crate substrate_test_runtime; +pub use substrate_test_runtime::*; diff --git a/substrate/node/runtime/Cargo.toml b/substrate/node/runtime/Cargo.toml index 65c2faa01f..09f533373f 100644 --- a/substrate/node/runtime/Cargo.toml +++ b/substrate/node/runtime/Cargo.toml @@ -4,35 +4,36 @@ version = "0.1.0" authors = ["Parity Technologies "] [dependencies] -rustc-hex = "1.0" -hex-literal = "0.1.0" -serde = { version = "1.0", default-features = false } +integer-sqrt = { version = "0.1.2" } safe-mix = { version = "1.0", default-features = false } -parity-codec = "2.1" -parity-codec-derive = "2.1" -sr-std = { path = "../../core/sr-std" } -srml-support = { path = "../../srml/support" } -substrate-primitives = { path = "../../core/primitives" } +parity-codec-derive = { version = "2.1" } +parity-codec = { version = "2.1", default-features = false } +substrate-primitives = { path = "../../core/primitives", default-features = false } +substrate-client = { path = "../../core/client", default-features = false } +sr-std = { path = "../../core/sr-std", default-features = false } +srml-support = { path = "../../srml/support", default-features = false } +srml-aura = { path = "../../srml/aura", default-features = false } +srml-balances = { path = "../../srml/balances", default-features = false } +srml-consensus = { path = "../../srml/consensus", default-features = false } +srml-contract = { path = "../../srml/contract", default-features = false } +srml-council = { path = "../../srml/council", default-features = false } +srml-democracy = { path = "../../srml/democracy", default-features = false } +srml-executive = { path = "../../srml/executive", default-features = false } +sr-primitives = { path = "../../core/sr-primitives", default-features = false } +srml-session = { path = "../../srml/session", default-features = false } +srml-staking = { path = "../../srml/staking", default-features = false } +srml-system = { path = "../../srml/system", default-features = false } +srml-timestamp = { path = "../../srml/timestamp", default-features = false } +srml-treasury = { path = "../../srml/treasury", default-features = false } +srml-upgrade-key = { path = "../../srml/upgrade-key", default-features = false } +srml-grandpa = { path = "../../srml/grandpa", default-features = false } +sr-version = { path = "../../core/sr-version", default-features = false } +node-primitives = { path = "../primitives", default-features = false } substrate-consensus-aura-primitives = { path = "../../core/consensus/aura/primitives", default-features = false } -substrate-client = { path = "../../core/client" } -substrate-keyring = { path = "../../core/keyring" } -srml-aura = { path = "../../srml/aura" } -srml-balances = { path = "../../srml/balances" } -srml-consensus = { path = "../../srml/consensus" } -srml-contract = { path = "../../srml/contract" } -srml-council = { path = "../../srml/council" } -srml-democracy = { path = "../../srml/democracy" } -srml-executive = { path = "../../srml/executive" } -srml-grandpa = { path = "../../srml/grandpa" } -sr-primitives = { path = "../../core/sr-primitives" } -srml-session = { path = "../../srml/session" } -srml-staking = { path = "../../srml/staking" } -srml-system = { path = "../../srml/system" } -srml-timestamp = { path = "../../srml/timestamp" } -srml-treasury = { path = "../../srml/treasury" } -srml-upgrade-key = { path = "../../srml/upgrade-key" } -sr-version = { path = "../../core/sr-version" } -node-primitives = { path = "../primitives" } +rustc-hex = { version = "1.0", optional = true } +hex-literal = { version = "0.1.0", optional = true } +serde = { version = "1.0", optional = true } +substrate-keyring = { path = "../../core/keyring", optional = true } [features] default = ["std"] @@ -61,4 +62,8 @@ std = [ "safe-mix/std", "substrate-client/std", "substrate-consensus-aura-primitives/std", + "rustc-hex", + "hex-literal", + "serde", + "substrate-keyring", ] diff --git a/substrate/node/runtime/wasm/Cargo.lock b/substrate/node/runtime/wasm/Cargo.lock index bf81321064..68e7c1177b 100644 --- a/substrate/node/runtime/wasm/Cargo.lock +++ b/substrate/node/runtime/wasm/Cargo.lock @@ -499,11 +499,14 @@ dependencies = [ name = "node-runtime" version = "0.1.0" dependencies = [ + "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "node-primitives 0.1.0", "parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0", "sr-std 0.1.0", "sr-version 0.1.0", @@ -524,9 +527,17 @@ dependencies = [ "srml-upgrade-key 0.1.0", "substrate-client 0.1.0", "substrate-consensus-aura-primitives 0.1.0", + "substrate-keyring 0.1.0", "substrate-primitives 0.1.0", ] +[[package]] +name = "node-runtime-wasm" +version = "0.1.0" +dependencies = [ + "node-runtime 0.1.0", +] + [[package]] name = "nodrop" version = "0.1.13" @@ -872,6 +883,11 @@ name = "rustc-demangle" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rustc-hex" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "rustc-hex" version = "2.0.1" @@ -2011,6 +2027,7 @@ dependencies = [ "checksum redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "679da7508e9a6390aeaf7fbd02a800fdc64b73fe2204dd2c8ae66d22d9d5ad5d" "checksum ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6f7d28b30a72c01b458428e0ae988d4149c20d902346902be881e3edc4bb325c" "checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" +"checksum rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0ceb8ce7a5e520de349e1fa172baeba4a9e8d5ef06c47471863530bc4972ee1e" "checksum rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "403bb3a286107a04825a5f82e1270acc1e14028d3d554d7a1e08914549575ab8" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" diff --git a/substrate/node/runtime/wasm/Cargo.toml b/substrate/node/runtime/wasm/Cargo.toml index 400ec9d0f9..ea95bd1152 100644 --- a/substrate/node/runtime/wasm/Cargo.toml +++ b/substrate/node/runtime/wasm/Cargo.toml @@ -1,64 +1,19 @@ [package] -name = "node-runtime" +name = "node-runtime-wasm" version = "0.1.0" authors = ["Parity Technologies "] [lib] +name = "node_runtime" crate-type = ["cdylib"] [dependencies] -integer-sqrt = { version = "0.1.2" } -safe-mix = { version = "1.0", default-features = false } -parity-codec-derive = { version = "2.1" } -parity-codec = { version = "2.1", default-features = false } -substrate-primitives = { path = "../../../core/primitives", default-features = false } -substrate-client = { path = "../../../core/client", default-features = false } -sr-std = { path = "../../../core/sr-std", default-features = false } -srml-support = { path = "../../../srml/support", default-features = false } -srml-aura = { path = "../../../srml/aura", default-features = false } -srml-balances = { path = "../../../srml/balances", default-features = false } -srml-consensus = { path = "../../../srml/consensus", default-features = false } -srml-contract = { path = "../../../srml/contract", default-features = false } -srml-council = { path = "../../../srml/council", default-features = false } -srml-democracy = { path = "../../../srml/democracy", default-features = false } -srml-executive = { path = "../../../srml/executive", default-features = false } -sr-primitives = { path = "../../../core/sr-primitives", default-features = false } -srml-session = { path = "../../../srml/session", default-features = false } -srml-staking = { path = "../../../srml/staking", default-features = false } -srml-system = { path = "../../../srml/system", default-features = false } -srml-timestamp = { path = "../../../srml/timestamp", default-features = false } -srml-treasury = { path = "../../../srml/treasury", default-features = false } -srml-upgrade-key = { path = "../../../srml/upgrade-key", default-features = false } -srml-grandpa = { path = "../../../srml/grandpa", default-features = false } -sr-version = { path = "../../../core/sr-version", default-features = false } -node-primitives = { path = "../../primitives", default-features = false } -substrate-consensus-aura-primitives = { path = "../../../core/consensus/aura/primitives", default-features = false } +node-runtime = { path = "..", default-features = false } [features] default = [] std = [ - "safe-mix/std", - "parity-codec/std", - "substrate-primitives/std", - "substrate-client/std", - "sr-std/std", - "sr-primitives/std", - "srml-support/std", - "srml-balances/std", - "srml-consensus/std", - "srml-contract/std", - "srml-council/std", - "srml-democracy/std", - "srml-executive/std", - "srml-session/std", - "srml-staking/std", - "srml-system/std", - "srml-timestamp/std", - "srml-treasury/std", - "srml-upgrade-key/std", - "srml-grandpa/std", - "sr-version/std", - "node-primitives/std", + "node-runtime/std", ] [profile.release] diff --git a/substrate/node/runtime/wasm/src b/substrate/node/runtime/wasm/src deleted file mode 120000 index 5cd551cf26..0000000000 --- a/substrate/node/runtime/wasm/src +++ /dev/null @@ -1 +0,0 @@ -../src \ No newline at end of file diff --git a/substrate/node/runtime/wasm/src/lib.rs b/substrate/node/runtime/wasm/src/lib.rs new file mode 100644 index 0000000000..05d27009c7 --- /dev/null +++ b/substrate/node/runtime/wasm/src/lib.rs @@ -0,0 +1,22 @@ +// Copyright 2018 Parity Technologies (UK) Ltd. +// This file is part of Substrate. + +// Substrate is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Substrate is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Substrate. If not, see . + +//! The Substrate runtime reexported for WebAssembly compile. + +#![cfg_attr(not(feature = "std"), no_std)] + +extern crate node_runtime; +pub use node_runtime::*;