From f1c50e5648ddc4542c7b33d45b126662f38a8800 Mon Sep 17 00:00:00 2001 From: debris Date: Mon, 16 Oct 2017 17:28:59 +0200 Subject: [PATCH] remove ipc codegen from updater --- Cargo.lock | 15 +---------- ipc-common-types/Cargo.toml | 16 ------------ ipc-common-types/build.rs | 21 --------------- ipc-common-types/src/lib.rs | 26 ------------------- ipc-common-types/src/types/mod.rs | 21 --------------- ipc-common-types/src/types/mod.rs.in | 21 --------------- updater/Cargo.toml | 7 +---- updater/build.rs | 22 ---------------- updater/src/lib.rs | 10 +++---- updater/src/service.rs | 4 +-- updater/src/types/all.rs | 5 +--- updater/src/types/mod.rs | 9 +++++-- updater/src/types/mod.rs.in | 17 ------------ .../src/types/release_track.rs | 3 +-- .../src/types/version_info.rs | 6 ++--- updater/src/updater.rs | 3 +-- 16 files changed, 18 insertions(+), 188 deletions(-) delete mode 100644 ipc-common-types/Cargo.toml delete mode 100644 ipc-common-types/build.rs delete mode 100644 ipc-common-types/src/lib.rs delete mode 100644 ipc-common-types/src/types/mod.rs delete mode 100644 ipc-common-types/src/types/mod.rs.in delete mode 100644 updater/build.rs delete mode 100644 updater/src/types/mod.rs.in rename {ipc-common-types => updater}/src/types/release_track.rs (96%) rename {ipc-common-types => updater}/src/types/version_info.rs (94%) diff --git a/Cargo.lock b/Cargo.lock index 17d8d9a8c..fd5c97925 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1298,17 +1298,6 @@ dependencies = [ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "ipc-common-types" -version = "1.9.0" -dependencies = [ - "ethcore-bigint 0.1.3", - "ethcore-ipc 1.9.0", - "ethcore-ipc-codegen 1.9.0", - "ethcore-util 1.9.0", - "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "ipnetwork" version = "0.12.7" @@ -2344,17 +2333,15 @@ dependencies = [ "ethcore 1.9.0", "ethcore-bigint 0.1.3", "ethcore-bytes 0.1.0", - "ethcore-ipc 1.9.0", - "ethcore-ipc-codegen 1.9.0", "ethcore-util 1.9.0", "ethsync 1.9.0", "futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", - "ipc-common-types 1.9.0", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-hash-fetch 1.9.0", "parity-reactor 0.1.0", "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "path 0.1.0", + "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/ipc-common-types/Cargo.toml b/ipc-common-types/Cargo.toml deleted file mode 100644 index e00949adc..000000000 --- a/ipc-common-types/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -description = "Types that implement IPC and are common to multiple modules." -name = "ipc-common-types" -version = "1.9.0" -license = "GPL-3.0" -authors = ["Parity Technologies "] -build = "build.rs" - -[build-dependencies] -ethcore-ipc-codegen = { path = "../ipc/codegen" } - -[dependencies] -semver = "0.6" -ethcore-ipc = { path = "../ipc/rpc" } -ethcore-util = { path = "../util" } -ethcore-bigint = { path = "../util/bigint" } diff --git a/ipc-common-types/build.rs b/ipc-common-types/build.rs deleted file mode 100644 index 3a51d6a21..000000000 --- a/ipc-common-types/build.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity 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. - -// Parity 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 Parity. If not, see . - -extern crate ethcore_ipc_codegen; - -fn main() { - ethcore_ipc_codegen::derive_binary("src/types/mod.rs.in").unwrap(); -} diff --git a/ipc-common-types/src/lib.rs b/ipc-common-types/src/lib.rs deleted file mode 100644 index c1d18a8d7..000000000 --- a/ipc-common-types/src/lib.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity 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. - -// Parity 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 Parity. If not, see . - -//! Updater for Parity executables - -extern crate semver; -extern crate ethcore_util as util; -extern crate ethcore_bigint as bigint; -extern crate ethcore_ipc as ipc; - -mod types; - -pub use types::*; diff --git a/ipc-common-types/src/types/mod.rs b/ipc-common-types/src/types/mod.rs deleted file mode 100644 index 68dfe0b25..000000000 --- a/ipc-common-types/src/types/mod.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity 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. - -// Parity 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 Parity. If not, see . - -//! Types used in the public api - -#![allow(dead_code, unused_assignments, unused_variables)] // codegen issues -include!(concat!(env!("OUT_DIR"), "/mod.rs.in")); - diff --git a/ipc-common-types/src/types/mod.rs.in b/ipc-common-types/src/types/mod.rs.in deleted file mode 100644 index f137d1d60..000000000 --- a/ipc-common-types/src/types/mod.rs.in +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity 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. - -// Parity 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 Parity. If not, see . - -pub mod release_track; -pub mod version_info; - -pub use release_track::{ReleaseTrack}; -pub use version_info::{VersionInfo}; \ No newline at end of file diff --git a/updater/Cargo.toml b/updater/Cargo.toml index 9d981440d..a67559f68 100644 --- a/updater/Cargo.toml +++ b/updater/Cargo.toml @@ -4,15 +4,12 @@ name = "parity-updater" version = "1.9.0" license = "GPL-3.0" authors = ["Parity Technologies "] -build = "build.rs" - -[build-dependencies] -ethcore-ipc-codegen = { path = "../ipc/codegen" } [dependencies] log = "0.3" ethabi = "4.0" target_info = "0.1" +semver = "0.6" ethcore = { path = "../ethcore" } ethsync = { path = "../sync" } ethcore-util = { path = "../util" } @@ -21,7 +18,5 @@ ethcore-bytes = { path = "../util/bytes" } futures = "0.1" parking_lot = "0.4" parity-hash-fetch = { path = "../hash-fetch" } -ipc-common-types = { path = "../ipc-common-types" } -ethcore-ipc = { path = "../ipc/rpc" } parity-reactor = { path = "../util/reactor" } path = { path = "../util/path" } diff --git a/updater/build.rs b/updater/build.rs deleted file mode 100644 index b962f1e60..000000000 --- a/updater/build.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity 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. - -// Parity 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 Parity. If not, see . - -extern crate ethcore_ipc_codegen; - -fn main() { - ethcore_ipc_codegen::derive_binary("src/types/mod.rs.in").unwrap(); - ethcore_ipc_codegen::derive_ipc_cond("src/service.rs", cfg!(feature="ipc")).unwrap(); -} diff --git a/updater/src/lib.rs b/updater/src/lib.rs index 9ba948d9f..c0da3b6a1 100644 --- a/updater/src/lib.rs +++ b/updater/src/lib.rs @@ -20,27 +20,23 @@ extern crate ethcore_util as util; extern crate ethcore_bigint as bigint; extern crate ethcore_bytes as bytes; -extern crate ipc_common_types; extern crate parking_lot; extern crate parity_hash_fetch as hash_fetch; extern crate ethcore; extern crate ethabi; extern crate ethsync; -extern crate ethcore_ipc as ipc; extern crate futures; extern crate target_info; extern crate parity_reactor; extern crate path; +extern crate semver; mod updater; mod operations; mod types; -mod service { - #![allow(dead_code, unused_assignments, unused_variables, missing_docs)] // codegen issues - include!(concat!(env!("OUT_DIR"), "/service.rs")); -} +mod service; pub use service::{Service}; -pub use types::all::{ReleaseInfo, OperationsInfo, CapState, VersionInfo, ReleaseTrack}; +pub use types::{ReleaseInfo, OperationsInfo, CapState, VersionInfo, ReleaseTrack}; pub use updater::{Updater, UpdateFilter, UpdatePolicy}; diff --git a/updater/src/service.rs b/updater/src/service.rs index dbc7e0ead..b025eb42e 100644 --- a/updater/src/service.rs +++ b/updater/src/service.rs @@ -14,10 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -use types::all::{CapState, ReleaseInfo, OperationsInfo}; -use ipc_common_types::VersionInfo; +use types::{CapState, ReleaseInfo, OperationsInfo, VersionInfo}; -#[ipc(client_ident="RemoteUpdater")] pub trait Service: Send + Sync { /// Is the currently running client capable of supporting the current chain? /// We default to true if there's no clear information. diff --git a/updater/src/types/all.rs b/updater/src/types/all.rs index aef1a0ce3..b20b2fa41 100644 --- a/updater/src/types/all.rs +++ b/updater/src/types/all.rs @@ -17,11 +17,10 @@ //! Types used in the public API use bigint::hash::H256; -pub use ipc_common_types::{VersionInfo, ReleaseTrack}; +use types::VersionInfo; /// Information regarding a particular release of Parity #[derive(Debug, Clone, PartialEq)] -#[binary] pub struct ReleaseInfo { /// Information on the version. pub version: VersionInfo, @@ -35,7 +34,6 @@ pub struct ReleaseInfo { /// Information on our operations environment. #[derive(Debug, Clone, PartialEq)] -#[binary] pub struct OperationsInfo { /// Our blockchain's latest fork. pub fork: u64, @@ -51,7 +49,6 @@ pub struct OperationsInfo { /// Information on the current version's consensus capabililty. #[derive(Debug, Clone, Copy, PartialEq)] -#[binary] pub enum CapState { /// Unknown. Unknown, diff --git a/updater/src/types/mod.rs b/updater/src/types/mod.rs index 68dfe0b25..b6d3c6025 100644 --- a/updater/src/types/mod.rs +++ b/updater/src/types/mod.rs @@ -16,6 +16,11 @@ //! Types used in the public api -#![allow(dead_code, unused_assignments, unused_variables)] // codegen issues -include!(concat!(env!("OUT_DIR"), "/mod.rs.in")); +mod all; +mod release_track; +mod version_info; + +pub use self::all::{ReleaseInfo, OperationsInfo, CapState}; +pub use self::release_track::ReleaseTrack; +pub use self::version_info::VersionInfo; diff --git a/updater/src/types/mod.rs.in b/updater/src/types/mod.rs.in deleted file mode 100644 index 0681e2884..000000000 --- a/updater/src/types/mod.rs.in +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity 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. - -// Parity 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 Parity. If not, see . - -pub mod all; diff --git a/ipc-common-types/src/types/release_track.rs b/updater/src/types/release_track.rs similarity index 96% rename from ipc-common-types/src/types/release_track.rs rename to updater/src/types/release_track.rs index 418f590c8..0eaf85d14 100644 --- a/ipc-common-types/src/types/release_track.rs +++ b/updater/src/types/release_track.rs @@ -20,7 +20,6 @@ use std::fmt; /// A release's track. #[derive(PartialEq, Eq, Clone, Copy, Debug)] -#[binary] pub enum ReleaseTrack { /// Stable track. Stable, @@ -35,7 +34,7 @@ pub enum ReleaseTrack { } impl fmt::Display for ReleaseTrack { - fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", match *self { ReleaseTrack::Stable => "stable", ReleaseTrack::Beta => "beta", diff --git a/ipc-common-types/src/types/version_info.rs b/updater/src/types/version_info.rs similarity index 94% rename from ipc-common-types/src/types/version_info.rs rename to updater/src/types/version_info.rs index ef386824d..778e57087 100644 --- a/ipc-common-types/src/types/version_info.rs +++ b/updater/src/types/version_info.rs @@ -17,15 +17,13 @@ //! Types used in the public API use std::fmt; -use std::str::FromStr; use semver::{Version}; use bigint::hash::H160; use util::misc::raw_package_info; -use release_track::ReleaseTrack; +use types::ReleaseTrack; /// Version information of a particular release. #[derive(Debug, Clone, PartialEq)] -#[binary] pub struct VersionInfo { /// The track on which it was released. pub track: ReleaseTrack, @@ -48,7 +46,7 @@ impl VersionInfo { VersionInfo { track: raw.0.into(), version: { let mut v = Version::parse(raw.1).expect("Environment variables are known to be valid; qed"); v.build = vec![]; v.pre = vec![]; v }, - hash: H160::from_str(raw.2).unwrap_or_else(|_| H160::zero()), + hash: raw.2.parse::().unwrap_or_else(|_| H160::zero()), } } diff --git a/updater/src/updater.rs b/updater/src/updater.rs index efa34adab..91c9181f8 100644 --- a/updater/src/updater.rs +++ b/updater/src/updater.rs @@ -24,13 +24,12 @@ use ethsync::{SyncProvider}; use futures::future; use hash_fetch::{self as fetch, HashFetch}; use hash_fetch::fetch::Client as FetchService; -use ipc_common_types::{VersionInfo, ReleaseTrack}; use operations::Operations; use parity_reactor::Remote; use path::restrict_permissions_owner; use service::{Service}; use target_info::Target; -use types::all::{ReleaseInfo, OperationsInfo, CapState}; +use types::{ReleaseInfo, OperationsInfo, CapState, VersionInfo, ReleaseTrack}; use bigint::hash::{H160, H256}; use util::Address; use bytes::Bytes;