misc improvements

This commit is contained in:
vms 2021-03-28 18:02:36 +03:00
parent fbd021e3e2
commit 0ed7b3e6b8
9 changed files with 23 additions and 14 deletions

View File

@ -18,9 +18,12 @@ all-features = true
path = "src/lib.rs"
[dependencies]
fluence-sdk-macro = { path = "crates/macro", version = "=0.5.0" }
fluence-sdk-macro = { path = "crates/fce-macro", version = "=0.5.0" }
fluence-sdk-test-macro = { path = "crates/fce-test-macro", version = "=0.5.0", optional = true }
fluence-sdk-main = { path = "crates/main", version = "=0.5.0" }
fluence-app-service= { version = "0.5.2", features = ["raw-module-api"], optional = true }
[features]
# Print some internal logs by log_utf8_string
debug = ["fluence-sdk-main/debug"]
@ -28,10 +31,13 @@ debug = ["fluence-sdk-main/debug"]
# Enable logger (this will cause log_utf8_string to appear in imports)
logger = ["fluence-sdk-main/logger"]
# Enable the fce-test features (it'll bring fluence-app-service as a dependency)
fce-test = ["fluence-sdk-test-macro", "fluence-app-service"]
[workspace]
members = [
"crates/macro",
"crates/macro-test",
"crates/fce-macro",
"crates/fce-test-macro",
"crates/main",
"crates/wit",
]

View File

@ -1,10 +1,9 @@
[package]
name = "fluence-sdk-macro-test"
version = "0.4.2" # remember to update html_root_url
name = "fluence-sdk-test-macro"
version = "0.5.0" # remember to update html_root_url
edition = "2018"
description = "Definition of the `#[fce_test]` macro"
documentation = "https://docs.rs/fluence/fluence-sdk-macro"
repository = "https://github.com/fluencelabs/rust-sdk/crates/macro"
repository = "https://github.com/fluencelabs/rust-sdk/crates/macro-test"
authors = ["Fluence Labs"]
keywords = ["fluence", "sdk", "webassembly", "procedural_macros"]
categories = ["api-bindings", "wasm"]
@ -17,12 +16,9 @@ all-features = true
proc-macro = true
[dependencies]
fluence-faas = "0.5.2"
quote = "1.0.9"
proc-macro2 = "1.0.24"
serde = { version = "=1.0.118", features = ["derive"] }
serde_json = "1.0.56"
syn = { version = '1.0.65', features = ['full'] }
uuid = { version = "0.8.2", features = ["v4"] }
#fluence-sdk-wit = { path = "../wit", version = "=0.4.2" }

View File

@ -56,11 +56,11 @@ fn generate_fce_ctor(config_path: &str) -> TokenStream {
let tmp_file_path = new_ident(&tmp_file_path);
quote! {
let mut __fce__generated_fce_config = fluence_faas::TomlAppServiceConfig::load(#config_path)
let mut __fce__generated_fce_config = fluence::internal::test::TomlAppServiceConfig::load(#config_path)
.unwrap_or_else(|e| panic!("app service located at `{}` config can't be loaded: {}", #config_path, e));
__fce__generated_fce_config.service_base_dir = Some(#tmp_file_path);
let fce = fce_app_service::AppService::new_with_empty_facade(__fce__generated_fce_config, #service_id, std::collections::HashMap::new())
let fce = fluence::internal::test::AppService::new_with_empty_facade(__fce__generated_fce_config, #service_id, std::collections::HashMap::new())
.unwrap_or_else(|e| panic!("app service can't be created: {}", e));
}
}

View File

@ -53,7 +53,6 @@ use proc_macro::TokenStream;
/// assert_eq!(&service_result, "Hi, name!");
/// }
///```
#[proc_macro_attribute]
pub fn fce_test(attrs: TokenStream, input: TokenStream) -> TokenStream {
let func_input = syn::parse_macro_input!(input as syn::ItemFn);

View File

@ -18,7 +18,7 @@ path = "src/lib.rs"
crate-type = ["rlib"]
[dependencies]
fluence-sdk-macro = { path = "../macro", version = "=0.5.0" }
fluence-sdk-macro = { path = "../fce-macro", version = "=0.5.0" }
log = { version = "0.4.8", features = ["std"] }
serde = "=1.0.118"

View File

@ -68,6 +68,8 @@
#![warn(rust_2018_idioms)]
pub use fluence_sdk_macro::fce;
#[cfg(feature = "fce-test")]
pub use fluence_sdk_test_macro::fce_test;
pub use fluence_sdk_main::CallParameters;
pub use fluence_sdk_main::SecurityTetraplet;
@ -92,4 +94,10 @@ pub mod internal {
pub use fluence_sdk_main::get_result_size;
pub use fluence_sdk_main::set_result_ptr;
pub use fluence_sdk_main::set_result_size;
#[cfg(feature = "fce-test")]
pub mod test {
pub use fluence_app_service::AppService;
pub use fluence_app_service::AppServiceConfig;
}
}