rename crates and adjust dependecies

This commit is contained in:
vms 2020-07-28 19:14:53 +03:00
parent 76a9c83541
commit ab2b075748
16 changed files with 230 additions and 84 deletions

224
Cargo.lock generated
View File

@ -406,16 +406,42 @@ name = "fce"
version = "0.1.0"
dependencies = [
"fce-wit-interfaces",
"fce-wit-parser",
"log",
"multimap",
"parity-wasm",
"pwasm-utils",
"serde",
"wasmer-interface-types-fl",
"wasmer-runtime",
"wasmer-runtime-core",
"wasmer-wasi",
"wit-parser",
"wasmer-runtime-core-fl",
"wasmer-runtime-fl",
"wasmer-wasi-fl",
]
[[package]]
name = "fce-cli"
version = "0.1.1"
dependencies = [
"anyhow",
"clap",
"exitfailure",
"fce-wit-generator",
"fce-wit-parser",
"serde",
"serde_json",
]
[[package]]
name = "fce-wit-generator"
version = "0.1.1"
dependencies = [
"fce-wit-parser",
"fluence-sdk-wit 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"once_cell",
"serde",
"serde_json",
"walrus",
"wasmer-interface-types-fl",
]
[[package]]
@ -427,22 +453,20 @@ dependencies = [
]
[[package]]
name = "fce_cli"
version = "0.1.0"
name = "fce-wit-parser"
version = "0.1.2"
dependencies = [
"clap",
"exitfailure",
"failure",
"serde",
"serde_json",
"wit-generator",
"wit-parser",
"anyhow",
"fce-wit-interfaces",
"walrus",
"wasmer-interface-types-fl",
"wasmer-runtime-core-fl",
]
[[package]]
name = "fluence"
version = "0.2.0"
source = "git+https://github.com/fluencelabs/rust-sdk#4683526e16d6db8c93ce95dda724652dc657d35f"
source = "git+https://github.com/fluencelabs/rust-sdk#7018a64c29278a673e543867e691f74b3d652288"
dependencies = [
"fluence-sdk-macro",
"fluence-sdk-main",
@ -460,14 +484,14 @@ dependencies = [
"serde_json",
"toml",
"wasmer-runtime",
"wasmer-runtime-core",
"wasmer-runtime-core 0.17.0",
"wasmer-wasi",
]
[[package]]
name = "fluence-sdk-macro"
version = "0.2.0"
source = "git+https://github.com/fluencelabs/rust-sdk#4683526e16d6db8c93ce95dda724652dc657d35f"
source = "git+https://github.com/fluencelabs/rust-sdk#7018a64c29278a673e543867e691f74b3d652288"
dependencies = [
"fluence-sdk-wit 0.2.0 (git+https://github.com/fluencelabs/rust-sdk)",
]
@ -475,7 +499,7 @@ dependencies = [
[[package]]
name = "fluence-sdk-main"
version = "0.2.0"
source = "git+https://github.com/fluencelabs/rust-sdk#4683526e16d6db8c93ce95dda724652dc657d35f"
source = "git+https://github.com/fluencelabs/rust-sdk#7018a64c29278a673e543867e691f74b3d652288"
dependencies = [
"log",
]
@ -483,7 +507,7 @@ dependencies = [
[[package]]
name = "fluence-sdk-wit"
version = "0.2.0"
source = "git+https://github.com/fluencelabs/rust-sdk#4683526e16d6db8c93ce95dda724652dc657d35f"
source = "git+https://github.com/fluencelabs/rust-sdk#7018a64c29278a673e543867e691f74b3d652288"
dependencies = [
"proc-macro2",
"quote",
@ -1402,8 +1426,34 @@ dependencies = [
"target-lexicon",
"wasmer-clif-fork-frontend",
"wasmer-clif-fork-wasm",
"wasmer-runtime-core",
"wasmer-win-exception-handler",
"wasmer-runtime-core 0.17.0",
"wasmer-win-exception-handler 0.17.0",
"wasmparser 0.51.4",
"winapi",
]
[[package]]
name = "wasmer-clif-backend-fl"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "532fb6cef712d9cd1ec68f9fc561447df33313393926f9bdb91fc3d67eed918f"
dependencies = [
"byteorder",
"cranelift-codegen",
"cranelift-entity",
"cranelift-native",
"libc",
"nix",
"rayon",
"serde",
"serde-bench",
"serde_bytes",
"serde_derive",
"target-lexicon",
"wasmer-clif-fork-frontend",
"wasmer-clif-fork-wasm",
"wasmer-runtime-core-fl",
"wasmer-win-exception-handler 0.17.1",
"wasmparser 0.51.4",
"winapi",
]
@ -1457,7 +1507,7 @@ dependencies = [
"serde",
"serde_derive",
"wasmer-clif-backend",
"wasmer-runtime-core",
"wasmer-runtime-core 0.17.0",
]
[[package]]
@ -1488,6 +1538,78 @@ dependencies = [
"winapi",
]
[[package]]
name = "wasmer-runtime-core"
version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "740161245998752cf1a567e860fd6355df0336fedca6be1940ec7aaa59643220"
dependencies = [
"bincode",
"blake3",
"cc",
"digest 0.8.1",
"errno",
"hex",
"indexmap",
"lazy_static",
"libc",
"nix",
"page_size",
"parking_lot",
"rustc_version",
"serde",
"serde-bench",
"serde_bytes",
"serde_derive",
"smallvec",
"target-lexicon",
"wasmparser 0.51.4",
"winapi",
]
[[package]]
name = "wasmer-runtime-core-fl"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4630ff544a2d7f76938bcf82ae217e0bd5c9ee078c653459d4f117c2045d315"
dependencies = [
"bincode",
"blake3",
"cc",
"digest 0.8.1",
"errno",
"hex",
"indexmap",
"lazy_static",
"libc",
"nix",
"page_size",
"parking_lot",
"rustc_version",
"serde",
"serde-bench",
"serde_bytes",
"serde_derive",
"smallvec",
"target-lexicon",
"wasmparser 0.51.4",
"winapi",
]
[[package]]
name = "wasmer-runtime-fl"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e855c8942f998a6938e43c1d0bb11b76a60b1c8341e08db36cc36b97b58bb1e9"
dependencies = [
"lazy_static",
"memmap",
"serde",
"serde_derive",
"wasmer-clif-backend-fl",
"wasmer-runtime-core-fl",
]
[[package]]
name = "wasmer-wasi"
version = "0.17.0"
@ -1503,7 +1625,27 @@ dependencies = [
"thiserror",
"time",
"typetag",
"wasmer-runtime-core",
"wasmer-runtime-core 0.17.0",
"winapi",
]
[[package]]
name = "wasmer-wasi-fl"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e2493c1ef951a7a1704ecfd39abbbbb2346bf3768d761ef64ed53249a32b181"
dependencies = [
"bincode",
"byteorder",
"generational-arena",
"getrandom",
"libc",
"log",
"serde",
"thiserror",
"time",
"typetag",
"wasmer-runtime-core-fl",
"winapi",
]
@ -1514,7 +1656,19 @@ source = "git+https://github.com/fluencelabs/wasmer?branch=fluence#cdc9921023be7
dependencies = [
"cc",
"libc",
"wasmer-runtime-core",
"wasmer-runtime-core 0.17.0",
"winapi",
]
[[package]]
name = "wasmer-win-exception-handler"
version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cd39f3b2bd7964b28ea6f944a7eaa445cfbc91c4f2695d188103f2689bb37d9"
dependencies = [
"cc",
"libc",
"wasmer-runtime-core 0.17.1",
"winapi",
]
@ -1569,27 +1723,3 @@ name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "wit-generator"
version = "0.1.0"
dependencies = [
"fluence-sdk-wit 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"once_cell",
"serde",
"serde_json",
"walrus",
"wasmer-interface-types-fl",
"wit-parser",
]
[[package]]
name = "wit-parser"
version = "0.1.0"
dependencies = [
"anyhow",
"fce-wit-interfaces",
"walrus",
"wasmer-interface-types-fl",
"wasmer-runtime-core",
]

View File

@ -1,7 +1,7 @@
[workspace]
members = [
"crates/fce-wit-interfaces",
"crates/wit-generator",
"crates/wit-interfaces",
"crates/wit-parser",
"engine",
"examples/greeting",

View File

@ -1,12 +1,17 @@
[package]
name = "wit-generator"
description = "Fluence Wasm interface type generator"
version = "0.1.0"
name = "fce-wit-generator"
description = "Fluence FCE interface type helper crate"
version = "0.1.1"
authors = ["Fluence Labs"]
license = "Apache-2.0"
edition = "2018"
[lib]
name = "fce_wit_generator"
path = "src/lib.rs"
[dependencies]
wit-parser = { path = "../wit-parser" }
fce-wit-parser = { path = "../wit-parser", version = "0.1.1"}
walrus = "0.17.0"
fluence-sdk-wit = "0.2.0"
once_cell = "1.4.0"

View File

@ -31,8 +31,8 @@ pub fn embed_wit(path: std::path::PathBuf) -> Result<()> {
let module_ast = wasm_ast_extractor(&wasm_module)?;
let interfaces = generate_interfaces(&module_ast)?;
let wasm_module = wit_parser::delete_wit_section(wasm_module);
let mut wasm_module = wit_parser::embed_wit(wasm_module, &interfaces);
let wasm_module = fce_wit_parser::delete_wit_section(wasm_module);
let mut wasm_module = fce_wit_parser::embed_wit(wasm_module, &interfaces);
wasm_module.emit_wasm_file(path).map_err(|e| {
WITGeneratorError::IOError(format!("resulted Wasm file can't be emitted: {:?}", e))

View File

@ -1,18 +1,19 @@
[package]
name = "wit-parser"
version = "0.1.0"
name = "fce-wit-parser"
description = "Fluence FCE interface type helper crate"
version = "0.1.2"
authors = ["Fluence Labs"]
license = "Apache-2.0"
edition = "2018"
[lib]
name = "wit_parser"
name = "fce_wit_parser"
path = "src/lib.rs"
[dependencies]
walrus = "0.17.0"
wasmer-core = { package = "wasmer-runtime-core", git = "https://github.com/fluencelabs/wasmer", branch = "fluence" }
wasmer-core = { package = "wasmer-runtime-core-fl", version = "0.17.0"}
wasmer-wit = { package = "wasmer-interface-types-fl", version = "0.17.0"}
fce-wit-interfaces = { path = "../fce-wit-interfaces", version = "0.1.0" }
fce-wit-interfaces = { path = "../wit-interfaces", version = "0.1.0" }
anyhow = "1.0.31"

View File

@ -1,22 +1,27 @@
[package]
name = "fce"
description = "Fluence Compute Engine"
version = "0.1.0"
authors = ["Fluence Labs"]
license = "Apache-2.0"
edition = "2018"
[dependencies]
fce-wit-interfaces = { path = "../crates/fce-wit-interfaces", version = "0.1.0" }
wit-parser = { path = "../crates/wit-parser", version = "0.1.0" }
[lib]
name = "fce"
path = "src/lib.rs"
wasmer-runtime = { git = "https://github.com/fluencelabs/wasmer", branch = "fluence" }
[dependencies]
fce-wit-interfaces = { path = "../crates/wit-interfaces", version = "0.1.0" }
fce-wit-parser = { path = "../crates/wit-parser", version = "0.1.2" }
wasmer-runtime = { package = "wasmer-runtime-fl", version = "0.17.0" }
# dynamicfunc-fat-closures allows using state inside DynamicFunc
wasmer-core = { package = "wasmer-runtime-core", git = "http://github.com/fluencelabs/wasmer", branch = "fluence", features = ["dynamicfunc-fat-closures"] }
wasmer-core = { package = "wasmer-runtime-core-fl", version = "0.17.0", features = ["dynamicfunc-fat-closures"] }
wasmer-wit = { package = "wasmer-interface-types-fl", version = "0.17.0", features = ["serde"] }
wasmer-wasi = { git = "https://github.com/fluencelabs/wasmer", branch = "fluence" }
wasmer-wasi = { package = "wasmer-wasi-fl", version = "0.17.0" }
serde = { version = "1.0.114", default-features = false, features = [ "derive" ] }
multimap = "0.8.1"
parity-wasm = "0.41.0"
pwasm-utils = "0.12.0"
log = "0.4.8"

View File

@ -15,7 +15,7 @@
*/
use fce_wit_interfaces::FCEWITInterfacesError;
use wit_parser::WITParserError;
use fce_wit_parser::WITParserError;
use wasmer_wit::errors::InstructionError;
use wasmer_runtime::error::{

View File

@ -25,7 +25,7 @@ use wasmer_core::import::Namespace;
use wasmer_runtime::compile;
use wasmer_runtime::ImportObject;
use wasmer_wit::interpreter::Interpreter;
use wit_parser::extract_wit;
use fce_wit_parser::extract_wit;
use std::collections::HashMap;
use std::convert::TryInto;

View File

@ -1,7 +1,10 @@
[package]
name = "fce_cli"
version = "0.1.0"
name = "fce-cli"
description = "Fluence FCE command line tool for develop services for the Fluence network"
version = "0.1.1"
authors = ["Fluence Labs"]
repository = "https://github.com/fluencelabs/fce/tools/cli"
license = "Apache-2.0"
edition = "2018"
[[bin]]
@ -9,11 +12,11 @@ name = "fce"
path = "src/main.rs"
[dependencies]
wit-generator = { path = "../../crates/wit-generator" }
wit-parser = { path = "../../crates/wit-parser" }
fce-wit-generator = { path = "../../crates/wit-generator", version = "0.1.1"}
fce-wit-parser = { path = "../../crates/wit-parser", version = "0.1.2" }
anyhow = "1.0.31"
clap = "2.33.1"
exitfailure = "0.5.1"
failure = "0.1.5"
serde = "1.0.114"
serde_json = "1.0.56"

View File

@ -66,14 +66,13 @@ pub(crate) fn build(trailing_args: Vec<&str>) -> Result<()> {
}
if wasms.is_empty() {
return Err(CLIError::WasmCompilationError(
"Compilation failed: no .wasm files was generated".to_string(),
));
// it is possible to build a object file without Wasm artifacts
return Ok(());
}
for wasm in wasms {
let wasm_path = std::path::PathBuf::from(wasm);
wit_generator::embed_wit(wasm_path)?;
fce_wit_generator::embed_wit(wasm_path)?;
}
Ok(())

View File

@ -14,8 +14,8 @@
* limitations under the License.
*/
use wit_generator::WITGeneratorError;
use wit_parser::WITParserError;
use fce_wit_generator::WITGeneratorError;
use fce_wit_parser::WITParserError;
use std::io::Error as StdIOError;
use std::error::Error;

View File

@ -31,11 +31,12 @@ mod errors;
pub(crate) type Result<T> = std::result::Result<T, crate::errors::CLIError>;
pub fn main() -> Result<()> {
let app = clap::App::new("CLI tool for embedding WIT to provided Wasm file")
pub fn main() -> std::result::Result<(), anyhow::Error> {
let app = clap::App::new("CLI tool for dealing with Wasm modules for the Fluence network")
.version(args::VERSION)
.author(args::AUTHORS)
.about(args::DESCRIPTION)
.setting(clap::AppSettings::ArgRequiredElseHelp)
.subcommand(args::build())
.subcommand(args::show_wit());
let arg_matches = app.get_matches();
@ -44,17 +45,19 @@ pub fn main() -> Result<()> {
("build", Some(args)) => {
let trailing_args: Vec<&str> = args.values_of("optional").unwrap_or_default().collect();
crate::build::build(trailing_args)
crate::build::build(trailing_args)?;
Ok(())
}
("show", Some(arg)) => {
let wasm_path = arg.value_of(args::IN_WASM_PATH).unwrap();
let wasm_path = std::path::PathBuf::from(wasm_path);
let result = wit_parser::extract_text_wit(wasm_path)?;
let result = fce_wit_parser::extract_text_wit(wasm_path)?;
println!("{}", result);
Ok(())
}
c => Err(crate::errors::CLIError::NoSuchCommand(c.0.to_string())),
c => Err(crate::errors::CLIError::NoSuchCommand(c.0.to_string()).into()),
}
}