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

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"

Submodule js/build deleted from f94a8eddb8

22
js/build.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/>.
extern crate parity_dapps_glue;
fn main() {
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");

55
js/src/lib.rs.in Normal file
View File

@@ -0,0 +1,55 @@
// 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/>.
extern crate parity_dapps_glue;
use std::collections::HashMap;
use parity_dapps_glue::{WebApp, File, Info};
#[derive(WebAppFiles)]
#[webapp(path = "../build")]
pub struct App {
pub files: HashMap<&'static str, File>,
}
impl Default for App {
fn default() -> App {
App {
files: Self::files(),
}
}
}
impl WebApp for App {
fn file(&self, path: &str) -> Option<&File> {
self.files.get(path)
}
fn info(&self) -> Info {
Info {
name: "Parity UI",
version: env!("CARGO_PKG_VERSION"),
author: "Ethcore <admin@ethcore.io>",
description: "New UI for Parity.",
icon_url: "icon.png",
}
}
}
#[test]
fn test_js() {
parity_dapps_glue::js::build(env!("CARGO_MANIFEST_DIR"));
}