Removing submodule in favour of rust crate (#2756)

* Removing submodule

* Fixing UI dependency structure.

* Merging RS and JS package

* Updating release script to push also rs files

* fix merge gone wrong

* Fixing compilation
This commit is contained in:
Tomasz Drwięga 2016-10-22 20:07:12 +02:00 committed by Arkadiy Paronyan
parent 20591e882e
commit aca82fb84b
18 changed files with 158 additions and 62 deletions

3
.gitmodules vendored
View File

@ -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

26
Cargo.lock generated
View File

@ -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)" = "<none>"
"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"

View File

@ -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"]

View File

@ -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"]

View File

@ -53,11 +53,11 @@ fn die<T : fmt::Debug>(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));

View File

@ -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 <admin@ethcore.io>"]
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"]

View File

@ -14,9 +14,20 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
#[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::*;

1
js/.gitignore vendored
View File

@ -1,5 +1,6 @@
node_modules
npm-debug.log
build
.build
.coverage
.happypack

19
js/Cargo.precompiled.toml Normal file
View File

@ -0,0 +1,19 @@
[package]
description = "Parity built-in dapps."
name = "parity-ui-precompiled"
version = "1.4.0"
license = "GPL-3.0"
authors = ["Ethcore <admin@ethcore.io>"]
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"

18
js/Cargo.toml Normal file
View File

@ -0,0 +1,18 @@
[package]
description = "Parity built-in dapps."
name = "parity-ui-dev"
version = "1.4.0"
license = "GPL-3.0"
authors = ["Ethcore <admin@ethcore.io>"]
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"

@ -1 +0,0 @@
Subproject commit f94a8eddb8789410dda0db03d4f1d6ae42b31208

View File

@ -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();
}

View File

@ -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

View File

@ -1,19 +1,11 @@
#!/bin/bash
set -e
# change into the submodule build directory
# change into main dir
pushd `dirname $0`
cd ../build
cd ../../
if [ -z "$1" ]; then
popd
echo "Usage: $0 <sha-commit>"
exit 1
fi
git fetch
git fetch origin $1
git merge $1 -X theirs
cargo update -p parity-ui-precompiled
popd
exit 0

22
js/src/lib.rs Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
#[cfg(feature = "with-syntex")]
include!(concat!(env!("OUT_DIR"), "/lib.rs"));
#[cfg(not(feature = "with-syntex"))]
include!("lib.rs.in");

View File

@ -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 <admin@ethcore.io>",
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"));
}

View File

@ -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 }
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"]

View File

@ -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],