mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-26 03:33:44 +03:00
Merge branch 'master' into feature/release
This commit is contained in:
commit
a1ee309024
114
Cargo.lock
generated
114
Cargo.lock
generated
@ -241,9 +241,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.33.1"
|
||||
version = "2.33.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bdfa80d47f954d53a35a64987ca1422f495b8d6483c0fe9f7117b36c2a792129"
|
||||
checksum = "10040cdf04294b565d9e0319955430099ec3813a64c952b86a41200ad714ae48"
|
||||
dependencies = [
|
||||
"ansi_term",
|
||||
"atty",
|
||||
@ -513,6 +513,18 @@ version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
|
||||
|
||||
[[package]]
|
||||
name = "filetime"
|
||||
version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ed85775dcc68644b5c950ac06a2b23768d3bc9390464151aaf27136998dcf9e"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.0.16"
|
||||
@ -556,6 +568,25 @@ dependencies = [
|
||||
"void",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fsevent"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"fsevent-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fsevent-sys"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fsio"
|
||||
version = "0.1.3"
|
||||
@ -823,6 +854,26 @@ dependencies = [
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "inotify"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4816c66d2c8ae673df83366c18341538f234a26d65a9ecea5c348b453ac1d02f"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"inotify-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "inotify-sys"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e74a1aa87c59aeff6ef2cc2fa62d41bc43f54952f55652656b18a02fd5e356c0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iovec"
|
||||
version = "0.1.4"
|
||||
@ -900,6 +951,12 @@ version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "lazycell"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||
|
||||
[[package]]
|
||||
name = "leo"
|
||||
version = "0.1.0"
|
||||
@ -914,6 +971,7 @@ dependencies = [
|
||||
"leo-input",
|
||||
"leo-package",
|
||||
"log",
|
||||
"notify",
|
||||
"rand",
|
||||
"rand_core",
|
||||
"reqwest",
|
||||
@ -1124,6 +1182,18 @@ dependencies = [
|
||||
"winapi 0.2.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio-extras"
|
||||
version = "2.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19"
|
||||
dependencies = [
|
||||
"lazycell",
|
||||
"log",
|
||||
"mio",
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miow"
|
||||
version = "0.2.1"
|
||||
@ -1171,6 +1241,24 @@ version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab250442c86f1850815b5d268639dff018c0627022bc1940eb2d642ca1ce12f0"
|
||||
|
||||
[[package]]
|
||||
name = "notify"
|
||||
version = "4.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80ae4a7688d1fab81c5bf19c64fc8db920be8d519ce6336ed4e7efe024724dbd"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"filetime",
|
||||
"fsevent",
|
||||
"fsevent-sys",
|
||||
"inotify",
|
||||
"libc",
|
||||
"mio",
|
||||
"mio-extras",
|
||||
"walkdir",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-bigint"
|
||||
version = "0.3.0"
|
||||
@ -1791,7 +1879,7 @@ checksum = "3757cb9d89161a2f24e1cf78efa0c1fcff485d18e3f55e0aa3480824ddaa0f3f"
|
||||
[[package]]
|
||||
name = "snarkos-algorithms"
|
||||
version = "0.8.0"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#8d84d89f6b6c3b4693d3c08758cce28139910807"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#793ff39c3716df083964d9791158fc7409eb5200"
|
||||
dependencies = [
|
||||
"blake2",
|
||||
"derivative",
|
||||
@ -1811,7 +1899,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkos-curves"
|
||||
version = "0.8.0"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#8d84d89f6b6c3b4693d3c08758cce28139910807"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#793ff39c3716df083964d9791158fc7409eb5200"
|
||||
dependencies = [
|
||||
"derivative",
|
||||
"rand",
|
||||
@ -1826,7 +1914,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkos-derives"
|
||||
version = "0.1.0"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#8d84d89f6b6c3b4693d3c08758cce28139910807"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#793ff39c3716df083964d9791158fc7409eb5200"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.19",
|
||||
"quote 1.0.7",
|
||||
@ -1836,7 +1924,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkos-dpc"
|
||||
version = "0.8.0"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#8d84d89f6b6c3b4693d3c08758cce28139910807"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#793ff39c3716df083964d9791158fc7409eb5200"
|
||||
dependencies = [
|
||||
"blake2",
|
||||
"derivative",
|
||||
@ -1857,7 +1945,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkos-errors"
|
||||
version = "0.8.0"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#8d84d89f6b6c3b4693d3c08758cce28139910807"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#793ff39c3716df083964d9791158fc7409eb5200"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"bech32",
|
||||
@ -1870,7 +1958,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkos-gadgets"
|
||||
version = "0.8.0"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#8d84d89f6b6c3b4693d3c08758cce28139910807"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#793ff39c3716df083964d9791158fc7409eb5200"
|
||||
dependencies = [
|
||||
"derivative",
|
||||
"digest 0.8.1",
|
||||
@ -1885,7 +1973,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkos-models"
|
||||
version = "0.8.0"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#8d84d89f6b6c3b4693d3c08758cce28139910807"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#793ff39c3716df083964d9791158fc7409eb5200"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"derivative",
|
||||
@ -1901,7 +1989,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkos-objects"
|
||||
version = "0.8.0"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#8d84d89f6b6c3b4693d3c08758cce28139910807"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#793ff39c3716df083964d9791158fc7409eb5200"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"bech32",
|
||||
@ -1922,7 +2010,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkos-parameters"
|
||||
version = "0.8.0"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#8d84d89f6b6c3b4693d3c08758cce28139910807"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#793ff39c3716df083964d9791158fc7409eb5200"
|
||||
dependencies = [
|
||||
"hex",
|
||||
"snarkos-algorithms",
|
||||
@ -1934,12 +2022,12 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "snarkos-profiler"
|
||||
version = "0.8.0"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#8d84d89f6b6c3b4693d3c08758cce28139910807"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#793ff39c3716df083964d9791158fc7409eb5200"
|
||||
|
||||
[[package]]
|
||||
name = "snarkos-utilities"
|
||||
version = "0.8.0"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#8d84d89f6b6c3b4693d3c08758cce28139910807"
|
||||
source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#793ff39c3716df083964d9791158fc7409eb5200"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"rand",
|
||||
|
@ -28,12 +28,13 @@ snarkos-gadgets = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "
|
||||
snarkos-models = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-models", default-features = false }
|
||||
snarkos-utilities = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-utilities" }
|
||||
|
||||
clap = { version = "2.33.0" }
|
||||
clap = { version = "2.33.2" }
|
||||
colored = { version = "2.0" }
|
||||
env_logger = { version = "0.7" }
|
||||
from-pest = { version = "0.3.1" }
|
||||
lazy_static = { version = "1.4.0" }
|
||||
log = { version = "0.4" }
|
||||
notify= { version = "4.0.15" }
|
||||
rand = { version = "0.7" }
|
||||
rand_core = { version = "0.5.1" }
|
||||
reqwest = { version = "0.10.7", features = ["blocking", "json"] }
|
||||
|
@ -39,3 +39,6 @@ pub use self::test::*;
|
||||
|
||||
pub mod unload;
|
||||
pub use self::unload::*;
|
||||
|
||||
pub mod watch;
|
||||
pub use self::watch::*;
|
||||
|
59
leo/commands/watch.rs
Normal file
59
leo/commands/watch.rs
Normal file
@ -0,0 +1,59 @@
|
||||
use crate::{cli::CLI, cli_types::*, commands::BuildCommand, errors::CLIError};
|
||||
use clap::ArgMatches;
|
||||
use notify::{watcher, DebouncedEvent, RecursiveMode, Watcher};
|
||||
use std::{sync::mpsc::channel, time::Duration};
|
||||
|
||||
const LEO_SOURCE_DIR: &str = "src/";
|
||||
|
||||
// Time interval for watching files, in seconds
|
||||
const INTERVAL: u64 = 3;
|
||||
|
||||
pub struct WatchCommand;
|
||||
|
||||
impl CLI for WatchCommand {
|
||||
type Options = ();
|
||||
type Output = ();
|
||||
|
||||
const ABOUT: AboutType = "Watch the changes of the leo's source files";
|
||||
const ARGUMENTS: &'static [ArgumentType] = &[];
|
||||
const FLAGS: &'static [FlagType] = &[];
|
||||
const NAME: NameType = "watch";
|
||||
const OPTIONS: &'static [OptionType] = &[];
|
||||
const SUBCOMMANDS: &'static [SubCommandType] = &[];
|
||||
|
||||
#[cfg_attr(tarpaulin, skip)]
|
||||
fn parse(_arguments: &ArgMatches) -> Result<Self::Options, CLIError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn output(_options: Self::Options) -> Result<Self::Output, CLIError> {
|
||||
let (tx, rx) = channel();
|
||||
let mut watcher = watcher(tx, Duration::from_secs(INTERVAL)).unwrap();
|
||||
watcher.watch(LEO_SOURCE_DIR, RecursiveMode::Recursive).unwrap();
|
||||
|
||||
log::info!("Watching leo's source files");
|
||||
loop {
|
||||
match rx.recv() {
|
||||
// See changes on the write event
|
||||
Ok(DebouncedEvent::Write(_write)) => {
|
||||
let options = ();
|
||||
match BuildCommand::output(options) {
|
||||
Ok(_output) => {
|
||||
log::info!("Build successfully");
|
||||
}
|
||||
Err(e) => {
|
||||
// Syntax error
|
||||
log::error!("Error {:?}", e);
|
||||
}
|
||||
};
|
||||
}
|
||||
// Other events
|
||||
Ok(_event) => {}
|
||||
|
||||
// Watch error
|
||||
Err(e) => println!("watch error: {:?}", e),
|
||||
}
|
||||
}
|
||||
// Ok(())
|
||||
}
|
||||
}
|
@ -34,6 +34,7 @@ fn main() -> Result<(), CLIError> {
|
||||
PublishCommand::new().display_order(11),
|
||||
DeployCommand::new().display_order(12),
|
||||
CleanCommand::new().display_order(13),
|
||||
WatchCommand::new().display_order(14),
|
||||
])
|
||||
.set_term_width(0)
|
||||
.get_matches();
|
||||
@ -53,6 +54,7 @@ fn main() -> Result<(), CLIError> {
|
||||
("publish", Some(arguments)) => PublishCommand::process(arguments),
|
||||
("deploy", Some(arguments)) => DeployCommand::process(arguments),
|
||||
("clean", Some(arguments)) => CleanCommand::process(arguments),
|
||||
("watch", Some(arguments)) => WatchCommand::process(arguments),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user