diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index b5f50b207..1b581959d 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -5,6 +5,11 @@ license = "GPL-3.0" name = "ethcore" version = "1.2.0" authors = ["Ethcore "] +build = "build.rs" + +[build-dependencies] +syntex = "*" +"ethcore-ipc-codegen" = { path = "../ipc/codegen" } [dependencies] log = "0.3" diff --git a/ethcore/build.rs b/ethcore/build.rs new file mode 100644 index 000000000..e0f267bba --- /dev/null +++ b/ethcore/build.rs @@ -0,0 +1,34 @@ +// Copyright 2015, 2016 Ethcore (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 syntex; +extern crate ethcore_ipc_codegen as codegen; + +use std::env; +use std::path::Path; + +fn main() { + let out_dir = env::var_os("OUT_DIR").unwrap(); + // serialization pass + { + let src = Path::new("src/types/mod.rs.in"); + let dst = Path::new(&out_dir).join("types.rs"); + let mut registry = syntex::Registry::new(); + codegen::register(&mut registry); + registry.expand("", &src, &dst).unwrap(); + } + +} diff --git a/ethcore/src/types/mod.rs b/ethcore/src/types/mod.rs index 369591dfd..112f79c32 100644 --- a/ethcore/src/types/mod.rs +++ b/ethcore/src/types/mod.rs @@ -16,12 +16,5 @@ //! Types used in the public api -pub mod transaction; -pub mod ids; -pub mod receipt; -pub mod tree_route; -pub mod blockchain_info; -pub mod log_entry; -pub mod trace_types; -pub mod executed; -pub mod block_status; +#![allow(dead_code, unused_assignments, unused_variables)] // codegen issues +include!(concat!(env!("OUT_DIR"), "/types.rs")); diff --git a/ethcore/src/types/mod.rs.in b/ethcore/src/types/mod.rs.in index e69de29bb..1f67a9184 100644 --- a/ethcore/src/types/mod.rs.in +++ b/ethcore/src/types/mod.rs.in @@ -0,0 +1,25 @@ +// Copyright 2015, 2016 Ethcore (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 transaction; +pub mod ids; +pub mod receipt; +pub mod tree_route; +pub mod blockchain_info; +pub mod log_entry; +pub mod trace_types; +pub mod executed; +pub mod block_status;