From 14e4cf9155f2d0c31c9088c43f8545b495595397 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Wed, 30 Oct 2019 16:49:17 +0100 Subject: [PATCH] Remove node/src/main.rs (#3969) --- substrate/Cargo.lock | 12 ++---------- substrate/Cargo.toml | 25 ------------------------- substrate/build.rs | 24 ------------------------ substrate/node/cli/Cargo.toml | 13 +++++++++++++ substrate/node/{src => cli/bin}/main.rs | 2 +- substrate/node/cli/build.rs | 6 ++++-- 6 files changed, 20 insertions(+), 62 deletions(-) delete mode 100644 substrate/build.rs rename substrate/node/{src => cli/bin}/main.rs (97%) diff --git a/substrate/Cargo.lock b/substrate/Cargo.lock index 861222cc98..233151e336 100644 --- a/substrate/Cargo.lock +++ b/substrate/Cargo.lock @@ -2377,6 +2377,7 @@ dependencies = [ name = "node-cli" version = "2.0.0" dependencies = [ + "ctrlc 3.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "exit-future 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2426,6 +2427,7 @@ dependencies = [ "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", "transaction-factory 0.0.1", + "vergen 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4776,16 +4778,6 @@ dependencies = [ "tiny-bip39 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "substrate" -version = "2.0.0" -dependencies = [ - "ctrlc 3.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "node-cli 2.0.0", - "vergen 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "substrate-application-crypto" version = "2.0.0" diff --git a/substrate/Cargo.toml b/substrate/Cargo.toml index 2d68511b2e..31a08f4eaf 100644 --- a/substrate/Cargo.toml +++ b/substrate/Cargo.toml @@ -1,22 +1,3 @@ -[[bin]] -name = "substrate" -path = "node/src/main.rs" - -[package] -name = "substrate" -version = "2.0.0" -authors = ["Parity Technologies "] -build = "build.rs" -edition = "2018" - -[dependencies] -cli = { package = "node-cli", path = "node/cli" } -futures = "0.1.29" -ctrlc = { version = "3.1.3", features = ["termination"] } - -[build-dependencies] -vergen = "3.0.4" - [workspace] members = [ "core/authority-discovery", @@ -124,12 +105,6 @@ members = [ "test-utils/chain-spec-builder", ] -[badges] -travis-ci = { repository = "paritytech/substrate", branch = "master" } -maintenance = { status = "actively-developed" } -is-it-maintained-issue-resolution = { repository = "paritytech/substrate" } -is-it-maintained-open-issues = { repository = "paritytech/substrate" } - [profile.release] # Substrate runtime requires unwinding. panic = "unwind" diff --git a/substrate/build.rs b/substrate/build.rs deleted file mode 100644 index 273700c525..0000000000 --- a/substrate/build.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2015-2019 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 . - -use vergen::{ConstantsFlags, generate_cargo_keys}; - -const ERROR_MSG: &str = "Failed to generate metadata files"; - -fn main() { - generate_cargo_keys(ConstantsFlags::all()).expect(ERROR_MSG); - println!("cargo:rerun-if-changed=.git/HEAD"); -} diff --git a/substrate/node/cli/Cargo.toml b/substrate/node/cli/Cargo.toml index 7e011d9de8..b85014eeef 100644 --- a/substrate/node/cli/Cargo.toml +++ b/substrate/node/cli/Cargo.toml @@ -5,6 +5,17 @@ authors = ["Parity Technologies "] description = "Substrate node implementation in Rust." build = "build.rs" edition = "2018" +default-run = "substrate" + +[badges] +travis-ci = { repository = "paritytech/substrate", branch = "master" } +maintenance = { status = "actively-developed" } +is-it-maintained-issue-resolution = { repository = "paritytech/substrate" } +is-it-maintained-open-issues = { repository = "paritytech/substrate" } + +[[bin]] +name = "substrate" +path = "bin/main.rs" [dependencies] log = "0.4.8" @@ -51,6 +62,7 @@ im_online = { package = "srml-im-online", path = "../../srml/im-online", default serde = { version = "1.0.101", features = [ "derive" ] } client_db = { package = "substrate-client-db", path = "../../core/client/db", features = ["kvdb-rocksdb"] } offchain = { package = "substrate-offchain", path = "../../core/offchain" } +ctrlc = { version = "3.1.3", features = ["termination"] } [dev-dependencies] keystore = { package = "substrate-keystore", path = "../../core/keystore" } @@ -63,3 +75,4 @@ tempfile = "3.1.0" [build-dependencies] cli = { package = "substrate-cli", path = "../../core/cli" } structopt = "0.3.3" +vergen = "3.0.4" diff --git a/substrate/node/src/main.rs b/substrate/node/cli/bin/main.rs similarity index 97% rename from substrate/node/src/main.rs rename to substrate/node/cli/bin/main.rs index 9f76cf638c..4b07d8c8a4 100644 --- a/substrate/node/src/main.rs +++ b/substrate/node/cli/bin/main.rs @@ -54,5 +54,5 @@ fn main() -> Result<(), cli::error::Error> { support_url: "https://github.com/paritytech/substrate/issues/new", }; - cli::run(std::env::args(), Exit, version) + node_cli::run(std::env::args(), Exit, version) } diff --git a/substrate/node/cli/build.rs b/substrate/node/cli/build.rs index e7a7b271f1..48b57c4600 100644 --- a/substrate/node/cli/build.rs +++ b/substrate/node/cli/build.rs @@ -15,13 +15,15 @@ // along with Substrate. If not, see . use cli::{NoCustom, CoreParams}; - use std::{fs, env, path::Path}; - use structopt::{StructOpt, clap::Shell}; +use vergen::{ConstantsFlags, generate_cargo_keys}; fn main() { build_shell_completion(); + generate_cargo_keys(ConstantsFlags::all()) + .expect("Failed to generate metadata files"); + println!("cargo:rerun-if-changed=.git/HEAD"); } /// Build shell completion scripts for all known shells