Skip to content

Commit

Permalink
Removing submodule in favour of rust crate (openethereum#2756)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
tomusdrw authored and arkpar committed Oct 22, 2016
1 parent 20591e8 commit aca82fb
Show file tree
Hide file tree
Showing 18 changed files with 158 additions and 62 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 23 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 18 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand All @@ -40,27 +44,30 @@ 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"

[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"]
Expand Down
9 changes: 5 additions & 4 deletions dapps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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"]
6 changes: 3 additions & 3 deletions dapps/js-glue/src/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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));
Expand Down
19 changes: 9 additions & 10 deletions dapps/ui/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
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"]
19 changes: 15 additions & 4 deletions dapps/ui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 change: 1 addition & 0 deletions js/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
npm-debug.log
build
.build
.coverage
.happypack
19 changes: 19 additions & 0 deletions js/Cargo.precompiled.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
description = "Parity built-in dapps."
name = "parity-ui-precompiled"
version = "1.4.0"
license = "GPL-3.0"
authors = ["Ethcore <[email protected]>"]
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 changes: 18 additions & 0 deletions js/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
description = "Parity built-in dapps."
name = "parity-ui-dev"
version = "1.4.0"
license = "GPL-3.0"
authors = ["Ethcore <[email protected]>"]
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 change: 0 additions & 1 deletion js/build
Submodule build deleted from f94a8e
2 changes: 1 addition & 1 deletion dapps/ui/build.rs → js/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
11 changes: 11 additions & 0 deletions js/scripts/release.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -e

# change into the build directory
pushd `dirname $0`
Expand All @@ -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
Expand Down
16 changes: 4 additions & 12 deletions js/scripts/update-precompiled.sh
Original file line number Diff line number Diff line change
@@ -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 <sha-commit>"
exit 1
fi
cd ../../

git fetch
git fetch origin $1
git merge $1 -X theirs
cargo update -p parity-ui-precompiled

popd
exit 0
22 changes: 22 additions & 0 deletions js/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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");

6 changes: 3 additions & 3 deletions dapps/ui/src/lib.rs.in → js/src/lib.rs.in
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
}
Expand All @@ -43,13 +43,13 @@ impl WebApp for App {
name: "Parity UI",
version: env!("CARGO_PKG_VERSION"),
author: "Ethcore <[email protected]>",
description: "New UI for Parity. (Experimental)",
description: "New UI for Parity.",
icon_url: "icon.png",
}
}
}

#[test]
fn test_js() {
parity_dapps_glue::js::build(concat!(env!("CARGO_MANIFEST_DIR"), "/../../js"));
parity_dapps_glue::js::build(env!("CARGO_MANIFEST_DIR"));
}
Loading

0 comments on commit aca82fb

Please sign in to comment.