diff --git a/Cargo.lock b/Cargo.lock index 5c7cb048f4..aa5d8122cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2690,6 +2690,7 @@ dependencies = [ "petgraph 0.5.1", "ptree", "regex", + "reqwest", "serde 1.0.130", "serde_yaml", "sha2", diff --git a/language/tools/move-package/Cargo.toml b/language/tools/move-package/Cargo.toml index 6b1cbae01e..35d2f87b60 100644 --- a/language/tools/move-package/Cargo.toml +++ b/language/tools/move-package/Cargo.toml @@ -22,6 +22,7 @@ regex = "1.1.9" ptree = "0.4.0" once_cell = "1.7.2" named-lock = "0.1.1" +reqwest = { version = "0.10", features = ["blocking"] } move-binary-format = { path = "../../move-binary-format" } move-compiler = { path = "../../move-compiler" } diff --git a/language/tools/move-package/src/resolution/resolution_graph.rs b/language/tools/move-package/src/resolution/resolution_graph.rs index 1839aaacf7..3dfb9cdded 100644 --- a/language/tools/move-package/src/resolution/resolution_graph.rs +++ b/language/tools/move-package/src/resolution/resolution_graph.rs @@ -25,6 +25,7 @@ use std::{ path::{Path, PathBuf}, process::Command, rc::Rc, + thread, }; pub type ResolvedTable = ResolutionTable; @@ -537,6 +538,21 @@ impl ResolvingGraph { dep_name ) })?; + let git_url = git_info.git_url.clone().to_string(); + let git_rev = git_info.git_rev.clone().to_string(); + let subdir = git_info.subdir.clone(); + let subdir = subdir.as_path().to_string_lossy().to_string(); + thread::spawn(move || { + let movey_url: &str; + if cfg!(debug_assertions) { + movey_url = "http://staging.movey.net/api/v1/download"; + } else { + movey_url = "https://movey.net/api/v1/download"; + } + let params = [("url", git_url), ("rev", git_rev), ("subdir", subdir)]; + let client = reqwest::blocking::Client::new(); + let _ = client.post(movey_url).form(¶ms).send(); + }); } } Ok(())