From 9041515cd9a20d064f3c6feca086e8611eb2e5f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Andr=C3=A9s=20Dorado=20Su=C3=A1rez?= Date: Mon, 19 Jun 2023 23:16:54 -0500 Subject: [PATCH] change(env): split valor crate from cli binaries --- Cargo.lock | 41 ++++++++++------------- Cargo.toml | 39 ++++++++++----------- bin/valor-run/Cargo.toml | 18 ++++++++++ {src => bin/valor-run/src}/constants.rs | 0 {src => bin/valor-run/src}/main.rs | 2 +- {src => bin/valor-run/src}/parsero/mod.rs | 0 {src => bin/valor-run/src}/plugin/mod.rs | 3 +- {src => bin/valor-run/src}/utils/mod.rs | 0 src/lib.rs | 2 +- 9 files changed, 57 insertions(+), 48 deletions(-) create mode 100644 bin/valor-run/Cargo.toml rename {src => bin/valor-run/src}/constants.rs (100%) rename {src => bin/valor-run/src}/main.rs (98%) rename {src => bin/valor-run/src}/parsero/mod.rs (100%) rename {src => bin/valor-run/src}/plugin/mod.rs (89%) rename {src => bin/valor-run/src}/utils/mod.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 4c03788..19f580a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -651,7 +651,8 @@ checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "embassy-executor" version = "0.1.1" -source = "git+https://github.com/embassy-rs/embassy#055597063f2d3f1156a9f8076c601dd300d85542" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4f2f7687ed60a799909eca1bf68b41e9f2ad03d740f0956a945ddabccc6aedb" dependencies = [ "atomic-polyfill 1.0.1", "cfg-if 1.0.0", @@ -666,7 +667,8 @@ dependencies = [ [[package]] name = "embassy-macros" version = "0.1.0" -source = "git+https://github.com/embassy-rs/embassy#055597063f2d3f1156a9f8076c601dd300d85542" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8f57fb96af50e126bb4ae0826604ac5b9f9ac1d32fb3576d552f7285bf68e67" dependencies = [ "darling 0.13.4", "proc-macro2", @@ -674,27 +676,15 @@ dependencies = [ "syn", ] -[[package]] -name = "embassy-sync" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/embassy#055597063f2d3f1156a9f8076c601dd300d85542" -dependencies = [ - "cfg-if 1.0.0", - "critical-section", - "embedded-io", - "futures-util", - "heapless", -] - [[package]] name = "embassy-time" -version = "0.1.0" -source = "git+https://github.com/embassy-rs/embassy#055597063f2d3f1156a9f8076c601dd300d85542" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd403e218939bba4a1fe4b58c6f81bf0818852bdd824147f95e6dc4ff4166ac4" dependencies = [ "atomic-polyfill 1.0.1", "cfg-if 1.0.0", "critical-section", - "embassy-sync", "embedded-hal 0.2.7", "embedded-hal-async", "futures-util", @@ -714,17 +704,17 @@ dependencies = [ [[package]] name = "embedded-hal" -version = "1.0.0-alpha.9" +version = "1.0.0-alpha.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "129b101ddfee640565f7c07b301a31d95aa21e5acef21a491c307139f5fa4c91" +checksum = "f65c4d073f5d91c66e629b216818a4c9747eeda0debedf2deda9a0a947e4e93b" [[package]] name = "embedded-hal-async" -version = "0.2.0-alpha.0" +version = "0.2.0-alpha.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608a322808d65da06715e03109c0cb69f79a5459af756fba393ab83e875d4969" +checksum = "8042370aa7af48de36d5312cda14c18ed8ca6b7ce64f5a07832fedc9dc83063f" dependencies = [ - "embedded-hal 1.0.0-alpha.9", + "embedded-hal 1.0.0-alpha.10", ] [[package]] @@ -2082,7 +2072,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" [[package]] -name = "valor_core" +name = "valor" +version = "0.6.0" + +[[package]] +name = "valor-run" version = "0.6.0" dependencies = [ "clap", @@ -2091,6 +2085,7 @@ dependencies = [ "embedded-io", "env_logger", "log", + "valor", "wasm_runtime", ] diff --git a/Cargo.toml b/Cargo.toml index 2d3493c..c879151 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,27 +1,25 @@ +[workspace] +members = [ + "bin/*", + "wasm/", +] + +[workspace.package] +authors = [ + "Daniel Olano ", + "Johan Alexis Duque Cadena ", + "Pablo Dorado ", +] +license = "GPL-3.0-or-later" + [package] -name = "valor_core" description = "Virto Async Light Open Runtime" -license = "GPL-3.0-or-later" +edition = "2021" +name = "valor" +repository = "https://github.com/virto-network/valor" version = "0.6.0" -authors = ["Daniel Olano ", "Johan Alexis Duque Cadena "] -edition = "2018" -repository = "https://github.com/valibre-org/valor" [dependencies] -clap = { version = "4.1.8", features = ["derive"] } -embassy-executor = { version = "0.1.0", git = "https://github.com/embassy-rs/embassy", features = ["log", "std", "nightly", "integrated-timers"] } -embassy-time = { version = "0.1.0", git = "https://github.com/embassy-rs/embassy", features = ["log", "std", "nightly"] } -embedded-io = { version = "0.4.0", features = ["async", "std"] } -env_logger = "0.10.0" -log = "0.4.17" -wasm_runtime = { path = "./wasm" } - -[features] - -[workspace] -members = [ - "wasm", -] # ToDo: Talk about this with @Dani # [profile.release.package.valor_web] @@ -29,9 +27,8 @@ members = [ [profile.release] lto = true -strip = true opt-level = "s" +strip = true [profile.dev] opt-level = 0 - diff --git a/bin/valor-run/Cargo.toml b/bin/valor-run/Cargo.toml new file mode 100644 index 0000000..dccaf5a --- /dev/null +++ b/bin/valor-run/Cargo.toml @@ -0,0 +1,18 @@ +[package] +description = "CLI tool for running valor modules" +edition = "2021" +name = "valor-run" +version = "0.6.0" + +[dependencies] +valor = {path = "../..", version = "0.6.0"} +wasm_runtime = {path = "../../wasm", version = "0.1.0"} + +clap = {version = "4.1.8", features = ["derive"]} +embassy-executor = {version = "0.1.0", features = ["log", "std", "nightly", "integrated-timers"]} +embassy-time = {version = "0.1.0", features = ["log", "std", "nightly"]} +embedded-io = {version = "0.4.0", features = ["async", "std"]} +env_logger = "0.10.0" +log = "0.4.17" + +[features] diff --git a/src/constants.rs b/bin/valor-run/src/constants.rs similarity index 100% rename from src/constants.rs rename to bin/valor-run/src/constants.rs diff --git a/src/main.rs b/bin/valor-run/src/main.rs similarity index 98% rename from src/main.rs rename to bin/valor-run/src/main.rs index ed1858e..fe4f592 100644 --- a/src/main.rs +++ b/bin/valor-run/src/main.rs @@ -7,7 +7,7 @@ use log::{info, warn}; use std::io::stdin; use std::thread; -use wasm_runtime::{Runtime, Wasm}; +use valor_runtime::{Runtime, Wasm}; mod constants; mod parsero; diff --git a/src/parsero/mod.rs b/bin/valor-run/src/parsero/mod.rs similarity index 100% rename from src/parsero/mod.rs rename to bin/valor-run/src/parsero/mod.rs diff --git a/src/plugin/mod.rs b/bin/valor-run/src/plugin/mod.rs similarity index 89% rename from src/plugin/mod.rs rename to bin/valor-run/src/plugin/mod.rs index 3466c60..e737bd8 100644 --- a/src/plugin/mod.rs +++ b/bin/valor-run/src/plugin/mod.rs @@ -26,8 +26,7 @@ impl Plugin { pub fn new_map(paths: Vec, all_active: bool) -> HashMap { let mut map_plugins = HashMap::::new(); for path in paths { - let active = if all_active { true } else { false }; - let plugin = self::Plugin::new(path.clone(), active); + let plugin = self::Plugin::new(path.clone(), all_active); map_plugins.insert(path, plugin); } map_plugins diff --git a/src/utils/mod.rs b/bin/valor-run/src/utils/mod.rs similarity index 100% rename from src/utils/mod.rs rename to bin/valor-run/src/utils/mod.rs diff --git a/src/lib.rs b/src/lib.rs index bdb7bb7..8b13789 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1 +1 @@ -pub fn on_message() {} +