split fce_wit_interfaces

This commit is contained in:
vms 2020-06-06 00:13:05 +03:00
parent 2bbbb9323d
commit bb2bbcf35e
21 changed files with 72 additions and 42 deletions

27
Cargo.lock generated
View File

@ -373,17 +373,15 @@ dependencies = [
"wasmer-runtime", "wasmer-runtime",
"wasmer-runtime-core", "wasmer-runtime-core",
"wasmer-wasi", "wasmer-wasi",
"wit_parser",
] ]
[[package]] [[package]]
name = "fce_wit_interfaces" name = "fce_wit_interfaces"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"anyhow",
"multimap", "multimap",
"walrus",
"wasmer-interface-types", "wasmer-interface-types",
"wasmer-runtime-core",
] ]
[[package]] [[package]]
@ -516,6 +514,7 @@ name = "ipfs_node"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"fce", "fce",
"toml",
] ]
[[package]] [[package]]
@ -936,6 +935,15 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "toml"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "typenum" name = "typenum"
version = "1.12.0" version = "1.12.0"
@ -1229,5 +1237,16 @@ dependencies = [
"clap", "clap",
"exitfailure", "exitfailure",
"failure", "failure",
"fce_wit_interfaces", "wit_parser",
]
[[package]]
name = "wit_parser"
version = "0.1.0"
dependencies = [
"anyhow",
"fce_wit_interfaces",
"walrus",
"wasmer-interface-types",
"wasmer-runtime-core",
] ]

View File

@ -1,6 +1,7 @@
[workspace] [workspace]
members = [ members = [
"crates/fce_wit_interfaces", "crates/fce_wit_interfaces",
"crates/wit_parser",
"examples/ipfs_node", "examples/ipfs_node",
"examples/ipfs_node/wasm/ipfs_node", "examples/ipfs_node/wasm/ipfs_node",
"examples/ipfs_node/wasm/ipfs_rpc", "examples/ipfs_node/wasm/ipfs_rpc",

View File

@ -9,9 +9,5 @@ name = "fce_wit_interfaces"
path = "src/lib.rs" path = "src/lib.rs"
[dependencies] [dependencies]
walrus = "0.17.0"
wasmer-core = { package = "wasmer-runtime-core", version = "0.17.0", features = ["dynamicfunc-fat-closures"] }
wasmer-wit = { package = "wasmer-interface-types", git = "https://github.com/fluencelabs/interface-types", branch = "master"} wasmer-wit = { package = "wasmer-interface-types", git = "https://github.com/fluencelabs/interface-types", branch = "master"}
multimap = "0.8.1" multimap = "0.8.1"
anyhow = "1.0.31"

View File

@ -1,21 +0,0 @@
/*
* Copyright 2020 Fluence Labs Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
mod errors;
mod fce_wit_interfaces;
pub use fce_wit_interfaces::*;
pub use errors::*;

View File

@ -24,8 +24,8 @@
unreachable_patterns unreachable_patterns
)] )]
mod interfaces; mod errors;
mod wit_parser; mod fce_wit_interfaces;
pub use crate::wit_parser::*; pub use errors::*;
pub use crate::interfaces::*; pub use fce_wit_interfaces::*;

View File

@ -0,0 +1,17 @@
[package]
name = "wit_parser"
version = "0.1.0"
authors = ["Fluence Labs"]
edition = "2018"
[lib]
name = "wit_parser"
path = "src/lib.rs"
[dependencies]
walrus = "0.17.0"
wasmer-core = { package = "wasmer-runtime-core", version = "0.17.0"}
wasmer-wit = { package = "wasmer-interface-types", git = "https://github.com/fluencelabs/interface-types", branch = "master" }
fce_wit_interfaces = { path = "../fce_wit_interfaces" }
anyhow = "1.0.31"

View File

@ -16,8 +16,8 @@
use super::custom::WIT_SECTION_NAME; use super::custom::WIT_SECTION_NAME;
use super::errors::WITParserError; use super::errors::WITParserError;
use crate::interfaces::FCEWITInterfaces;
use fce_wit_interfaces::FCEWITInterfaces;
use walrus::{IdsToIndices, ModuleConfig}; use walrus::{IdsToIndices, ModuleConfig};
use wasmer_wit::ast::Interfaces; use wasmer_wit::ast::Interfaces;
use wasmer_core::Module as WasmerModule; use wasmer_core::Module as WasmerModule;

View File

@ -13,12 +13,22 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#![warn(rust_2018_idioms)]
#![deny(
dead_code,
nonstandard_style,
unused_imports,
unused_mut,
unused_variables,
unused_unsafe,
unreachable_patterns
)]
mod custom; mod custom;
mod deleter;
mod embedder;
mod errors; mod errors;
mod extractor; mod extractor;
mod embedder;
mod deleter;
pub use errors::WITParserError; pub use errors::WITParserError;

View File

@ -6,3 +6,4 @@ edition = "2018"
[dependencies] [dependencies]
fce = { path = "../../fce" } fce = { path = "../../fce" }
toml = "0.5.6"

View File

@ -0,0 +1,6 @@
[ipfs_node]
[imports]
ipfs = "/usr/bin/ipfs"
[wasi]
preopened_dir = ["/tmp"]

View File

@ -6,6 +6,7 @@ edition = "2018"
[dependencies] [dependencies]
fce_wit_interfaces = { path = "../crates/fce_wit_interfaces" } fce_wit_interfaces = { path = "../crates/fce_wit_interfaces" }
wit_parser = { path = "../crates/wit_parser" }
wasmer-runtime = "0.17.0" wasmer-runtime = "0.17.0"
# dynamicfunc-fat-closures allows using state inside DynamicFunc # dynamicfunc-fat-closures allows using state inside DynamicFunc

View File

@ -14,8 +14,8 @@
* limitations under the License. * limitations under the License.
*/ */
use fce_wit_interfaces::WITParserError;
use fce_wit_interfaces::FCEWITInterfacesError; use fce_wit_interfaces::FCEWITInterfacesError;
use wit_parser::WITParserError;
use wasmer_wit::errors::InstructionError; use wasmer_wit::errors::InstructionError;
use wasmer_runtime::error::{ use wasmer_runtime::error::{

View File

@ -17,12 +17,12 @@
use super::wit_prelude::*; use super::wit_prelude::*;
use super::{IType, IValue, WValue}; use super::{IType, IValue, WValue};
use fce_wit_interfaces::extract_fce_wit;
use fce_wit_interfaces::FCEWITInterfaces; use fce_wit_interfaces::FCEWITInterfaces;
use wasmer_wit::interpreter::Interpreter; use wasmer_wit::interpreter::Interpreter;
use wasmer_runtime::{compile, ImportObject}; use wasmer_runtime::{compile, ImportObject};
use wasmer_core::Instance as WasmerInstance; use wasmer_core::Instance as WasmerInstance;
use wasmer_core::import::Namespace; use wasmer_core::import::Namespace;
use wit_parser::extract_fce_wit;
use std::collections::HashMap; use std::collections::HashMap;
use std::convert::TryInto; use std::convert::TryInto;

View File

@ -5,7 +5,7 @@ authors = ["Fluence Labs"]
edition = "2018" edition = "2018"
[dependencies] [dependencies]
fce_wit_interfaces = { path = "../../crates/fce_wit_interfaces" } wit_parser = { path = "../../crates/wit_parser" }
clap = "2.33.1" clap = "2.33.1"
exitfailure = "0.5.1" exitfailure = "0.5.1"
failure = "0.1.5" failure = "0.1.5"

View File

@ -28,9 +28,9 @@ mod args;
use args::*; use args::*;
use fce_wit_interfaces::embed_text_wit; use wit_parser::embed_text_wit;
use fce_wit_interfaces::extract_text_wit; use wit_parser::extract_text_wit;
use fce_wit_interfaces::delete_wit_section; use wit_parser::delete_wit_section;
use clap::{App, AppSettings}; use clap::{App, AppSettings};
use std::path::PathBuf; use std::path::PathBuf;