mirror of
https://github.com/fluencelabs/marine-rs-sdk-test
synced 2024-12-04 15:20:18 +00:00
finalize
This commit is contained in:
parent
176b71b4a1
commit
1a5e28957d
@ -5,7 +5,6 @@ members = [
|
||||
"crates/fce-test-macro-impl",
|
||||
"crates/main",
|
||||
"crates/timestamp-macro",
|
||||
"crates/timestamp-macro-impl",
|
||||
"crates/wit",
|
||||
"fluence",
|
||||
"fluence-test"
|
||||
|
@ -20,7 +20,6 @@ doctest = false
|
||||
|
||||
[dependencies]
|
||||
fluence-sdk-macro = { path = "../fce-macro", version = "0.5.0" }
|
||||
fce-timestamp-macro = { path = "../timestamp-macro", version = "0.5.0" }
|
||||
|
||||
log = { version = "0.4.8", features = ["std"] }
|
||||
serde = "=1.0.118"
|
||||
|
@ -20,7 +20,7 @@ pub const MANIFEST_SECTION_NAME: &str = "__fluence_wasm_module_manifest";
|
||||
#[macro_export]
|
||||
macro_rules! module_manifest {
|
||||
($authors:expr, $version:expr, $description:expr, $repository:expr) => {
|
||||
fce_timestamp_macro::build_timestamp!();
|
||||
fluence::internal::build_timestamp!();
|
||||
|
||||
const __FCE_SDK_AUTHORS_SIZE: usize = $authors.as_bytes().len();
|
||||
const __FCE_SDK_VERSION_SIZE: usize = $version.as_bytes().len();
|
||||
|
@ -1,18 +0,0 @@
|
||||
[package]
|
||||
name = "fce-timestamp-macro-impl"
|
||||
version = "0.5.0" # remember to update html_root_url
|
||||
edition = "2018"
|
||||
description = "Implementation of the `#[build_timestamp]` macro"
|
||||
repository = "https://github.com/fluencelabs/rust-sdk/crates/timestamp-macro-impl"
|
||||
authors = ["Fluence Labs"]
|
||||
keywords = ["fluence", "sdk", "webassembly", "procedural_macros"]
|
||||
categories = ["api-bindings", "wasm"]
|
||||
license = "Apache-2.0"
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
proc-macro2 = "1.0.26"
|
||||
syn = { version = '1.0.64', features = ['full'] }
|
||||
chrono = "0.4.19"
|
@ -1,40 +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.
|
||||
*/
|
||||
|
||||
#![deny(
|
||||
dead_code,
|
||||
nonstandard_style,
|
||||
unused_imports,
|
||||
unused_mut,
|
||||
unused_variables,
|
||||
unused_unsafe,
|
||||
unreachable_patterns
|
||||
)]
|
||||
#![warn(rust_2018_idioms)]
|
||||
#![recursion_limit = "1024"]
|
||||
|
||||
use proc_macro2::TokenStream;
|
||||
|
||||
pub const FORMAT_STRING: &str = "%H:%M:%S / %Y-%m-%d";
|
||||
|
||||
pub fn build_timestamp() -> TokenStream {
|
||||
let time = chrono::Utc::now();
|
||||
let formatted_time = time.format(FORMAT_STRING);
|
||||
|
||||
let out_str = format!(r#"const __FCE_SDK_BUILD_TIME: &str = {}"#, formatted_time);
|
||||
|
||||
out_str.parse().expect("time formatting should be correct")
|
||||
}
|
@ -14,4 +14,5 @@ proc-macro = true
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
fce-timestamp-macro-impl = { path = "../timestamp-macro-impl", version = "0.5.0" }
|
||||
chrono = "0.4.19"
|
||||
quote = "1.0.9"
|
||||
|
@ -28,7 +28,12 @@
|
||||
|
||||
use proc_macro::TokenStream;
|
||||
|
||||
|
||||
#[proc_macro]
|
||||
pub fn build_timestamp(_: TokenStream) -> TokenStream {
|
||||
fce_timestamp_macro_impl::build_timestamp().into()
|
||||
let current_utc_date = chrono::Utc::now();
|
||||
let current_utc_date = current_utc_date.to_rfc3339();
|
||||
|
||||
let glue_code = quote::quote! { const __FCE_SDK_BUILD_TIME: &str = #current_utc_date; };
|
||||
glue_code.into()
|
||||
}
|
||||
|
@ -19,8 +19,10 @@ path = "src/lib.rs"
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
fluence-sdk-macro = { path = "../crates/fce-macro", version = "=0.5.0" }
|
||||
fluence-sdk-main = { path = "../crates/main", version = "=0.5.0" }
|
||||
fluence-sdk-macro = { path = "../crates/fce-macro", version = "0.5.0" }
|
||||
fluence-sdk-main = { path = "../crates/main", version = "0.5.0" }
|
||||
|
||||
fce-timestamp-macro = { path = "../crates/timestamp-macro", version = "0.5.0" }
|
||||
|
||||
[dev-dependencies]
|
||||
trybuild = "1.0"
|
||||
|
@ -94,4 +94,5 @@ 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;
|
||||
pub use fce_timestamp_macro::build_timestamp;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user