Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Update cli to new sc-cli API (#935)
Browse files Browse the repository at this point in the history
* Initial commit

Forked at: 77de8b9
Parent branch: origin/master

* Switch substrate to branch cecton-the-revenge-of-the-cli

* Adapting code

* Update Cargo.lock

* Adapting code

* Adapt more code

* Implement force_kusama parameter

* Revert dependency update

* Adapt code to use ref to SubstrateCli object

* Updated to latest version

* Updated with latest changes

* Bump spec vesion

* Fixed tests

* WIP

Forked at: 77de8b9
Parent branch: origin/master

* More fixes

* Cargo.lock

* Updated code

* Fixed and adapt

* Fixed dependency issue with wasm

* Adapted code

* Revert branch change

* Cargo.lock

* Cargo.lock

* Adapt code

* Clean-up

* More clean-up

* Cargo.lock
  • Loading branch information
cecton authored Apr 7, 2020
1 parent cda8004 commit bee86bb
Show file tree
Hide file tree
Showing 14 changed files with 303 additions and 438 deletions.
279 changes: 139 additions & 140 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ path = "src/main.rs"
name = "polkadot"
version = "0.7.29-pre1"
authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs"
edition = "2018"

[dependencies]
Expand All @@ -15,9 +14,6 @@ futures = "0.3.4"
service = { package = "polkadot-service", path = "service" }
parity-util-mem = { version = "*", default-features = false, features = ["jemalloc-global"] }

[build-dependencies]
vergen = "3.0.4"

[dev-dependencies]
assert_cmd = "0.12"
nix = "0.17"
Expand Down
7 changes: 6 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "polkadot-cli"
version = "0.7.29-pre1"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Polkadot node implementation in Rust."
description = "Polkadot Relay-chain Client Node"
edition = "2018"

[package.metadata.wasm-pack.profile.release]
Expand All @@ -29,18 +29,23 @@ service = { package = "polkadot-service", path = "../service", default-features
tokio = { version = "0.2.13", features = ["rt-threaded"], optional = true }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }

wasm-bindgen = { version = "0.2.57", optional = true }
wasm-bindgen-futures = { version = "0.4.7", optional = true }
browser-utils = { package = "substrate-browser-utils", git = "https://github.com/paritytech/substrate", branch = "master", optional = true }

[build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" }

[features]
default = [ "wasmtime", "rocksdb", "cli" ]
wasmtime = [ "sc-cli/wasmtime" ]
rocksdb = [ "service/rocksdb" ]
cli = [
"tokio",
"sc-cli",
"sc-service",
"frame-benchmarking-cli",
"service/full-node",
]
Expand Down
9 changes: 1 addition & 8 deletions build.rs → cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.

extern crate vergen;

use vergen::{ConstantsFlags, generate_cargo_keys};

const ERROR_MSG: &'static str = "Failed to generate metadata files";

fn main() {
generate_cargo_keys(ConstantsFlags::all()).expect(ERROR_MSG);
println!("cargo:rerun-if-changed=.git/HEAD");
substrate_build_script_utils::generate_cargo_keys();
}
6 changes: 3 additions & 3 deletions cli/src/browser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ async fn start_inner(chain_spec: String, log_level: String) -> Result<Client, Bo
let config = browser_configuration(chain_spec).await?;

info!("Polkadot browser node");
info!(" version {}", config.full_version());
info!(" version {}", config.impl_version);
info!(" by Parity Technologies, 2017-2020");
info!("📋 Chain specification: {}", config.expect_chain_spec().name());
info!("🏷 Node name: {}", config.name);
info!("📋 Chain specification: {}", config.chain_spec.name());
info!("🏷 Node name: {}", config.network.node_name);
info!("👤 Role: {}", config.display_role());

// Create the service. This is the most heavy initialization step.
Expand Down
88 changes: 0 additions & 88 deletions cli/src/chain_spec.rs

This file was deleted.

29 changes: 12 additions & 17 deletions cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,6 @@ pub struct RunCmd {
/// Force using Kusama native runtime.
#[structopt(long = "force-kusama")]
pub force_kusama: bool,
}

#[allow(missing_docs)]
#[derive(Debug, StructOpt, Clone)]
#[structopt(settings = &[
structopt::clap::AppSettings::GlobalVersion,
structopt::clap::AppSettings::ArgsNegateSubcommands,
structopt::clap::AppSettings::SubcommandsNegateReqs,
])]
pub struct Cli {
#[allow(missing_docs)]
#[structopt(subcommand)]
pub subcommand: Option<Subcommand>,

#[allow(missing_docs)]
#[structopt(flatten)]
pub run: RunCmd,

#[allow(missing_docs)]
#[structopt(long = "enable-authority-discovery")]
Expand All @@ -85,3 +68,15 @@ pub struct Cli {
#[structopt(long = "grandpa-pause", number_of_values(2))]
pub grandpa_pause: Vec<u32>,
}

#[allow(missing_docs)]
#[derive(Debug, StructOpt, Clone)]
pub struct Cli {
#[allow(missing_docs)]
#[structopt(subcommand)]
pub subcommand: Option<Subcommand>,

#[allow(missing_docs)]
#[structopt(flatten)]
pub run: RunCmd,
}
Loading

0 comments on commit bee86bb

Please sign in to comment.