diff --git a/.gitmodules b/.gitmodules index a3e70108be5..06b71f6ae31 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,6 +2,3 @@ path = ethcore/res/ethereum/tests url = https://github.com/ethereum/tests.git branch = develop -[submodule "js/build"] - path = js/build - url = https://github.com/ethcore/js-precompiled diff --git a/Cargo.lock b/Cargo.lock index 531557c2f68..33581c9e8fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -341,7 +341,7 @@ dependencies = [ "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "mime_guess 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-dapps-glue 1.4.0", + "parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-ui 1.4.0", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -508,7 +508,7 @@ dependencies = [ "ethcore-util 1.4.0", "jsonrpc-core 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-dapps-glue 1.4.0", + "parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-ui 1.4.0", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1177,6 +1177,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "parity-dapps-glue" version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aster 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1191,7 +1192,24 @@ dependencies = [ name = "parity-ui" version = "1.4.0" dependencies = [ - "parity-dapps-glue 1.4.0", + "parity-ui-dev 1.4.0", + "parity-ui-precompiled 1.4.0 (git+https://github.com/ethcore/js-precompiled.git)", + "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parity-ui-dev" +version = "1.4.0" +dependencies = [ + "parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parity-ui-precompiled" +version = "1.4.0" +source = "git+https://github.com/ethcore/js-precompiled.git#eba8fdcb29c2230868b6604dd341513b5beceba9" +dependencies = [ + "parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1993,6 +2011,8 @@ dependencies = [ "checksum number_prefix 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "084d05f4bf60621a9ac9bde941a410df548f4de9545f06e5ee9d3aef4b97cd77" "checksum odds 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "b28c06e81b0f789122d415d6394b5fe849bde8067469f4c2980d3cdc10c78ec1" "checksum owning_ref 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8d91377085359426407a287ab16884a0111ba473aa6844ff01d4ec20ce3d75e7" +"checksum parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "98378dec0a185da2b7180308752f0bad73aaa949c3e0a3b0528d0e067945f7ab" +"checksum parity-ui-precompiled 1.4.0 (git+https://github.com/ethcore/js-precompiled.git)" = "" "checksum parking_lot 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "968f685642555d2f7e202c48b8b11de80569e9bfea817f7f12d7c61aac62d4e6" "checksum parking_lot 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "dbc5847584161f273e69edc63c1a86254a22f570a0b5dd87aa6f9773f6f7d125" "checksum parking_lot_core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fb1b97670a2ffadce7c397fb80a3d687c4f3060140b885621ef1653d0e5d5068" diff --git a/Cargo.toml b/Cargo.toml index 0173533ee60..0eec6ff7ff9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,11 @@ lazy_static = "0.2" regex = "0.1" isatty = "0.1" toml = "0.2" +serde = "0.8.0" +serde_json = "0.8.0" +hyper = { version = "0.9", default-features = false } ctrlc = { git = "https://github.com/ethcore/rust-ctrlc.git" } +json-ipc-server = { git = "https://github.com/ethcore/json-ipc-server.git" } fdlimit = { path = "util/fdlimit" } ethcore = { path = "ethcore" } ethcore-util = { path = "util" } @@ -40,12 +44,9 @@ ethcore-ipc = { path = "ipc/rpc" } ethcore-ipc-hypervisor = { path = "ipc/hypervisor" } ethcore-logger = { path = "logger" } rlp = { path = "util/rlp" } -json-ipc-server = { git = "https://github.com/ethcore/json-ipc-server.git" } +ethcore-stratum = { path = "stratum" } ethcore-dapps = { path = "dapps", optional = true } clippy = { version = "0.0.90", optional = true} -ethcore-stratum = { path = "stratum" } -serde = "0.8.0" -serde_json = "0.8.0" [target.'cfg(windows)'.dependencies] winapi = "0.2" @@ -53,14 +54,20 @@ winapi = "0.2" [target.'cfg(not(windows))'.dependencies] daemonize = "0.2" -[dependencies.hyper] -version = "0.9" -default-features = false - [features] -default = ["ui", "use-precompiled-js"] -ui = ["dapps", "ethcore-signer/ui"] -use-precompiled-js = ["ethcore-dapps/use-precompiled-js", "ethcore-signer/use-precompiled-js"] +default = ["ui-precompiled"] + +ui = [ + "dapps", + "ethcore-dapps/ui", + "ethcore-signer/ui", +] +ui-precompiled = [ + "dapps", + "ethcore-signer/ui-precompiled", + "ethcore-dapps/ui-precompiled", +] + dapps = ["ethcore-dapps"] ipc = ["ethcore/ipc", "ethsync/ipc"] jit = ["ethcore/jit"] diff --git a/dapps/Cargo.toml b/dapps/Cargo.toml index 7ca792d40ae..9c49c7e2848 100644 --- a/dapps/Cargo.toml +++ b/dapps/Cargo.toml @@ -20,17 +20,17 @@ url = "1.0" rustc-serialize = "0.3" serde = "0.8" serde_json = "0.8" -serde_macros = { version = "0.8", optional = true } -zip = { version = "0.1", default-features = false } ethabi = "0.2.2" linked-hash-map = "0.3" +parity-dapps-glue = "1.4" mime = "0.2" +serde_macros = { version = "0.8", optional = true } +zip = { version = "0.1", default-features = false } ethcore-devtools = { path = "../devtools" } ethcore-rpc = { path = "../rpc" } ethcore-util = { path = "../util" } fetch = { path = "../util/fetch" } parity-ui = { path = "./ui" } -parity-dapps-glue = { path = "./js-glue" } mime_guess = { version = "1.6.1" } clippy = { version = "0.0.90", optional = true} @@ -43,4 +43,5 @@ default = ["serde_codegen"] nightly = ["serde_macros"] dev = ["clippy", "ethcore-rpc/dev", "ethcore-util/dev"] -use-precompiled-js = ["parity-ui/use-precompiled-js"] +ui = ["parity-ui/no-precompiled-js"] +ui-precompiled = ["parity-ui/use-precompiled-js"] diff --git a/dapps/js-glue/src/js.rs b/dapps/js-glue/src/js.rs index d3593a306bb..39c33689c81 100644 --- a/dapps/js-glue/src/js.rs +++ b/dapps/js-glue/src/js.rs @@ -53,11 +53,11 @@ fn die(s: &'static str, e: T) -> ! { pub fn test(_path: &str) { } #[cfg(feature = "use-precompiled-js")] -pub fn build(_path: &str) { +pub fn build(_path: &str, _dest: &str) { } #[cfg(not(feature = "use-precompiled-js"))] -pub fn build(path: &str) { +pub fn build(path: &str, dest: &str) { let child = platform::handle_fd(&mut Command::new(platform::NPM_CMD)) .arg("install") .arg("--no-progress") @@ -70,7 +70,7 @@ pub fn build(path: &str) { .arg("run") .arg("build") .env("NODE_ENV", "production") - .env("BUILD_DEST", "build") + .env("BUILD_DEST", dest) .current_dir(path) .status() .unwrap_or_else(|e| die("Building JS code", e)); diff --git a/dapps/ui/Cargo.toml b/dapps/ui/Cargo.toml index ff88d0f8012..e71782dfaac 100644 --- a/dapps/ui/Cargo.toml +++ b/dapps/ui/Cargo.toml @@ -1,19 +1,18 @@ [package] -description = "Parity built-in dapps." +description = "Ethcore Parity UI" +homepage = "http://ethcore.io" +license = "GPL-3.0" name = "parity-ui" version = "1.4.0" -license = "GPL-3.0" authors = ["Ethcore "] -build = "build.rs" - -[features] -default = ["with-syntex"] -use-precompiled-js = ["parity-dapps-glue/use-precompiled-js"] -with-syntex = ["parity-dapps-glue/with-syntex"] [build-dependencies] -parity-dapps-glue = { path = "../js-glue" } +rustc_version = "0.1" [dependencies] -parity-dapps-glue = { path = "../js-glue" } +parity-ui-dev = { path = "../../js", optional = true } +parity-ui-precompiled = { git = "https://github.com/ethcore/js-precompiled.git", optional = true } +[features] +no-precompiled-js = ["parity-ui-dev"] +use-precompiled-js = ["parity-ui-precompiled"] diff --git a/dapps/ui/src/lib.rs b/dapps/ui/src/lib.rs index 25d336fabe9..6a69a503df2 100644 --- a/dapps/ui/src/lib.rs +++ b/dapps/ui/src/lib.rs @@ -14,9 +14,20 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -#[cfg(feature = "with-syntex")] -include!(concat!(env!("OUT_DIR"), "/lib.rs")); -#[cfg(not(feature = "with-syntex"))] -include!("lib.rs.in"); +#[cfg(feature = "parity-ui-dev")] +mod inner { + extern crate parity_ui_dev; + pub use self::parity_ui_dev::*; +} + +#[cfg(feature = "parity-ui-precompiled")] +mod inner { + extern crate parity_ui_precompiled; + + pub use self::parity_ui_precompiled::*; +} + + +pub use self::inner::*; diff --git a/js/.gitignore b/js/.gitignore index c846423fc27..f1c88563770 100644 --- a/js/.gitignore +++ b/js/.gitignore @@ -1,5 +1,6 @@ node_modules npm-debug.log +build .build .coverage .happypack diff --git a/js/Cargo.precompiled.toml b/js/Cargo.precompiled.toml new file mode 100644 index 00000000000..38e0a3b6233 --- /dev/null +++ b/js/Cargo.precompiled.toml @@ -0,0 +1,19 @@ +[package] +description = "Parity built-in dapps." +name = "parity-ui-precompiled" +version = "1.4.0" +license = "GPL-3.0" +authors = ["Ethcore "] +build = "build.rs" + +[features] +default = ["with-syntex"] +use-precompiled-js = ["parity-dapps-glue/use-precompiled-js"] +with-syntex = ["parity-dapps-glue/with-syntex"] + +[build-dependencies] +parity-dapps-glue = "1.4" + +[dependencies] +parity-dapps-glue = "1.4" + diff --git a/js/Cargo.toml b/js/Cargo.toml new file mode 100644 index 00000000000..e52bfec9e25 --- /dev/null +++ b/js/Cargo.toml @@ -0,0 +1,18 @@ +[package] +description = "Parity built-in dapps." +name = "parity-ui-dev" +version = "1.4.0" +license = "GPL-3.0" +authors = ["Ethcore "] +build = "build.rs" + +[features] +default = ["with-syntex"] +with-syntex = ["parity-dapps-glue/with-syntex"] + +[build-dependencies] +parity-dapps-glue = "1.4" + +[dependencies] +parity-dapps-glue = "1.4" + diff --git a/js/build b/js/build deleted file mode 160000 index f94a8eddb87..00000000000 --- a/js/build +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f94a8eddb8789410dda0db03d4f1d6ae42b31208 diff --git a/dapps/ui/build.rs b/js/build.rs similarity index 90% rename from dapps/ui/build.rs rename to js/build.rs index 395f513bd3b..82bf1ac93f3 100644 --- a/dapps/ui/build.rs +++ b/js/build.rs @@ -17,6 +17,6 @@ extern crate parity_dapps_glue; fn main() { - parity_dapps_glue::js::build(concat!(env!("CARGO_MANIFEST_DIR"), "/../../js")); + parity_dapps_glue::js::build(env!("CARGO_MANIFEST_DIR"), "build"); parity_dapps_glue::generate(); } diff --git a/js/scripts/release.sh b/js/scripts/release.sh index 05dc1d7840b..bff5ea7d9ea 100755 --- a/js/scripts/release.sh +++ b/js/scripts/release.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -e # change into the build directory pushd `dirname $0` @@ -7,6 +8,16 @@ cd ../.build # variables UTCDATE=`date -u "+%Y%m%d-%H%M%S"` +# Create proper directory structure +mkdir -p build +mv * build || true +mkdir -p src + +# Copy rust files +cp ../Cargo.precompiled.toml Cargo.toml +cp ../build.rs . +cp ../src/lib.rs* ./src/ + # init git rm -rf ./.git git init diff --git a/js/scripts/update-precompiled.sh b/js/scripts/update-precompiled.sh index 85548cc146e..0b9461bf0b1 100755 --- a/js/scripts/update-precompiled.sh +++ b/js/scripts/update-precompiled.sh @@ -1,19 +1,11 @@ #!/bin/bash +set -e - -# change into the submodule build directory +# change into main dir pushd `dirname $0` -cd ../build - -if [ -z "$1" ]; then - popd - echo "Usage: $0 " - exit 1 -fi +cd ../../ -git fetch -git fetch origin $1 -git merge $1 -X theirs +cargo update -p parity-ui-precompiled popd exit 0 diff --git a/js/src/lib.rs b/js/src/lib.rs new file mode 100644 index 00000000000..25d336fabe9 --- /dev/null +++ b/js/src/lib.rs @@ -0,0 +1,22 @@ +// 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 . + +#[cfg(feature = "with-syntex")] +include!(concat!(env!("OUT_DIR"), "/lib.rs")); + +#[cfg(not(feature = "with-syntex"))] +include!("lib.rs.in"); + diff --git a/dapps/ui/src/lib.rs.in b/js/src/lib.rs.in similarity index 88% rename from dapps/ui/src/lib.rs.in rename to js/src/lib.rs.in index 319d17ed3f7..b3f09556a2b 100644 --- a/dapps/ui/src/lib.rs.in +++ b/js/src/lib.rs.in @@ -20,7 +20,7 @@ use std::collections::HashMap; use parity_dapps_glue::{WebApp, File, Info}; #[derive(WebAppFiles)] -#[webapp(path = "../../../js/build")] +#[webapp(path = "../build")] pub struct App { pub files: HashMap<&'static str, File>, } @@ -43,7 +43,7 @@ impl WebApp for App { name: "Parity UI", version: env!("CARGO_PKG_VERSION"), author: "Ethcore ", - description: "New UI for Parity. (Experimental)", + description: "New UI for Parity.", icon_url: "icon.png", } } @@ -51,5 +51,5 @@ impl WebApp for App { #[test] fn test_js() { - parity_dapps_glue::js::build(concat!(env!("CARGO_MANIFEST_DIR"), "/../../js")); + parity_dapps_glue::js::build(env!("CARGO_MANIFEST_DIR")); } diff --git a/signer/Cargo.toml b/signer/Cargo.toml index 892b5009ced..b8a7c5ce454 100644 --- a/signer/Cargo.toml +++ b/signer/Cargo.toml @@ -15,18 +15,17 @@ rand = "0.3.14" jsonrpc-core = "3.0" log = "0.3" env_logger = "0.3" +parity-dapps-glue = { version = "1.4", optional = true } ws = { git = "https://github.com/ethcore/ws-rs.git", branch = "mio-upstream-stable" } ethcore-util = { path = "../util" } ethcore-io = { path = "../util/io" } ethcore-rpc = { path = "../rpc" } ethcore-devtools = { path = "../devtools" } -parity-dapps-glue = { path = "../dapps/js-glue", version = "1.4", optional = true} -parity-ui = { path = "../dapps/ui", version = "1.4", optional = true} +parity-ui = { path = "../dapps/ui", version = "1.4", optional = true } clippy = { version = "0.0.90", optional = true} [features] dev = ["clippy"] -ui = ["parity-dapps-glue", "parity-ui"] -use-precompiled-js = ["parity-ui/use-precompiled-js"] - +ui = ["parity-dapps-glue", "parity-ui", "parity-ui/no-precompiled-js"] +ui-precompiled = ["parity-dapps-glue", "parity-ui", "parity-ui/use-precompiled-js"] diff --git a/signer/src/ws_server/session.rs b/signer/src/ws_server/session.rs index 2ff2bc10f37..b99ef48ef1a 100644 --- a/signer/src/ws_server/session.rs +++ b/signer/src/ws_server/session.rs @@ -24,7 +24,7 @@ use std::str::FromStr; use jsonrpc_core::IoHandler; use util::{H256, Mutex, version}; -#[cfg(feature = "ui")] +#[cfg(feature = "parity-ui")] mod ui { extern crate parity_ui as ui; extern crate parity_dapps_glue as dapps; @@ -46,7 +46,7 @@ mod ui { } } } -#[cfg(not(feature = "ui"))] +#[cfg(not(feature = "parity-ui"))] mod ui { pub struct File { pub content: &'static [u8],