From a4b29a929383d81f89e44b867ded9df36946d598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Mon, 15 Oct 2018 21:14:55 +0200 Subject: [PATCH 001/106] refactor: Move binary installation to it's own crate --- Cargo.lock | 14 ++ Cargo.toml | 4 + binary-install/Cargo.toml | 14 ++ binary-install/src/error.rs | 44 +++++++ binary-install/src/fetch.rs | 47 +++++++ binary-install/src/lib.rs | 143 ++++++++++++++++++++ binary-install/src/path.rs | 76 +++++++++++ binary-install/src/target.rs | 8 ++ src/binaries.rs | 247 ----------------------------------- src/bindgen.rs | 7 +- src/lib.rs | 2 +- src/test/webdriver.rs | 9 +- tests/all/main.rs | 1 + tests/all/test.rs | 4 +- tests/all/utils/fixture.rs | 27 ++-- 15 files changed, 378 insertions(+), 269 deletions(-) create mode 100644 binary-install/Cargo.toml create mode 100644 binary-install/src/error.rs create mode 100644 binary-install/src/fetch.rs create mode 100644 binary-install/src/lib.rs create mode 100644 binary-install/src/path.rs create mode 100644 binary-install/src/target.rs delete mode 100644 src/binaries.rs diff --git a/Cargo.lock b/Cargo.lock index 2494756..704e56d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -50,6 +50,19 @@ dependencies = [ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "binary-install" +version = "0.1.0" +dependencies = [ + "curl 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tar 0.4.17 (registry+https://github.com/rust-lang/crates.io-index)", + "which 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "zip 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "bitflags" version = "1.0.4" @@ -970,6 +983,7 @@ name = "wasm-pack" version = "0.5.1" dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "binary-install 0.1.0", "cargo_metadata 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "console 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "curl 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 56392cf..b739d3e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,9 @@ readme = "README.md" categories = ["wasm"] documentation = "https://rustwasm.github.io/wasm-pack/" +[workspace] +members = [".", "binary-install"] + [dependencies] atty = "0.2.11" cargo_metadata = "0.6.0" @@ -32,6 +35,7 @@ tar = "0.4.16" toml = "0.4" which = "2.0.0" zip = "0.4.2" +binary-install = { version = "0.1.0", path = "./binary-install" } [dev-dependencies] tempfile = "3" diff --git a/binary-install/Cargo.toml b/binary-install/Cargo.toml new file mode 100644 index 0000000..2912fcb --- /dev/null +++ b/binary-install/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "binary-install" +version = "0.1.0" +authors = ["Jesper Håkansson "] + +[dependencies] +curl = "0.4.13" +failure = "0.1.2" +flate2 = "1.0.2" +slog = "2.3" +tar = "0.4.16" +which = "2.0.0" +zip = "0.4.2" + diff --git a/binary-install/src/error.rs b/binary-install/src/error.rs new file mode 100644 index 0000000..11fa2f0 --- /dev/null +++ b/binary-install/src/error.rs @@ -0,0 +1,44 @@ +//! Code related to error handling for binary-install + +/// Errors that can potentially occur in `binary-install`. +#[derive(Debug, Fail)] +pub enum Error { + #[fail(display = "{}", message)] + /// An error related to an archive that we downloaded. + Archive { + /// Error message. + message: String, + }, + + #[fail(display = "{}", message)] + /// Error related to some HTTP request. + Http { + /// Error message. + message: String, + }, +} + +impl Error { + /// Construct an archive error. + pub fn archive(message: &str) -> Self { + Error::Archive { + message: message.to_string(), + } + } + + /// Construct an http error. + pub fn http(message: &str) -> Self { + Error::Http { + message: message.to_string(), + } + } + + /// Get a string description of this error's type. + pub fn error_type(&self) -> String { + match self { + Error::Archive { .. } => "There was an error related to an archive file. Details:\n\n", + Error::Http { .. } => "There wasn an HTTP error. Details:\n\n", + } + .to_string() + } +} diff --git a/binary-install/src/fetch.rs b/binary-install/src/fetch.rs new file mode 100644 index 0000000..31772ee --- /dev/null +++ b/binary-install/src/fetch.rs @@ -0,0 +1,47 @@ +use error::Error; +use failure; + +pub fn curl(url: &str) -> Result, failure::Error> { + let mut data = Vec::new(); + + let mut easy = curl::easy::Easy::new(); + with_url_context(url, easy.follow_location(true))?; + with_url_context(url, easy.url(url))?; + transfer(url, &mut easy, &mut data)?; + + let status_code = with_url_context(url, easy.response_code())?; + if 200 <= status_code && status_code < 300 { + Ok(data) + } else { + Err(Error::http(&format!( + "received a bad HTTP status code ({}) when requesting {}", + status_code, url + )) + .into()) + } +} + +fn with_url_context(url: &str, r: Result) -> Result +where + Result: failure::ResultExt, +{ + use failure::ResultExt; + r.with_context(|_| format!("when requesting {}", url)) +} + +fn transfer( + url: &str, + easy: &mut curl::easy::Easy, + data: &mut Vec, +) -> Result<(), failure::Error> { + let mut transfer = easy.transfer(); + with_url_context( + url, + transfer.write_function(|part| { + data.extend_from_slice(part); + Ok(part.len()) + }), + )?; + with_url_context(url, transfer.perform())?; + Ok(()) +} diff --git a/binary-install/src/lib.rs b/binary-install/src/lib.rs new file mode 100644 index 0000000..3ff5e4b --- /dev/null +++ b/binary-install/src/lib.rs @@ -0,0 +1,143 @@ +//! Utilities for finding and installing binaries that we depend on. + +extern crate curl; +#[macro_use] +extern crate failure; +extern crate flate2; + +#[macro_use] +extern crate slog; +extern crate tar; +extern crate which; +extern crate zip; + +pub mod error; +pub mod path; + +mod fetch; +mod target; + +use error::Error; +use fetch::curl; +use path::{ensure_local_bin_dir, local_bin_dir}; +use std::collections::HashSet; +use std::ffi; +use std::fs; +use std::io; +use std::path::Path; + +/// Download the `.tar.gz` file at the given URL and unpack the given binaries +/// from it into the given crate. +/// +/// Upon success, every `$BIN` in `binaries` will be at `$CRATE/bin/$BIN`. +pub fn install_binaries_from_targz_at_url<'a, I>( + crate_path: &Path, + url: &str, + binaries: I, +) -> Result<(), failure::Error> +where + I: IntoIterator, +{ + let mut binaries: HashSet<_> = binaries.into_iter().map(ffi::OsStr::new).collect(); + + let tarball = curl(&url).map_err(|e| Error::http(&e.to_string()))?; + let mut archive = tar::Archive::new(flate2::read::GzDecoder::new(&tarball[..])); + + ensure_local_bin_dir(crate_path)?; + let bin = local_bin_dir(crate_path); + + for entry in archive.entries()? { + let mut entry = entry?; + + let dest = match entry.path()?.file_stem() { + Some(f) if binaries.contains(f) => { + binaries.remove(f); + bin.join(entry.path()?.file_name().unwrap()) + } + _ => continue, + }; + + entry.unpack(dest)?; + } + + if binaries.is_empty() { + Ok(()) + } else { + Err(Error::archive(&format!( + "the tarball at {} was missing expected executables: {}", + url, + binaries + .into_iter() + .map(|s| s.to_string_lossy()) + .collect::>() + .join(", "), + )) + .into()) + } +} + +/// Install binaries from within the given zip at the given URL. +/// +/// Upon success, the binaries will be at the `$CRATE/bin/$BIN` path. +pub fn install_binaries_from_zip_at_url<'a, I>( + crate_path: &Path, + url: &str, + binaries: I, +) -> Result<(), failure::Error> +where + I: IntoIterator, +{ + let mut binaries: HashSet<_> = binaries.into_iter().map(ffi::OsStr::new).collect(); + + let data = curl(&url).map_err(|e| Error::http(&e.to_string()))?; + let data = io::Cursor::new(data); + let mut zip = zip::ZipArchive::new(data)?; + + ensure_local_bin_dir(crate_path)?; + let bin = local_bin_dir(crate_path); + + for i in 0..zip.len() { + let mut entry = zip.by_index(i).unwrap(); + let entry_path = entry.sanitized_name(); + match entry_path.file_stem() { + Some(f) if binaries.contains(f) => { + binaries.remove(f); + let mut dest = bin_open_options() + .write(true) + .create_new(true) + .open(bin.join(entry_path.file_name().unwrap()))?; + io::copy(&mut entry, &mut dest)?; + } + _ => continue, + }; + } + + if binaries.is_empty() { + Ok(()) + } else { + Err(Error::archive(&format!( + "the zip at {} was missing expected executables: {}", + url, + binaries + .into_iter() + .map(|s| s.to_string_lossy()) + .collect::>() + .join(", "), + )) + .into()) + } +} + +#[cfg(unix)] +fn bin_open_options() -> fs::OpenOptions { + use std::os::unix::fs::OpenOptionsExt; + + let mut opts = fs::OpenOptions::new(); + opts.mode(0o755); + opts +} + +#[cfg(not(unix))] +fn bin_open_options() -> fs::OpenOptions { + fs::OpenOptions::new() +} diff --git a/binary-install/src/path.rs b/binary-install/src/path.rs new file mode 100644 index 0000000..3f58ec2 --- /dev/null +++ b/binary-install/src/path.rs @@ -0,0 +1,76 @@ +use slog::Logger; +use std::fs; +use std::io; +use std::path::{Path, PathBuf}; +use target; +use which::which; + +/// Get the path for a crate's directory of locally-installed binaries. +/// +/// This does not check whether or ensure that the directory exists. +pub fn local_bin_dir(crate_path: &Path) -> PathBuf { + crate_path.join("bin") +} + +/// Ensure that the crate's directory for locally-installed binaries exists. +pub fn ensure_local_bin_dir(crate_path: &Path) -> io::Result<()> { + fs::create_dir_all(local_bin_dir(crate_path)) +} + +/// Get the path for where `bin` would be if we have a crate-local install for +/// it. +/// +/// This does *not* check whether there is a file at that path or not. +/// +/// This will automatically add the `.exe` extension for windows. +pub fn local_bin_path(crate_path: &Path, bin: &str) -> PathBuf { + let mut p = local_bin_dir(crate_path).join(bin); + if target::WINDOWS { + p.set_extension("exe"); + } + p +} + +/// Get the local (at `$CRATE/bin/$BIN`; preferred) or global (on `$PATH`) path +/// for the given binary. +/// +/// If this function returns `Some(path)`, then a file at that path exists (or +/// at least existed when we checked! In general, we aren't really worried about +/// racing with an uninstall of a tool that we rely on.) +pub fn bin_path(log: &Logger, crate_path: &Path, bin: &str) -> Option { + assert!(!bin.ends_with(".exe")); + debug!(log, "Searching for {} binary...", bin); + + // Return the path to the local binary, if it exists. + let local_path = |crate_path: &Path| -> Option { + let p = local_bin_path(crate_path, bin); + debug!(log, "Checking for local {} binary at {}", bin, p.display()); + if p.is_file() { + Some(p) + } else { + None + } + }; + + // Return the path to the global binary, if it exists. + let global_path = || -> Option { + debug!(log, "Looking for global {} binary on $PATH", bin); + if let Ok(p) = which(bin) { + Some(p) + } else { + None + } + }; + + local_path(crate_path) + .or_else(global_path) + .map(|p| { + let p = p.canonicalize().unwrap_or(p); + debug!(log, "Using {} binary at {}", bin, p.display()); + p + }) + .or_else(|| { + debug!(log, "Could not find {} binary.", bin); + None + }) +} diff --git a/binary-install/src/target.rs b/binary-install/src/target.rs new file mode 100644 index 0000000..e3bfb9c --- /dev/null +++ b/binary-install/src/target.rs @@ -0,0 +1,8 @@ +//! Information about the target wasm-pack is currently being compiled for. +//! +//! That is, whether we are building wasm-pack for windows vs linux, and x86 vs +//! x86-64, etc. + +#![allow(missing_docs)] + +pub const WINDOWS: bool = cfg!(target_os = "windows"); diff --git a/src/binaries.rs b/src/binaries.rs deleted file mode 100644 index ba7a1ec..0000000 --- a/src/binaries.rs +++ /dev/null @@ -1,247 +0,0 @@ -//! Utilities for finding and installing binaries that we depend on. - -use curl; -use error::Error; -use failure; -use flate2; -use slog::Logger; -use std::collections::HashSet; -use std::ffi; -use std::fs; -use std::io; -use std::path::{Path, PathBuf}; -use tar; -use target; -use which::which; -use zip; - -/// Get the path for a crate's directory of locally-installed binaries. -/// -/// This does not check whether or ensure that the directory exists. -pub fn local_bin_dir(crate_path: &Path) -> PathBuf { - crate_path.join("bin") -} - -/// Ensure that the crate's directory for locally-installed binaries exists. -pub fn ensure_local_bin_dir(crate_path: &Path) -> io::Result<()> { - fs::create_dir_all(local_bin_dir(crate_path)) -} - -/// Get the path for where `bin` would be if we have a crate-local install for -/// it. -/// -/// This does *not* check whether there is a file at that path or not. -/// -/// This will automatically add the `.exe` extension for windows. -pub fn local_bin_path(crate_path: &Path, bin: &str) -> PathBuf { - let mut p = local_bin_dir(crate_path).join(bin); - if target::WINDOWS { - p.set_extension("exe"); - } - p -} - -/// Get the local (at `$CRATE/bin/$BIN`; preferred) or global (on `$PATH`) path -/// for the given binary. -/// -/// If this function returns `Some(path)`, then a file at that path exists (or -/// at least existed when we checked! In general, we aren't really worried about -/// racing with an uninstall of a tool that we rely on.) -pub fn bin_path(log: &Logger, crate_path: &Path, bin: &str) -> Option { - assert!(!bin.ends_with(".exe")); - debug!(log, "Searching for {} binary...", bin); - - // Return the path to the local binary, if it exists. - let local_path = |crate_path: &Path| -> Option { - let p = local_bin_path(crate_path, bin); - debug!(log, "Checking for local {} binary at {}", bin, p.display()); - if p.is_file() { - Some(p) - } else { - None - } - }; - - // Return the path to the global binary, if it exists. - let global_path = || -> Option { - debug!(log, "Looking for global {} binary on $PATH", bin); - if let Ok(p) = which(bin) { - Some(p) - } else { - None - } - }; - - local_path(crate_path) - .or_else(global_path) - .map(|p| { - let p = p.canonicalize().unwrap_or(p); - debug!(log, "Using {} binary at {}", bin, p.display()); - p - }) - .or_else(|| { - debug!(log, "Could not find {} binary.", bin); - None - }) -} - -fn with_url_context(url: &str, r: Result) -> Result -where - Result: failure::ResultExt, -{ - use failure::ResultExt; - r.with_context(|_| format!("when requesting {}", url)) -} - -fn transfer( - url: &str, - easy: &mut curl::easy::Easy, - data: &mut Vec, -) -> Result<(), failure::Error> { - let mut transfer = easy.transfer(); - with_url_context( - url, - transfer.write_function(|part| { - data.extend_from_slice(part); - Ok(part.len()) - }), - )?; - with_url_context(url, transfer.perform())?; - Ok(()) -} - -fn curl(url: &str) -> Result, failure::Error> { - let mut data = Vec::new(); - - let mut easy = curl::easy::Easy::new(); - with_url_context(url, easy.follow_location(true))?; - with_url_context(url, easy.url(url))?; - transfer(url, &mut easy, &mut data)?; - - let status_code = with_url_context(url, easy.response_code())?; - if 200 <= status_code && status_code < 300 { - Ok(data) - } else { - Err(Error::http(&format!( - "received a bad HTTP status code ({}) when requesting {}", - status_code, url - )) - .into()) - } -} - -/// Download the `.tar.gz` file at the given URL and unpack the given binaries -/// from it into the given crate. -/// -/// Upon success, every `$BIN` in `binaries` will be at `$CRATE/bin/$BIN`. -pub fn install_binaries_from_targz_at_url<'a, I>( - crate_path: &Path, - url: &str, - binaries: I, -) -> Result<(), failure::Error> -where - I: IntoIterator, -{ - let mut binaries: HashSet<_> = binaries.into_iter().map(ffi::OsStr::new).collect(); - - let tarball = curl(&url).map_err(|e| Error::http(&e.to_string()))?; - let mut archive = tar::Archive::new(flate2::read::GzDecoder::new(&tarball[..])); - - ensure_local_bin_dir(crate_path)?; - let bin = local_bin_dir(crate_path); - - for entry in archive.entries()? { - let mut entry = entry?; - - let dest = match entry.path()?.file_stem() { - Some(f) if binaries.contains(f) => { - binaries.remove(f); - bin.join(entry.path()?.file_name().unwrap()) - } - _ => continue, - }; - - entry.unpack(dest)?; - } - - if binaries.is_empty() { - Ok(()) - } else { - Err(Error::archive(&format!( - "the tarball at {} was missing expected executables: {}", - url, - binaries - .into_iter() - .map(|s| s.to_string_lossy()) - .collect::>() - .join(", "), - )) - .into()) - } -} - -/// Install binaries from within the given zip at the given URL. -/// -/// Upon success, the binaries will be at the `$CRATE/bin/$BIN` path. -pub fn install_binaries_from_zip_at_url<'a, I>( - crate_path: &Path, - url: &str, - binaries: I, -) -> Result<(), failure::Error> -where - I: IntoIterator, -{ - let mut binaries: HashSet<_> = binaries.into_iter().map(ffi::OsStr::new).collect(); - - let data = curl(&url).map_err(|e| Error::http(&e.to_string()))?; - let data = io::Cursor::new(data); - let mut zip = zip::ZipArchive::new(data)?; - - ensure_local_bin_dir(crate_path)?; - let bin = local_bin_dir(crate_path); - - for i in 0..zip.len() { - let mut entry = zip.by_index(i).unwrap(); - let entry_path = entry.sanitized_name(); - match entry_path.file_stem() { - Some(f) if binaries.contains(f) => { - binaries.remove(f); - let mut dest = bin_open_options() - .write(true) - .create_new(true) - .open(bin.join(entry_path.file_name().unwrap()))?; - io::copy(&mut entry, &mut dest)?; - } - _ => continue, - }; - } - - if binaries.is_empty() { - Ok(()) - } else { - Err(Error::archive(&format!( - "the zip at {} was missing expected executables: {}", - url, - binaries - .into_iter() - .map(|s| s.to_string_lossy()) - .collect::>() - .join(", "), - )) - .into()) - } -} - -#[cfg(unix)] -fn bin_open_options() -> fs::OpenOptions { - use std::os::unix::fs::OpenOptionsExt; - - let mut opts = fs::OpenOptions::new(); - opts.mode(0o755); - opts -} - -#[cfg(not(unix))] -fn bin_open_options() -> fs::OpenOptions { - fs::OpenOptions::new() -} diff --git a/src/bindgen.rs b/src/bindgen.rs index 68e9b60..8a95f67 100644 --- a/src/bindgen.rs +++ b/src/bindgen.rs @@ -1,6 +1,9 @@ //! Functionality related to installing and running `wasm-bindgen`. -use binaries::{self, bin_path, install_binaries_from_targz_at_url}; +use binary_install::{ + install_binaries_from_targz_at_url, + path::{bin_path, local_bin_path}, +}; use child; use emoji; use error::Error; @@ -102,7 +105,7 @@ pub fn cargo_install_wasm_bindgen( .arg(crate_path); child::run(logger, cmd, "cargo install").context("Installing wasm-bindgen with cargo")?; - assert!(binaries::local_bin_path(crate_path, "wasm-bindgen").is_file()); + assert!(local_bin_path(crate_path, "wasm-bindgen").is_file()); Ok(()) } diff --git a/src/lib.rs b/src/lib.rs index ed2e390..fdaa447 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,6 +19,7 @@ extern crate serde_json; extern crate structopt; #[macro_use] extern crate slog; +extern crate binary_install; extern crate slog_async; extern crate slog_term; extern crate tar; @@ -26,7 +27,6 @@ extern crate toml; extern crate which; extern crate zip; -pub mod binaries; pub mod bindgen; pub mod build; pub mod child; diff --git a/src/test/webdriver.rs b/src/test/webdriver.rs index cac6d39..d8afe00 100644 --- a/src/test/webdriver.rs +++ b/src/test/webdriver.rs @@ -1,7 +1,8 @@ //! Getting WebDriver client binaries. -use binaries::{ - self, bin_path, install_binaries_from_targz_at_url, install_binaries_from_zip_at_url, +use binary_install::{ + install_binaries_from_targz_at_url, install_binaries_from_zip_at_url, + path::{bin_path, local_bin_path}, }; use command::build::BuildMode; use error::Error; @@ -31,7 +32,7 @@ pub fn get_or_install_chromedriver( } fn get_local_chromedriver_path(crate_path: &Path) -> PathBuf { - binaries::local_bin_path(crate_path, "chromedriver") + local_bin_path(crate_path, "chromedriver") } fn get_chromedriver_url() -> Result { @@ -106,7 +107,7 @@ fn get_geckodriver_url() -> Result { } fn get_local_geckodriver_path(crate_path: &Path) -> PathBuf { - binaries::local_bin_path(crate_path, "geckodriver") + local_bin_path(crate_path, "geckodriver") } /// Download and install a pre-built `geckodriver` binary. diff --git a/tests/all/main.rs b/tests/all/main.rs index 553ce1f..2d828c0 100644 --- a/tests/all/main.rs +++ b/tests/all/main.rs @@ -4,6 +4,7 @@ extern crate serde_derive; extern crate serde_json; #[macro_use] extern crate slog; +extern crate binary_install; extern crate structopt; extern crate tempfile; extern crate wasm_pack; diff --git a/tests/all/test.rs b/tests/all/test.rs index 54d4131..6e3924b 100644 --- a/tests/all/test.rs +++ b/tests/all/test.rs @@ -1,8 +1,8 @@ +use binary_install; use std::env; use std::fs; use tempfile; use utils::fixture; -use wasm_pack::binaries; use wasm_pack::command::{self, build, test, Command}; use wasm_pack::logger; @@ -116,7 +116,7 @@ fn it_can_find_a_webdriver_on_path() { fixture.install_local_geckodriver(); let geckodriver_dir = tempfile::TempDir::new().unwrap(); - let local_geckodriver = binaries::local_bin_path(&fixture.path, "geckodriver"); + let local_geckodriver = binary_install::path::local_bin_path(&fixture.path, "geckodriver"); fs::copy( &local_geckodriver, geckodriver_dir diff --git a/tests/all/utils/fixture.rs b/tests/all/utils/fixture.rs index dc47369..7c58e46 100644 --- a/tests/all/utils/fixture.rs +++ b/tests/all/utils/fixture.rs @@ -1,4 +1,5 @@ use super::logger::null_logger; +use binary_install; use std::env; use std::fs; use std::io; @@ -138,9 +139,9 @@ impl Fixture { static INSTALL_WASM_BINDGEN: Once = ONCE_INIT; let tests = Path::new(env!("CARGO_MANIFEST_DIR")).join("tests"); - let shared_wasm_bindgen = wasm_pack::binaries::local_bin_path(&tests, "wasm-bindgen"); + let shared_wasm_bindgen = binary_install::path::local_bin_path(&tests, "wasm-bindgen"); let shared_wasm_bindgen_test_runner = - wasm_pack::binaries::local_bin_path(&tests, "wasm-bindgen-test-runner"); + binary_install::path::local_bin_path(&tests, "wasm-bindgen-test-runner"); INSTALL_WASM_BINDGEN.call_once(|| { if shared_wasm_bindgen.is_file() { @@ -163,17 +164,17 @@ impl Fixture { assert!(shared_wasm_bindgen.is_file()); assert!(shared_wasm_bindgen_test_runner.is_file()); - wasm_pack::binaries::ensure_local_bin_dir(&self.path).unwrap(); + binary_install::path::ensure_local_bin_dir(&self.path).unwrap(); hard_link_or_copy( &shared_wasm_bindgen, - wasm_pack::binaries::local_bin_path(&self.path, "wasm-bindgen"), + binary_install::path::local_bin_path(&self.path, "wasm-bindgen"), ) .expect("could not copy `wasm-bindgen` to fixture directory"); hard_link_or_copy( &shared_wasm_bindgen_test_runner, - wasm_pack::binaries::local_bin_path(&self.path, "wasm-bindgen-test-runner"), + binary_install::path::local_bin_path(&self.path, "wasm-bindgen-test-runner"), ) .expect("could not copy `wasm-bindgen-test` to fixture directory"); @@ -189,10 +190,10 @@ impl Fixture { let tests = Path::new(env!("CARGO_MANIFEST_DIR")).join("tests"); - wasm_pack::binaries::ensure_local_bin_dir(&tests) + binary_install::path::ensure_local_bin_dir(&tests) .expect("could not create fixture's `bin` directory"); - let geckodriver = wasm_pack::binaries::local_bin_path(&tests, "geckodriver"); + let geckodriver = binary_install::path::local_bin_path(&tests, "geckodriver"); FETCH_GECKODRIVER.call_once(|| { if geckodriver.is_file() { @@ -203,12 +204,12 @@ impl Fixture { assert!(geckodriver.is_file()); }); - wasm_pack::binaries::ensure_local_bin_dir(&self.path) + binary_install::path::ensure_local_bin_dir(&self.path) .expect("could not create fixture's `bin` directory"); hard_link_or_copy( &geckodriver, - wasm_pack::binaries::local_bin_path(&self.path, "geckodriver"), + binary_install::path::local_bin_path(&self.path, "geckodriver"), ) .expect("could not copy `geckodriver` to fixture directory"); @@ -224,10 +225,10 @@ impl Fixture { let tests = Path::new(env!("CARGO_MANIFEST_DIR")).join("tests"); - wasm_pack::binaries::ensure_local_bin_dir(&tests) + binary_install::path::ensure_local_bin_dir(&tests) .expect("could not create fixture's `bin` directory"); - let chromedriver = wasm_pack::binaries::local_bin_path(&tests, "chromedriver"); + let chromedriver = binary_install::path::local_bin_path(&tests, "chromedriver"); FETCH_CHROMEDRIVER.call_once(|| { if chromedriver.is_file() { @@ -238,12 +239,12 @@ impl Fixture { assert!(chromedriver.is_file()); }); - wasm_pack::binaries::ensure_local_bin_dir(&self.path) + binary_install::path::ensure_local_bin_dir(&self.path) .expect("could not create fixture's `bin` directory"); hard_link_or_copy( &chromedriver, - wasm_pack::binaries::local_bin_path(&self.path, "chromedriver"), + binary_install::path::local_bin_path(&self.path, "chromedriver"), ) .expect("could not copy `chromedriver` to fixture directory"); From ac70220610f832815ae3bf94be8ee31ef80ee674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Mon, 15 Oct 2018 21:33:24 +0200 Subject: [PATCH 002/106] Remove authors from binary-install Cargo.toml --- binary-install/Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/binary-install/Cargo.toml b/binary-install/Cargo.toml index 2912fcb..a525303 100644 --- a/binary-install/Cargo.toml +++ b/binary-install/Cargo.toml @@ -1,7 +1,6 @@ [package] name = "binary-install" version = "0.1.0" -authors = ["Jesper Håkansson "] [dependencies] curl = "0.4.13" From 16a169bd525ddb6dcd796d3f7968330bb480d143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Mon, 29 Oct 2018 19:18:29 +0100 Subject: [PATCH 003/106] fix: Exclude target so tests works --- Cargo.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index b739d3e..8282b47 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,8 @@ categories = ["wasm"] documentation = "https://rustwasm.github.io/wasm-pack/" [workspace] -members = [".", "binary-install"] +members = ["binary-install"] +exclude = ["target"] [dependencies] atty = "0.2.11" From 65d060cfc417998df1941a1a45dd71aaa7bf8989 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Mon, 29 Oct 2018 19:54:46 +0100 Subject: [PATCH 004/106] chore: Run latest rustfmt --- src/error.rs | 5 +--- tests/all/bindgen.rs | 26 +++++++++--------- tests/all/manifest.rs | 63 ++++++++++++++++++++++--------------------- 3 files changed, 46 insertions(+), 48 deletions(-) diff --git a/src/error.rs b/src/error.rs index 4fcc513..75c43b3 100644 --- a/src/error.rs +++ b/src/error.rs @@ -49,10 +49,7 @@ pub enum Error { /// An error invoking another CLI tool. #[fail( display = "Process exited with {}: {}.\n\nstdout:{}\n\nstderr:\n\n{}", - exit_status, - message, - stdout, - stderr + exit_status, message, stdout, stderr )] Cli { /// Error message. diff --git a/tests/all/bindgen.rs b/tests/all/bindgen.rs index b79d58c..4892019 100644 --- a/tests/all/bindgen.rs +++ b/tests/all/bindgen.rs @@ -11,20 +11,18 @@ fn can_download_prebuilt_wasm_bindgen() { use std::env; let dir = tempfile::TempDir::new().unwrap(); bindgen::download_prebuilt_wasm_bindgen(dir.path(), "0.2.21").unwrap(); - assert!( - dir.path() - .join("bin") - .join("wasm-bindgen") - .with_extension(env::consts::EXE_EXTENSION) - .is_file() - ); - assert!( - dir.path() - .join("bin") - .join("wasm-bindgen-test-runner") - .with_extension(env::consts::EXE_EXTENSION) - .is_file() - ); + assert!(dir + .path() + .join("bin") + .join("wasm-bindgen") + .with_extension(env::consts::EXE_EXTENSION) + .is_file()); + assert!(dir + .path() + .join("bin") + .join("wasm-bindgen-test-runner") + .with_extension(env::consts::EXE_EXTENSION) + .is_file()); } #[test] diff --git a/tests/all/manifest.rs b/tests/all/manifest.rs index 1add2b7..459b8ab 100644 --- a/tests/all/manifest.rs +++ b/tests/all/manifest.rs @@ -83,9 +83,9 @@ fn it_creates_a_package_json_default_path() { "js_hello_world.d.ts", "js_hello_world.js", ] - .iter() - .map(|&s| String::from(s)) - .collect(); + .iter() + .map(|&s| String::from(s)) + .collect(); assert_eq!(actual_files, expected_files); } @@ -109,9 +109,9 @@ fn it_creates_a_package_json_provided_path() { "js_hello_world.d.ts", "js_hello_world.js", ] - .iter() - .map(|&s| String::from(s)) - .collect(); + .iter() + .map(|&s| String::from(s)) + .collect(); assert_eq!(actual_files, expected_files); } @@ -121,17 +121,15 @@ fn it_creates_a_package_json_provided_path_with_scope() { let out_dir = fixture.path.join("pkg"); let step = wasm_pack::progressbar::Step::new(1); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); - assert!( - manifest::write_package_json( - &fixture.path, - &out_dir, - &Some("test".to_string()), - false, - "", - &step - ) - .is_ok() - ); + assert!(manifest::write_package_json( + &fixture.path, + &out_dir, + &Some("test".to_string()), + false, + "", + &step + ) + .is_ok()); let package_json_path = &fixture.path.join("pkg").join("package.json"); assert!(fs::metadata(package_json_path).is_ok()); assert!(utils::manifest::read_package_json(&fixture.path, &out_dir).is_ok()); @@ -145,9 +143,9 @@ fn it_creates_a_package_json_provided_path_with_scope() { "js_hello_world.d.ts", "js_hello_world.js", ] - .iter() - .map(|&s| String::from(s)) - .collect(); + .iter() + .map(|&s| String::from(s)) + .collect(); assert_eq!(actual_files, expected_files); } @@ -180,9 +178,9 @@ fn it_creates_a_pkg_json_with_correct_files_on_node() { "js_hello_world_bg.js", "js_hello_world.d.ts", ] - .iter() - .map(|&s| String::from(s)) - .collect(); + .iter() + .map(|&s| String::from(s)) + .collect(); assert_eq!(actual_files, expected_files); } @@ -192,10 +190,15 @@ fn it_creates_a_pkg_json_with_correct_files_on_nomodules() { let out_dir = fixture.path.join("pkg"); let step = wasm_pack::progressbar::Step::new(1); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); - assert!( - manifest::write_package_json(&fixture.path, &out_dir, &None, false, "no-modules", &step) - .is_ok() - ); + assert!(manifest::write_package_json( + &fixture.path, + &out_dir, + &None, + false, + "no-modules", + &step + ) + .is_ok()); let package_json_path = &out_dir.join("package.json"); assert!(fs::metadata(package_json_path).is_ok()); utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); @@ -215,9 +218,9 @@ fn it_creates_a_pkg_json_with_correct_files_on_nomodules() { "js_hello_world.js", "js_hello_world.d.ts", ] - .iter() - .map(|&s| String::from(s)) - .collect(); + .iter() + .map(|&s| String::from(s)) + .collect(); assert_eq!(actual_files, expected_files); } From 69ee13b3b318adbe2b43eb8495b491029a5d9c20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Mon, 29 Oct 2018 20:50:14 +0100 Subject: [PATCH 005/106] test: Add tests for path functions --- Cargo.lock | 2 ++ binary-install/Cargo.toml | 2 ++ binary-install/tests/path.rs | 70 ++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 binary-install/tests/path.rs diff --git a/Cargo.lock b/Cargo.lock index 704e56d..24177a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -58,6 +58,8 @@ dependencies = [ "failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-term 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "tar 0.4.17 (registry+https://github.com/rust-lang/crates.io-index)", "which 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "zip 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/binary-install/Cargo.toml b/binary-install/Cargo.toml index a525303..bf51cf1 100644 --- a/binary-install/Cargo.toml +++ b/binary-install/Cargo.toml @@ -7,6 +7,8 @@ curl = "0.4.13" failure = "0.1.2" flate2 = "1.0.2" slog = "2.3" +slog-term = "2.4" +slog-async = "2.3" tar = "0.4.16" which = "2.0.0" zip = "0.4.2" diff --git a/binary-install/tests/path.rs b/binary-install/tests/path.rs new file mode 100644 index 0000000..f6463c1 --- /dev/null +++ b/binary-install/tests/path.rs @@ -0,0 +1,70 @@ +extern crate binary_install; +#[macro_use] +extern crate slog; +extern crate slog_async; +extern crate slog_term; + +use binary_install::path::{bin_path, ensure_local_bin_dir, local_bin_path}; +use slog::Drain; +use std::path::Path; + +fn logger() -> slog::Logger { + let decorator = slog_term::TermDecorator::new().build(); + let drain = slog_term::FullFormat::new(decorator).build().fuse(); + let drain = slog_async::Async::new(drain).build().fuse(); + slog::Logger::root(drain, o!()) +} + +#[test] +fn it_should_get_local_bin_path() { + let crate_path = Path::new(""); + + let expected_path = Path::new("bin/wasm-bindgen"); + + let result = local_bin_path(crate_path, "wasm-bindgen"); + + assert_eq!(expected_path, result); +} + +#[test] +#[cfg(target_os = "windows")] +fn it_should_get_local_bin_path_with_exe_for_windows() { + let crate_path = Path::new(""); + + let expected_path = Path::new("bin/wasm-bindgen.exe"); + + let result = local_bin_path(crate_path, "wasm-bindgen"); + + assert_eq!(expected_path, result); +} + +#[test] +fn it_should_ensure_local_bin_dir_returns_ok_for_folder_that_exists() { + let crate_path = Path::new("random_folder"); + + let result = ensure_local_bin_dir(crate_path); + + assert!(result.is_ok()); +} + +#[test] +fn it_should_return_some_for_bin_path_that_exists() { + let crate_path = Path::new("/usr/bin"); + let bin = "ls"; + + let result = bin_path(&logger(), crate_path, bin); + let expected_bin = Path::new("/usr/bin/ls"); + + assert!(result.is_some()); + assert_eq!(result.unwrap(), expected_bin); +} + +#[test] +fn it_should_return_none_for_bin_path_that_does_not_exists() { + let crate_path = Path::new("random_folder"); + let bin = "wasm-bindgen"; + + let result = bin_path(&logger(), crate_path, bin); + + assert!(result.is_none()); +} From 8150ba39fb06f06b7ef34004f3c446aeb6a1b77a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Tue, 30 Oct 2018 21:56:21 +0100 Subject: [PATCH 006/106] chore: Run cargo update --- Cargo.lock | 82 +++++++++++++++++++++++++++--------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dec612c..9cd245f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5,10 +5,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "aho-corasick" -version = "0.6.8" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -55,8 +55,8 @@ name = "binary-install" version = "0.1.0" dependencies = [ "curl 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-term 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -77,7 +77,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "byteorder" -version = "1.2.6" +version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -209,7 +209,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "libz-sys 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", + "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -239,9 +239,9 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.13 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.16 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -363,7 +363,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libz-sys" -version = "1.0.24" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", @@ -383,7 +383,7 @@ dependencies = [ [[package]] name = "memchr" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -536,7 +536,7 @@ dependencies = [ [[package]] name = "quote" -version = "0.6.8" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", @@ -595,11 +595,11 @@ name = "regex" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -607,11 +607,11 @@ name = "regex" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -619,7 +619,7 @@ name = "regex-syntax" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ucd-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -627,7 +627,7 @@ name = "regex-syntax" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ucd-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -695,8 +695,8 @@ version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.13 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -780,28 +780,28 @@ version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.13 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "syn" -version = "0.15.13" +version = "0.15.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "synstructure" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.13 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.16 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -848,7 +848,7 @@ name = "term" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -914,7 +914,7 @@ dependencies = [ [[package]] name = "ucd-util" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -937,7 +937,7 @@ dependencies = [ [[package]] name = "utf8-ranges" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1067,14 +1067,14 @@ dependencies = [ [metadata] "checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c" -"checksum aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "68f56c7353e5a9547cbd76ed90f7bb5ffc3ba09d4ea9bd1d8c06c8b1142eeb5a" +"checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" "checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" "checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" "checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39" -"checksum byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "90492c5858dd7d2e78691cfb89f90d273a2800fc11d98f60786e5d87e2f83781" +"checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" "checksum bzip2 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "42b7c3cbf0fa9c1b82308d57191728ca0256cb821220f4e2fd410a72ade26e3b" "checksum bzip2-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2c5162604199bbb17690ede847eaa6120a3f33d5ab4dcc8e7c25b16d849ae79b" "checksum cargo_metadata 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1aaa1a9856ae2d188340526d0986feb6899c9ad11c5dfd73453c784fed6e373d" @@ -1105,9 +1105,9 @@ dependencies = [ "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7" "checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" -"checksum libz-sys 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "4401fe74560a0d46fce3464625ac8aa7a79d291dd28cee021d18852d5191c280" +"checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" "checksum lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "775751a3e69bde4df9b38dd00a1b5d6ac13791e4223d4a0506577f0dd27cfb7a" -"checksum memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b3629fe9fdbff6daa6c33b90f7c08355c1aca05a3d01fa8063b822fcf185f3b" +"checksum memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0a3eb002f0535929f1199681417029ebea04aadc0c7a4224b46be99c7f5d6a16" "checksum miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649" "checksum miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad30a47319c16cde58d0314f5d98202a80c9083b5f61178457403dfb14e509c" "checksum miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28edaef377517fd9fe3e085c37d892ce7acd1fbeab9239c5a36eec352d8a8b7e" @@ -1125,7 +1125,7 @@ dependencies = [ "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" "checksum podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "780fb4b6698bbf9cf2444ea5d22411cef2953f0824b98f33cf454ec5615645bd" "checksum proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "3d7b7eaaa90b4a90a932a9ea6666c95a389e424eff347f0f793979289429feee" -"checksum quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dd636425967c33af890042c483632d33fa7a18f19ad1d7ea72e8998c6ef8dea5" +"checksum quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "63b5829244f52738cfee93b3a165c1911388675be000c888d2fae620dee8fa5b" "checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" "checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" "checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372" @@ -1156,8 +1156,8 @@ dependencies = [ "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" "checksum structopt 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "d77af7242f18c40fd19cb270985930f239ee1646cfb482050bbae9da1d18743b" "checksum structopt-derive 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "17ff01fe96de9d16e7372ae5f19dd7ece2c703b51043c3db9ea27f9e393ea311" -"checksum syn 0.15.13 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4439ee8325b4e4b57e59309c3724c9a4478eaeb4eb094b6f3fac180a3b2876" -"checksum synstructure 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec37f4fab4bafaf6b5621c1d54e6aa5d4d059a8f84929e87abfdd7f9f04c6db2" +"checksum syn 0.15.16 (registry+https://github.com/rust-lang/crates.io-index)" = "0b78d53b5e1b6e63129140b1336877c3bddbae398c7956150396bdad0e28676c" +"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" "checksum tar 0.4.17 (registry+https://github.com/rust-lang/crates.io-index)" = "83b0d14b53dbfd62681933fadd651e815f99e6084b649e049ab99296e05ab3de" "checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" @@ -1170,11 +1170,11 @@ dependencies = [ "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "d825be0eb33fda1a7e68012d51e9c7f451dc1a69391e7fdc197060bb8c56667b" "checksum toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4a2ecc31b0351ea18b3fe11274b8db6e4d82bce861bbb22e6dbed40417902c65" -"checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d" +"checksum ucd-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d0f8bfa9ff0cadcd210129ad9d2c5f145c13e9ced3d3e5d948a6213487d52444" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" -"checksum utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd70f467df6810094968e2fce0ee1bd0e87157aceb026a8c083bcf5e25b9efe4" +"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" "checksum uuid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e1436e58182935dcd9ce0add9ea0b558e8a87befe01c1a301e6020aeb0876363" "checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" From 70df15fcca9126a2507fbc19e2946b8b3223d6e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Tue, 30 Oct 2018 22:17:05 +0100 Subject: [PATCH 007/106] test: Rework and rename path tests --- binary-install/tests/path.rs | 51 +++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/binary-install/tests/path.rs b/binary-install/tests/path.rs index f6463c1..3225fe9 100644 --- a/binary-install/tests/path.rs +++ b/binary-install/tests/path.rs @@ -6,7 +6,10 @@ extern crate slog_term; use binary_install::path::{bin_path, ensure_local_bin_dir, local_bin_path}; use slog::Drain; -use std::path::Path; +use std::env::current_dir; +use std::fs; +use std::io; +use std::path::{Path, PathBuf}; fn logger() -> slog::Logger { let decorator = slog_term::TermDecorator::new().build(); @@ -15,8 +18,13 @@ fn logger() -> slog::Logger { slog::Logger::root(drain, o!()) } +fn get_tests_bin_path() -> PathBuf { + let path = current_dir().unwrap(); + path.join("tests/bin") +} + #[test] -fn it_should_get_local_bin_path() { +fn get_local_bin_path_should_return_a_path() { let crate_path = Path::new(""); let expected_path = Path::new("bin/wasm-bindgen"); @@ -28,7 +36,7 @@ fn it_should_get_local_bin_path() { #[test] #[cfg(target_os = "windows")] -fn it_should_get_local_bin_path_with_exe_for_windows() { +fn get_local_bin_path_should_return_with_exe_for_windows() { let crate_path = Path::new(""); let expected_path = Path::new("bin/wasm-bindgen.exe"); @@ -39,32 +47,33 @@ fn it_should_get_local_bin_path_with_exe_for_windows() { } #[test] -fn it_should_ensure_local_bin_dir_returns_ok_for_folder_that_exists() { - let crate_path = Path::new("random_folder"); +fn ensure_local_bin_dir_should_return_ok_for_folder_that_exists() { + let crate_path = get_tests_bin_path(); - let result = ensure_local_bin_dir(crate_path); + fs::create_dir_all(crate_path.to_owned()).unwrap(); + + let result = ensure_local_bin_dir(&crate_path); assert!(result.is_ok()); + + fs::remove_dir_all(crate_path).unwrap(); } #[test] -fn it_should_return_some_for_bin_path_that_exists() { - let crate_path = Path::new("/usr/bin"); - let bin = "ls"; +fn ensure_local_bin_dir_should_create_folder_if_it_doesnt_exist() { + let crate_path = get_tests_bin_path(); - let result = bin_path(&logger(), crate_path, bin); - let expected_bin = Path::new("/usr/bin/ls"); + // Make sure that the folder doesn't exist + // before we call ensure_local_bin_dir(); + let dir = fs::read_dir(crate_path.to_owned()); + let dir_error = dir.err().unwrap(); + assert_eq!(dir_error.kind(), io::ErrorKind::NotFound); - assert!(result.is_some()); - assert_eq!(result.unwrap(), expected_bin); -} - -#[test] -fn it_should_return_none_for_bin_path_that_does_not_exists() { - let crate_path = Path::new("random_folder"); - let bin = "wasm-bindgen"; + let result = ensure_local_bin_dir(&crate_path); - let result = bin_path(&logger(), crate_path, bin); + assert!(result.is_ok()); - assert!(result.is_none()); + // Make sure that the directory actually exists. + let dir = fs::read_dir(crate_path.to_owned()); + assert!(dir.is_ok()); } From 37dac09ce53035c825093eb158355d083d9241ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Wed, 31 Oct 2018 20:25:50 +0100 Subject: [PATCH 008/106] test: More tests for path functions as well as minor fixes --- binary-install/tests/path.rs | 45 +++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/binary-install/tests/path.rs b/binary-install/tests/path.rs index 3225fe9..b32bbcd 100644 --- a/binary-install/tests/path.rs +++ b/binary-install/tests/path.rs @@ -20,10 +20,11 @@ fn logger() -> slog::Logger { fn get_tests_bin_path() -> PathBuf { let path = current_dir().unwrap(); - path.join("tests/bin") + path.join("tests") } #[test] +#[cfg(not(target_ = "wasm32"))] fn get_local_bin_path_should_return_a_path() { let crate_path = Path::new(""); @@ -48,7 +49,7 @@ fn get_local_bin_path_should_return_with_exe_for_windows() { #[test] fn ensure_local_bin_dir_should_return_ok_for_folder_that_exists() { - let crate_path = get_tests_bin_path(); + let crate_path = get_tests_bin_path().join("bin2"); fs::create_dir_all(crate_path.to_owned()).unwrap(); @@ -61,7 +62,7 @@ fn ensure_local_bin_dir_should_return_ok_for_folder_that_exists() { #[test] fn ensure_local_bin_dir_should_create_folder_if_it_doesnt_exist() { - let crate_path = get_tests_bin_path(); + let crate_path = get_tests_bin_path().join("bin3"); // Make sure that the folder doesn't exist // before we call ensure_local_bin_dir(); @@ -76,4 +77,42 @@ fn ensure_local_bin_dir_should_create_folder_if_it_doesnt_exist() { // Make sure that the directory actually exists. let dir = fs::read_dir(crate_path.to_owned()); assert!(dir.is_ok()); + + fs::remove_dir_all(crate_path).unwrap(); +} + +#[test] +fn bin_path_should_return_some_for_path_that_exists() { + let crate_path = get_tests_bin_path(); + let bin_file = "wasm-bindgen"; + let full_bin_path = crate_path.join("bin"); + let path_with_bin_file = full_bin_path.join(bin_file); + + fs::create_dir_all(full_bin_path.to_owned()).unwrap(); + fs::File::create(path_with_bin_file.to_owned()).unwrap(); + + let result = bin_path(&logger(), &crate_path, bin_file); + + assert!(result.is_some()); + assert_eq!(path_with_bin_file, result.unwrap()); + + fs::remove_dir_all(full_bin_path).unwrap(); +} + +#[test] +fn bin_path_should_return_none_for_path_that_does_not_exists() { + let crate_path = get_tests_bin_path(); + let bin_file = "wasm-binfile"; + let full_bin_path = crate_path.join("bin_path"); + let path_with_bin_file = full_bin_path.join(bin_file); + + // Make sure that the folder doesn't exist + // before we call bin_path(); + let file = fs::File::open(path_with_bin_file.to_owned()); + let file_error = file.err().unwrap(); + assert_eq!(file_error.kind(), io::ErrorKind::NotFound); + + let result = bin_path(&logger(), &crate_path, bin_file); + + assert!(result.is_none()); } From 10080c27944913a6b3aaa2db7a4377ec2e598e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Wed, 31 Oct 2018 20:41:16 +0100 Subject: [PATCH 009/106] fix: not(target_os = "windows") --- binary-install/tests/path.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binary-install/tests/path.rs b/binary-install/tests/path.rs index b32bbcd..1c0e21d 100644 --- a/binary-install/tests/path.rs +++ b/binary-install/tests/path.rs @@ -24,7 +24,7 @@ fn get_tests_bin_path() -> PathBuf { } #[test] -#[cfg(not(target_ = "wasm32"))] +#[cfg(not(target_os = "windows"))] fn get_local_bin_path_should_return_a_path() { let crate_path = Path::new(""); From d5faedd200c138d95d4ee495bebace07733aedce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Thu, 1 Nov 2018 21:02:27 +0100 Subject: [PATCH 010/106] test: Add initial tests for exposed functions in lib --- binary-install/src/lib.rs | 3 +- binary-install/tests/test.rs | 73 ++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 binary-install/tests/test.rs diff --git a/binary-install/src/lib.rs b/binary-install/src/lib.rs index 3ff5e4b..728ee12 100644 --- a/binary-install/src/lib.rs +++ b/binary-install/src/lib.rs @@ -47,7 +47,8 @@ where let bin = local_bin_dir(crate_path); for entry in archive.entries()? { - let mut entry = entry?; + let mut entry = + entry.map_err(|_err| Error::archive(&format!("Invalid tarball at {}", url)))?; let dest = match entry.path()?.file_stem() { Some(f) if binaries.contains(f) => { diff --git a/binary-install/tests/test.rs b/binary-install/tests/test.rs new file mode 100644 index 0000000..73f4298 --- /dev/null +++ b/binary-install/tests/test.rs @@ -0,0 +1,73 @@ +extern crate binary_install; +extern crate curl; +extern crate failure; + +use binary_install::{error::Error, install_binaries_from_targz_at_url}; +use std::io::{Read, Write}; +use std::net::TcpListener; +use std::path::Path; +use std::thread; + +const SERVER_URL: &'static str = "localhost:7878"; + +fn start_server() -> thread::JoinHandle { + thread::spawn(|| { + let listener = TcpListener::bind(SERVER_URL).unwrap(); + for stream in listener.incoming() { + let mut stream = stream.unwrap(); + + let mut buffer = [0; 512]; + + stream.read(&mut buffer).unwrap(); + + let response = "HTTP/1.1 200 OK\r\n\r\n"; + + stream.write(response.as_bytes()).unwrap(); + stream.flush().unwrap(); + } + listener + }) +} + +#[test] +fn install_binaries_from_targz_at_url_should_return_http_error_for_bad_url() { + let crate_path = Path::new(""); + let url = ""; + let binaries = vec![""]; + + let result = install_binaries_from_targz_at_url(crate_path, url, binaries); + assert!(result.is_err()); + + let err = result.err().unwrap(); + let err = err.downcast_ref::().unwrap(); + + let expected_message = format!("when requesting {}", url); + + match err { + Error::Http { message } => assert_eq!(&expected_message, message), + _ => panic!("Wrong error returned"), + } +} + +#[test] +fn install_binaries_from_targz_at_url_should_return_archive_error_when_tarball_is_missing() { + let crate_path = Path::new(""); + let url = format!("http://{}", SERVER_URL); + let binaries = vec![""]; + + // Spin up a local TcpListener. + start_server(); + + let result = install_binaries_from_targz_at_url(crate_path, &url, binaries); + assert!(result.is_err()); + + let err = result.err().unwrap(); + let err = err.downcast_ref::().unwrap(); + + let expected_message = format!("Invalid tarball at {}", url); + + match err { + Error::Archive { message } => assert_eq!(&expected_message, message), + _ => panic!("Wrong error returned"), + } +} From 98b405c36605ba2d702091d843f61d1b32548749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Sat, 3 Nov 2018 15:00:50 +0100 Subject: [PATCH 011/106] refactor: Use env::temp_dir() instead of current_dir() for tests --- binary-install/tests/path.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/binary-install/tests/path.rs b/binary-install/tests/path.rs index 1c0e21d..a9c3b95 100644 --- a/binary-install/tests/path.rs +++ b/binary-install/tests/path.rs @@ -6,7 +6,7 @@ extern crate slog_term; use binary_install::path::{bin_path, ensure_local_bin_dir, local_bin_path}; use slog::Drain; -use std::env::current_dir; +use std::env; use std::fs; use std::io; use std::path::{Path, PathBuf}; @@ -19,7 +19,7 @@ fn logger() -> slog::Logger { } fn get_tests_bin_path() -> PathBuf { - let path = current_dir().unwrap(); + let path = env::temp_dir(); path.join("tests") } From fa68a0d91f5c5973b9519b42d09c91d5b71c234a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Mon, 5 Nov 2018 21:54:42 +0100 Subject: [PATCH 012/106] test: Create and return tarball in tests, add more test cases --- binary-install/src/lib.rs | 5 +- binary-install/tests/path.rs | 13 ++-- binary-install/tests/test.rs | 111 ++++++++++++++++++++++++++++++++--- 3 files changed, 112 insertions(+), 17 deletions(-) diff --git a/binary-install/src/lib.rs b/binary-install/src/lib.rs index 728ee12..09f6982 100644 --- a/binary-install/src/lib.rs +++ b/binary-install/src/lib.rs @@ -47,8 +47,9 @@ where let bin = local_bin_dir(crate_path); for entry in archive.entries()? { - let mut entry = - entry.map_err(|_err| Error::archive(&format!("Invalid tarball at {}", url)))?; + let mut entry = entry.map_err(|err| { + Error::archive(&format!("Invalid tarball at {}. Inner error: {}", url, err)) + })?; let dest = match entry.path()?.file_stem() { Some(f) if binaries.contains(f) => { diff --git a/binary-install/tests/path.rs b/binary-install/tests/path.rs index a9c3b95..08139ec 100644 --- a/binary-install/tests/path.rs +++ b/binary-install/tests/path.rs @@ -9,7 +9,7 @@ use slog::Drain; use std::env; use std::fs; use std::io; -use std::path::{Path, PathBuf}; +use std::path::PathBuf; fn logger() -> slog::Logger { let decorator = slog_term::TermDecorator::new().build(); @@ -26,11 +26,10 @@ fn get_tests_bin_path() -> PathBuf { #[test] #[cfg(not(target_os = "windows"))] fn get_local_bin_path_should_return_a_path() { - let crate_path = Path::new(""); - - let expected_path = Path::new("bin/wasm-bindgen"); + let crate_path = get_tests_bin_path(); + let expected_path = crate_path.join("bin/wasm-bindgen"); - let result = local_bin_path(crate_path, "wasm-bindgen"); + let result = local_bin_path(&crate_path, "wasm-bindgen"); assert_eq!(expected_path, result); } @@ -38,9 +37,9 @@ fn get_local_bin_path_should_return_a_path() { #[test] #[cfg(target_os = "windows")] fn get_local_bin_path_should_return_with_exe_for_windows() { - let crate_path = Path::new(""); + let crate_path = get_tests_bin_path(); - let expected_path = Path::new("bin/wasm-bindgen.exe"); + let expected_path = crate_path.join("bin/wasm-bindgen.exe"); let result = local_bin_path(crate_path, "wasm-bindgen"); diff --git a/binary-install/tests/test.rs b/binary-install/tests/test.rs index 73f4298..923688b 100644 --- a/binary-install/tests/test.rs +++ b/binary-install/tests/test.rs @@ -1,18 +1,25 @@ extern crate binary_install; extern crate curl; extern crate failure; +extern crate flate2; +extern crate tar; use binary_install::{error::Error, install_binaries_from_targz_at_url}; -use std::io::{Read, Write}; +use flate2::write::GzEncoder; +use flate2::Compression; +use std::env; +use std::fs::{File, OpenOptions}; +use std::io::{self, Read, Write}; use std::net::TcpListener; use std::path::Path; use std::thread; -const SERVER_URL: &'static str = "localhost:7878"; +const SERVER_HOST: &'static str = "localhost"; + +fn start_server(port: u32, tarball: Option>) -> thread::JoinHandle { + thread::spawn(move || { + let listener = TcpListener::bind(format!("{}:{}", SERVER_HOST, port)).unwrap(); -fn start_server() -> thread::JoinHandle { - thread::spawn(|| { - let listener = TcpListener::bind(SERVER_URL).unwrap(); for stream in listener.incoming() { let mut stream = stream.unwrap(); @@ -23,12 +30,49 @@ fn start_server() -> thread::JoinHandle { let response = "HTTP/1.1 200 OK\r\n\r\n"; stream.write(response.as_bytes()).unwrap(); + + match tarball.to_owned() { + Some(tar) => { + stream.write(tar.as_ref()).unwrap(); + } + None => {} + } + stream.flush().unwrap(); } listener }) } +fn create_tarball(binary_name: &str) -> Result, io::Error> { + let temp_dir = env::temp_dir(); + let tar = OpenOptions::new() + .create(true) + .read(true) + .write(true) + .open(temp_dir.join("foo.tar.gz"))?; + + let mut file = OpenOptions::new() + .create(true) + .read(true) + .write(true) + .open(temp_dir.join(binary_name))?; + + let mut encoder = GzEncoder::new(tar, Compression::default()); + { + let mut archive = tar::Builder::new(&mut encoder); + archive.append_file(binary_name, &mut file)?; + } + + let mut contents = vec![]; + + encoder.finish()?; + + File::open(temp_dir.join("foo.tar.gz"))?.read_to_end(&mut contents)?; + + Ok(contents) +} + #[test] fn install_binaries_from_targz_at_url_should_return_http_error_for_bad_url() { let crate_path = Path::new(""); @@ -51,12 +95,43 @@ fn install_binaries_from_targz_at_url_should_return_http_error_for_bad_url() { #[test] fn install_binaries_from_targz_at_url_should_return_archive_error_when_tarball_is_missing() { + let server_port = 7878; + let url = format!("http://{}:{}", SERVER_HOST, server_port); let crate_path = Path::new(""); - let url = format!("http://{}", SERVER_URL); let binaries = vec![""]; // Spin up a local TcpListener. - start_server(); + start_server(server_port, None); + + let result = install_binaries_from_targz_at_url(crate_path, &url, binaries); + assert!(result.is_err()); + + let err = result.err().unwrap(); + let err = err.downcast_ref::().unwrap(); + + let expected_message = format!( + "Invalid tarball at {}. Inner error: failed to fill whole buffer", + url + ); + + match err { + Error::Archive { message } => assert_eq!(&expected_message, message), + _ => panic!("Wrong error returned"), + } +} + +#[test] +fn install_binaries_from_targz_at_url_should_return_archive_error_when_tarball_does_not_include_all_files( +) { + let server_port = 7879; + let url = format!("http://{}:{}", SERVER_HOST, server_port); + let crate_path = Path::new(""); + let binaries = vec!["wasm-pack"]; + + // Create a temporary tarball. + let tarball = create_tarball("foo.txt").ok(); + // Spin up a local TcpListener. + start_server(server_port, tarball); let result = install_binaries_from_targz_at_url(crate_path, &url, binaries); assert!(result.is_err()); @@ -64,10 +139,30 @@ fn install_binaries_from_targz_at_url_should_return_archive_error_when_tarball_i let err = result.err().unwrap(); let err = err.downcast_ref::().unwrap(); - let expected_message = format!("Invalid tarball at {}", url); + let expected_message = format!( + "the tarball at {} was missing expected executables: {}", + url, "wasm-pack" + ); match err { Error::Archive { message } => assert_eq!(&expected_message, message), _ => panic!("Wrong error returned"), } } + +#[test] +fn install_binaries_from_targz_at_url_should_return_ok_if_binary_is_found() { + let server_port = 7880; + let url = format!("http://{}:{}", SERVER_HOST, server_port); + let binary_name = "wasm-pack"; + let crate_path = Path::new(""); + let binaries = vec![binary_name]; + + // Create a temporary tarball. + let tarball = create_tarball(binary_name).ok(); + // Spin up a local TcpListener. + start_server(server_port, tarball); + + let result = install_binaries_from_targz_at_url(crate_path, &url, binaries); + assert!(result.is_ok()); +} From 714a8a1581bf31fb89c5c849b8b2bc4735d84063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Tue, 6 Nov 2018 20:43:37 +0100 Subject: [PATCH 013/106] refactor: Remove unneeded code, since master has changed a lot The modules and tests are no longer relevant since master has changed a lot since the code was split into smalled modules. --- binary-install/src/error.rs | 44 --------- binary-install/src/fetch.rs | 47 ---------- binary-install/src/path.rs | 76 ---------------- binary-install/src/target.rs | 8 -- binary-install/tests/path.rs | 117 ------------------------ binary-install/tests/test.rs | 168 ----------------------------------- 6 files changed, 460 deletions(-) delete mode 100644 binary-install/src/error.rs delete mode 100644 binary-install/src/fetch.rs delete mode 100644 binary-install/src/path.rs delete mode 100644 binary-install/src/target.rs delete mode 100644 binary-install/tests/path.rs delete mode 100644 binary-install/tests/test.rs diff --git a/binary-install/src/error.rs b/binary-install/src/error.rs deleted file mode 100644 index 11fa2f0..0000000 --- a/binary-install/src/error.rs +++ /dev/null @@ -1,44 +0,0 @@ -//! Code related to error handling for binary-install - -/// Errors that can potentially occur in `binary-install`. -#[derive(Debug, Fail)] -pub enum Error { - #[fail(display = "{}", message)] - /// An error related to an archive that we downloaded. - Archive { - /// Error message. - message: String, - }, - - #[fail(display = "{}", message)] - /// Error related to some HTTP request. - Http { - /// Error message. - message: String, - }, -} - -impl Error { - /// Construct an archive error. - pub fn archive(message: &str) -> Self { - Error::Archive { - message: message.to_string(), - } - } - - /// Construct an http error. - pub fn http(message: &str) -> Self { - Error::Http { - message: message.to_string(), - } - } - - /// Get a string description of this error's type. - pub fn error_type(&self) -> String { - match self { - Error::Archive { .. } => "There was an error related to an archive file. Details:\n\n", - Error::Http { .. } => "There wasn an HTTP error. Details:\n\n", - } - .to_string() - } -} diff --git a/binary-install/src/fetch.rs b/binary-install/src/fetch.rs deleted file mode 100644 index 31772ee..0000000 --- a/binary-install/src/fetch.rs +++ /dev/null @@ -1,47 +0,0 @@ -use error::Error; -use failure; - -pub fn curl(url: &str) -> Result, failure::Error> { - let mut data = Vec::new(); - - let mut easy = curl::easy::Easy::new(); - with_url_context(url, easy.follow_location(true))?; - with_url_context(url, easy.url(url))?; - transfer(url, &mut easy, &mut data)?; - - let status_code = with_url_context(url, easy.response_code())?; - if 200 <= status_code && status_code < 300 { - Ok(data) - } else { - Err(Error::http(&format!( - "received a bad HTTP status code ({}) when requesting {}", - status_code, url - )) - .into()) - } -} - -fn with_url_context(url: &str, r: Result) -> Result -where - Result: failure::ResultExt, -{ - use failure::ResultExt; - r.with_context(|_| format!("when requesting {}", url)) -} - -fn transfer( - url: &str, - easy: &mut curl::easy::Easy, - data: &mut Vec, -) -> Result<(), failure::Error> { - let mut transfer = easy.transfer(); - with_url_context( - url, - transfer.write_function(|part| { - data.extend_from_slice(part); - Ok(part.len()) - }), - )?; - with_url_context(url, transfer.perform())?; - Ok(()) -} diff --git a/binary-install/src/path.rs b/binary-install/src/path.rs deleted file mode 100644 index 3f58ec2..0000000 --- a/binary-install/src/path.rs +++ /dev/null @@ -1,76 +0,0 @@ -use slog::Logger; -use std::fs; -use std::io; -use std::path::{Path, PathBuf}; -use target; -use which::which; - -/// Get the path for a crate's directory of locally-installed binaries. -/// -/// This does not check whether or ensure that the directory exists. -pub fn local_bin_dir(crate_path: &Path) -> PathBuf { - crate_path.join("bin") -} - -/// Ensure that the crate's directory for locally-installed binaries exists. -pub fn ensure_local_bin_dir(crate_path: &Path) -> io::Result<()> { - fs::create_dir_all(local_bin_dir(crate_path)) -} - -/// Get the path for where `bin` would be if we have a crate-local install for -/// it. -/// -/// This does *not* check whether there is a file at that path or not. -/// -/// This will automatically add the `.exe` extension for windows. -pub fn local_bin_path(crate_path: &Path, bin: &str) -> PathBuf { - let mut p = local_bin_dir(crate_path).join(bin); - if target::WINDOWS { - p.set_extension("exe"); - } - p -} - -/// Get the local (at `$CRATE/bin/$BIN`; preferred) or global (on `$PATH`) path -/// for the given binary. -/// -/// If this function returns `Some(path)`, then a file at that path exists (or -/// at least existed when we checked! In general, we aren't really worried about -/// racing with an uninstall of a tool that we rely on.) -pub fn bin_path(log: &Logger, crate_path: &Path, bin: &str) -> Option { - assert!(!bin.ends_with(".exe")); - debug!(log, "Searching for {} binary...", bin); - - // Return the path to the local binary, if it exists. - let local_path = |crate_path: &Path| -> Option { - let p = local_bin_path(crate_path, bin); - debug!(log, "Checking for local {} binary at {}", bin, p.display()); - if p.is_file() { - Some(p) - } else { - None - } - }; - - // Return the path to the global binary, if it exists. - let global_path = || -> Option { - debug!(log, "Looking for global {} binary on $PATH", bin); - if let Ok(p) = which(bin) { - Some(p) - } else { - None - } - }; - - local_path(crate_path) - .or_else(global_path) - .map(|p| { - let p = p.canonicalize().unwrap_or(p); - debug!(log, "Using {} binary at {}", bin, p.display()); - p - }) - .or_else(|| { - debug!(log, "Could not find {} binary.", bin); - None - }) -} diff --git a/binary-install/src/target.rs b/binary-install/src/target.rs deleted file mode 100644 index e3bfb9c..0000000 --- a/binary-install/src/target.rs +++ /dev/null @@ -1,8 +0,0 @@ -//! Information about the target wasm-pack is currently being compiled for. -//! -//! That is, whether we are building wasm-pack for windows vs linux, and x86 vs -//! x86-64, etc. - -#![allow(missing_docs)] - -pub const WINDOWS: bool = cfg!(target_os = "windows"); diff --git a/binary-install/tests/path.rs b/binary-install/tests/path.rs deleted file mode 100644 index 08139ec..0000000 --- a/binary-install/tests/path.rs +++ /dev/null @@ -1,117 +0,0 @@ -extern crate binary_install; -#[macro_use] -extern crate slog; -extern crate slog_async; -extern crate slog_term; - -use binary_install::path::{bin_path, ensure_local_bin_dir, local_bin_path}; -use slog::Drain; -use std::env; -use std::fs; -use std::io; -use std::path::PathBuf; - -fn logger() -> slog::Logger { - let decorator = slog_term::TermDecorator::new().build(); - let drain = slog_term::FullFormat::new(decorator).build().fuse(); - let drain = slog_async::Async::new(drain).build().fuse(); - slog::Logger::root(drain, o!()) -} - -fn get_tests_bin_path() -> PathBuf { - let path = env::temp_dir(); - path.join("tests") -} - -#[test] -#[cfg(not(target_os = "windows"))] -fn get_local_bin_path_should_return_a_path() { - let crate_path = get_tests_bin_path(); - let expected_path = crate_path.join("bin/wasm-bindgen"); - - let result = local_bin_path(&crate_path, "wasm-bindgen"); - - assert_eq!(expected_path, result); -} - -#[test] -#[cfg(target_os = "windows")] -fn get_local_bin_path_should_return_with_exe_for_windows() { - let crate_path = get_tests_bin_path(); - - let expected_path = crate_path.join("bin/wasm-bindgen.exe"); - - let result = local_bin_path(crate_path, "wasm-bindgen"); - - assert_eq!(expected_path, result); -} - -#[test] -fn ensure_local_bin_dir_should_return_ok_for_folder_that_exists() { - let crate_path = get_tests_bin_path().join("bin2"); - - fs::create_dir_all(crate_path.to_owned()).unwrap(); - - let result = ensure_local_bin_dir(&crate_path); - - assert!(result.is_ok()); - - fs::remove_dir_all(crate_path).unwrap(); -} - -#[test] -fn ensure_local_bin_dir_should_create_folder_if_it_doesnt_exist() { - let crate_path = get_tests_bin_path().join("bin3"); - - // Make sure that the folder doesn't exist - // before we call ensure_local_bin_dir(); - let dir = fs::read_dir(crate_path.to_owned()); - let dir_error = dir.err().unwrap(); - assert_eq!(dir_error.kind(), io::ErrorKind::NotFound); - - let result = ensure_local_bin_dir(&crate_path); - - assert!(result.is_ok()); - - // Make sure that the directory actually exists. - let dir = fs::read_dir(crate_path.to_owned()); - assert!(dir.is_ok()); - - fs::remove_dir_all(crate_path).unwrap(); -} - -#[test] -fn bin_path_should_return_some_for_path_that_exists() { - let crate_path = get_tests_bin_path(); - let bin_file = "wasm-bindgen"; - let full_bin_path = crate_path.join("bin"); - let path_with_bin_file = full_bin_path.join(bin_file); - - fs::create_dir_all(full_bin_path.to_owned()).unwrap(); - fs::File::create(path_with_bin_file.to_owned()).unwrap(); - - let result = bin_path(&logger(), &crate_path, bin_file); - - assert!(result.is_some()); - assert_eq!(path_with_bin_file, result.unwrap()); - - fs::remove_dir_all(full_bin_path).unwrap(); -} - -#[test] -fn bin_path_should_return_none_for_path_that_does_not_exists() { - let crate_path = get_tests_bin_path(); - let bin_file = "wasm-binfile"; - let full_bin_path = crate_path.join("bin_path"); - let path_with_bin_file = full_bin_path.join(bin_file); - - // Make sure that the folder doesn't exist - // before we call bin_path(); - let file = fs::File::open(path_with_bin_file.to_owned()); - let file_error = file.err().unwrap(); - assert_eq!(file_error.kind(), io::ErrorKind::NotFound); - - let result = bin_path(&logger(), &crate_path, bin_file); - - assert!(result.is_none()); -} diff --git a/binary-install/tests/test.rs b/binary-install/tests/test.rs deleted file mode 100644 index 923688b..0000000 --- a/binary-install/tests/test.rs +++ /dev/null @@ -1,168 +0,0 @@ -extern crate binary_install; -extern crate curl; -extern crate failure; -extern crate flate2; -extern crate tar; - -use binary_install::{error::Error, install_binaries_from_targz_at_url}; -use flate2::write::GzEncoder; -use flate2::Compression; -use std::env; -use std::fs::{File, OpenOptions}; -use std::io::{self, Read, Write}; -use std::net::TcpListener; -use std::path::Path; -use std::thread; - -const SERVER_HOST: &'static str = "localhost"; - -fn start_server(port: u32, tarball: Option>) -> thread::JoinHandle { - thread::spawn(move || { - let listener = TcpListener::bind(format!("{}:{}", SERVER_HOST, port)).unwrap(); - - for stream in listener.incoming() { - let mut stream = stream.unwrap(); - - let mut buffer = [0; 512]; - - stream.read(&mut buffer).unwrap(); - - let response = "HTTP/1.1 200 OK\r\n\r\n"; - - stream.write(response.as_bytes()).unwrap(); - - match tarball.to_owned() { - Some(tar) => { - stream.write(tar.as_ref()).unwrap(); - } - None => {} - } - - stream.flush().unwrap(); - } - listener - }) -} - -fn create_tarball(binary_name: &str) -> Result, io::Error> { - let temp_dir = env::temp_dir(); - let tar = OpenOptions::new() - .create(true) - .read(true) - .write(true) - .open(temp_dir.join("foo.tar.gz"))?; - - let mut file = OpenOptions::new() - .create(true) - .read(true) - .write(true) - .open(temp_dir.join(binary_name))?; - - let mut encoder = GzEncoder::new(tar, Compression::default()); - { - let mut archive = tar::Builder::new(&mut encoder); - archive.append_file(binary_name, &mut file)?; - } - - let mut contents = vec![]; - - encoder.finish()?; - - File::open(temp_dir.join("foo.tar.gz"))?.read_to_end(&mut contents)?; - - Ok(contents) -} - -#[test] -fn install_binaries_from_targz_at_url_should_return_http_error_for_bad_url() { - let crate_path = Path::new(""); - let url = ""; - let binaries = vec![""]; - - let result = install_binaries_from_targz_at_url(crate_path, url, binaries); - assert!(result.is_err()); - - let err = result.err().unwrap(); - let err = err.downcast_ref::().unwrap(); - - let expected_message = format!("when requesting {}", url); - - match err { - Error::Http { message } => assert_eq!(&expected_message, message), - _ => panic!("Wrong error returned"), - } -} - -#[test] -fn install_binaries_from_targz_at_url_should_return_archive_error_when_tarball_is_missing() { - let server_port = 7878; - let url = format!("http://{}:{}", SERVER_HOST, server_port); - let crate_path = Path::new(""); - let binaries = vec![""]; - - // Spin up a local TcpListener. - start_server(server_port, None); - - let result = install_binaries_from_targz_at_url(crate_path, &url, binaries); - assert!(result.is_err()); - - let err = result.err().unwrap(); - let err = err.downcast_ref::().unwrap(); - - let expected_message = format!( - "Invalid tarball at {}. Inner error: failed to fill whole buffer", - url - ); - - match err { - Error::Archive { message } => assert_eq!(&expected_message, message), - _ => panic!("Wrong error returned"), - } -} - -#[test] -fn install_binaries_from_targz_at_url_should_return_archive_error_when_tarball_does_not_include_all_files( -) { - let server_port = 7879; - let url = format!("http://{}:{}", SERVER_HOST, server_port); - let crate_path = Path::new(""); - let binaries = vec!["wasm-pack"]; - - // Create a temporary tarball. - let tarball = create_tarball("foo.txt").ok(); - // Spin up a local TcpListener. - start_server(server_port, tarball); - - let result = install_binaries_from_targz_at_url(crate_path, &url, binaries); - assert!(result.is_err()); - - let err = result.err().unwrap(); - let err = err.downcast_ref::().unwrap(); - - let expected_message = format!( - "the tarball at {} was missing expected executables: {}", - url, "wasm-pack" - ); - - match err { - Error::Archive { message } => assert_eq!(&expected_message, message), - _ => panic!("Wrong error returned"), - } -} - -#[test] -fn install_binaries_from_targz_at_url_should_return_ok_if_binary_is_found() { - let server_port = 7880; - let url = format!("http://{}:{}", SERVER_HOST, server_port); - let binary_name = "wasm-pack"; - let crate_path = Path::new(""); - let binaries = vec![binary_name]; - - // Create a temporary tarball. - let tarball = create_tarball(binary_name).ok(); - // Spin up a local TcpListener. - start_server(server_port, tarball); - - let result = install_binaries_from_targz_at_url(crate_path, &url, binaries); - assert!(result.is_ok()); -} From 50e472de05ec29abd5e1a7ce3463308426a5aa07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Tue, 6 Nov 2018 21:15:42 +0100 Subject: [PATCH 014/106] chore: Remove unused crates and error variants --- Cargo.lock | 11 -------- Cargo.toml | 11 -------- binary-install/Cargo.toml | 4 --- binary-install/src/lib.rs | 5 +--- src/error.rs | 54 --------------------------------------- src/lib.rs | 9 +------ 6 files changed, 2 insertions(+), 92 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cc98424..ed8b708 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -77,11 +77,7 @@ dependencies = [ "flate2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "slog-term 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "tar 0.4.17 (registry+https://github.com/rust-lang/crates.io-index)", - "which 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "zip 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1066,11 +1062,7 @@ dependencies = [ "binary-install 0.1.0", "cargo_metadata 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "console 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "curl 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)", - "dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "human-panic 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "indicatif 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1079,16 +1071,13 @@ dependencies = [ "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", - "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-term 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "structopt 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", - "tar 0.4.17 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "which 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "zip 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index f3b8538..f3d1659 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,19 +9,11 @@ readme = "README.md" categories = ["wasm"] documentation = "https://rustwasm.github.io/wasm-pack/" -[workspace] -members = ["binary-install"] -exclude = ["target"] - [dependencies] atty = "0.2.11" cargo_metadata = "0.6.0" console = "0.6.1" -curl = "0.4.13" -dirs = "1.0.4" failure = "0.1.2" -flate2 = "1.0.2" -hex = "0.3" human-panic = "1.0.1" indicatif = "0.9.0" lazy_static = "1.1.0" @@ -30,15 +22,12 @@ parking_lot = "0.6" serde = "1.0.74" serde_derive = "1.0.74" serde_json = "1.0.26" -siphasher = "0.2.3" slog = "2.3" slog-term = "2.4" slog-async = "2.3" structopt = "0.2" -tar = "0.4.16" toml = "0.4" which = "2.0.0" -zip = "0.4.2" binary-install = { version = "0.1.0", path = "./binary-install" } [dev-dependencies] diff --git a/binary-install/Cargo.toml b/binary-install/Cargo.toml index 7f93e9c..c78b0dd 100644 --- a/binary-install/Cargo.toml +++ b/binary-install/Cargo.toml @@ -9,9 +9,5 @@ failure = "0.1.2" flate2 = "1.0.2" hex = "0.3" siphasher = "0.2.3" -slog = "2.3" -slog-term = "2.4" -slog-async = "2.3" tar = "0.4.16" -which = "2.0.0" zip = "0.4.2" diff --git a/binary-install/src/lib.rs b/binary-install/src/lib.rs index 89bf4f0..dcef39f 100644 --- a/binary-install/src/lib.rs +++ b/binary-install/src/lib.rs @@ -3,14 +3,11 @@ extern crate curl; #[macro_use] extern crate failure; -extern crate flate2; -#[macro_use] -extern crate slog; extern crate dirs; +extern crate flate2; extern crate hex; extern crate siphasher; extern crate tar; -extern crate which; extern crate zip; use failure::{Error, ResultExt}; diff --git a/src/error.rs b/src/error.rs index 1c2f2c4..1286154 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,11 +1,9 @@ //! Code related to error handling for wasm-pack -use curl; use serde_json; use std::borrow::Cow; use std::io; use std::process::ExitStatus; use toml; -use zip; /// Errors that can potentially occur in `wasm-pack`. #[derive(Debug, Fail)] @@ -22,14 +20,6 @@ pub enum Error { #[fail(display = "{}", _0)] SerdeToml(#[cause] toml::de::Error), - #[fail(display = "{}", _0)] - /// A curl error. - Curl(#[cause] curl::Error), - - #[fail(display = "{}", _0)] - /// An error handling zip archives. - Zip(#[cause] zip::result::ZipError), - #[fail(display = "{}", _0)] /// An error in parsing your rustc version. RustcMissing { @@ -73,13 +63,6 @@ pub enum Error { message: String, }, - #[fail(display = "{}", message)] - /// An error related to an archive that we downloaded. - Archive { - /// Error message. - message: String, - }, - #[fail(display = "{}", message)] /// Error when some operation or feature is unsupported for the current /// target or environment. @@ -87,13 +70,6 @@ pub enum Error { /// Error message. message: String, }, - - #[fail(display = "{}", message)] - /// Error related to some HTTP request. - Http { - /// Error message. - message: String, - }, } impl Error { @@ -114,13 +90,6 @@ impl Error { } } - /// Construct an archive error. - pub fn archive(message: &str) -> Self { - Error::Archive { - message: message.to_string(), - } - } - /// Construct an unsupported error. pub fn unsupported(message: &str) -> Self { Error::Unsupported { @@ -128,13 +97,6 @@ impl Error { } } - /// Construct an http error. - pub fn http(message: &str) -> Self { - Error::Http { - message: message.to_string(), - } - } - /// Construct a rustc version error. pub fn rustc_version_error(message: &str, local_version: &str) -> Self { Error::RustcVersion { @@ -149,7 +111,6 @@ impl Error { Error::Io(_) => "There was an I/O error. Details:\n\n", Error::SerdeJson(_) => "There was an JSON error. Details:\n\n", Error::SerdeToml(_) => "There was an TOML error. Details:\n\n", - Error::Zip(_) => "There was an error handling zip files. Details:\n\n", Error::RustcMissing { message: _, } => "We can't figure out what your Rust version is- which means you might not have Rust installed. Please install Rust version 1.30.0 or higher.", @@ -169,10 +130,7 @@ impl Error { Error::PkgNotFound { message: _, } => "Unable to find the 'pkg' directory at the path, set the path as the parent of the 'pkg' directory \n\n", - Error::Curl(_) => "There was an error making an HTTP request with curl. Details:\n\n", - Error::Archive {..} => "There was an error related to an archive file. Details:\n\n", Error::Unsupported {..} => "There was an unsupported operation attempted. Details:\n\n", - Error::Http {..} => "There wasn an HTTP error. Details:\n\n", }.to_string() } } @@ -183,24 +141,12 @@ impl From for Error { } } -impl From for Error { - fn from(e: curl::Error) -> Self { - Error::Curl(e) - } -} - impl From for Error { fn from(e: serde_json::Error) -> Self { Error::SerdeJson(e) } } -impl From for Error { - fn from(e: zip::result::ZipError) -> Self { - Error::Zip(e) - } -} - impl From for Error { fn from(e: toml::de::Error) -> Self { Error::SerdeToml(e) diff --git a/src/lib.rs b/src/lib.rs index 23280bf..2d6d296 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,20 +4,16 @@ extern crate cargo_metadata; extern crate console; -extern crate curl; -extern crate dirs; #[macro_use] extern crate failure; -extern crate flate2; -extern crate hex; extern crate indicatif; +extern crate which; #[macro_use] extern crate lazy_static; extern crate parking_lot; #[macro_use] extern crate serde_derive; extern crate serde_json; -extern crate siphasher; #[macro_use] extern crate structopt; #[macro_use] @@ -25,10 +21,7 @@ extern crate slog; extern crate binary_install; extern crate slog_async; extern crate slog_term; -extern crate tar; extern crate toml; -extern crate which; -extern crate zip; pub mod bindgen; pub mod build; From 489d3e84c2f53f2d4f8150a8c0c4f5835bb74f5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Tue, 6 Nov 2018 21:21:14 +0100 Subject: [PATCH 015/106] refactor: Rename binary-install to wasm-pack-binary-install --- Cargo.lock | 30 +++++++++++++++--------------- Cargo.toml | 2 +- binary-install/Cargo.toml | 2 +- src/bindgen.rs | 2 +- src/command/build.rs | 2 +- src/command/test.rs | 2 +- src/lib.rs | 2 +- src/test/webdriver.rs | 2 +- tests/all/bindgen.rs | 2 +- tests/all/main.rs | 2 +- tests/all/utils/fixture.rs | 2 +- tests/all/webdriver.rs | 2 +- 12 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ed8b708..8b5c16c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -67,20 +67,6 @@ dependencies = [ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "binary-install" -version = "0.1.0" -dependencies = [ - "curl 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)", - "dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tar 0.4.17 (registry+https://github.com/rust-lang/crates.io-index)", - "zip 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "bitflags" version = "1.0.4" @@ -1059,7 +1045,6 @@ name = "wasm-pack" version = "0.5.1" dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "binary-install 0.1.0", "cargo_metadata 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "console 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1077,9 +1062,24 @@ dependencies = [ "structopt 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-pack-binary-install 0.1.0", "which 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "wasm-pack-binary-install" +version = "0.1.0" +dependencies = [ + "curl 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)", + "dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tar 0.4.17 (registry+https://github.com/rust-lang/crates.io-index)", + "zip 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "which" version = "2.0.0" diff --git a/Cargo.toml b/Cargo.toml index f3d1659..dd1b560 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ slog-async = "2.3" structopt = "0.2" toml = "0.4" which = "2.0.0" -binary-install = { version = "0.1.0", path = "./binary-install" } +wasm-pack-binary-install = { version = "0.1.0", path = "./binary-install" } [dev-dependencies] tempfile = "3" diff --git a/binary-install/Cargo.toml b/binary-install/Cargo.toml index c78b0dd..acdd991 100644 --- a/binary-install/Cargo.toml +++ b/binary-install/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "binary-install" +name = "wasm-pack-binary-install" version = "0.1.0" [dependencies] diff --git a/src/bindgen.rs b/src/bindgen.rs index 6b8b1e7..15be7ec 100644 --- a/src/bindgen.rs +++ b/src/bindgen.rs @@ -1,6 +1,5 @@ //! Functionality related to installing and running `wasm-bindgen`. -use binary_install::{Cache, Download}; use child; use emoji; use failure::{self, ResultExt}; @@ -11,6 +10,7 @@ use std::fs; use std::path::{Path, PathBuf}; use std::process::Command; use target; +use wasm_pack_binary_install::{Cache, Download}; use which::which; use PBAR; diff --git a/src/command/build.rs b/src/command/build.rs index 123e043..7852d8a 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -1,6 +1,5 @@ //! Implementation of the `wasm-pack build` command. -use binary_install::{Cache, Download}; use bindgen; use build; use command::utils::{create_pkg_dir, set_crate_path}; @@ -15,6 +14,7 @@ use slog::Logger; use std::path::PathBuf; use std::str::FromStr; use std::time::Instant; +use wasm_pack_binary_install::{Cache, Download}; use PBAR; /// Everything required to configure and run the `wasm-pack init` command. diff --git a/src/command/test.rs b/src/command/test.rs index 5a434e9..bd8d77a 100644 --- a/src/command/test.rs +++ b/src/command/test.rs @@ -1,7 +1,6 @@ //! Implementation of the `wasm-pack test` command. use super::build::BuildMode; -use binary_install::Cache; use bindgen; use build; use command::utils::set_crate_path; @@ -16,6 +15,7 @@ use slog::Logger; use std::path::PathBuf; use std::time::Instant; use test::{self, webdriver}; +use wasm_pack_binary_install::Cache; use PBAR; #[derive(Debug, Default, StructOpt)] diff --git a/src/lib.rs b/src/lib.rs index 2d6d296..d7c641b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,10 +18,10 @@ extern crate serde_json; extern crate structopt; #[macro_use] extern crate slog; -extern crate binary_install; extern crate slog_async; extern crate slog_term; extern crate toml; +extern crate wasm_pack_binary_install; pub mod bindgen; pub mod build; diff --git a/src/test/webdriver.rs b/src/test/webdriver.rs index 9fc3c56..9709c40 100644 --- a/src/test/webdriver.rs +++ b/src/test/webdriver.rs @@ -1,10 +1,10 @@ //! Getting WebDriver client binaries. -use binary_install::Cache; use command::build::BuildMode; use failure; use std::path::PathBuf; use target; +use wasm_pack_binary_install::Cache; /// Get the path to an existing `chromedriver`, or install it if no existing /// binary is found. diff --git a/tests/all/bindgen.rs b/tests/all/bindgen.rs index 032d48b..5f6b481 100644 --- a/tests/all/bindgen.rs +++ b/tests/all/bindgen.rs @@ -1,6 +1,6 @@ -use binary_install::Cache; use tempfile; use wasm_pack::bindgen; +use wasm_pack_binary_install::Cache; #[test] #[cfg(any( diff --git a/tests/all/main.rs b/tests/all/main.rs index c41b090..c79c4f1 100644 --- a/tests/all/main.rs +++ b/tests/all/main.rs @@ -6,10 +6,10 @@ extern crate serde_derive; extern crate serde_json; #[macro_use] extern crate slog; -extern crate binary_install; extern crate structopt; extern crate tempfile; extern crate wasm_pack; +extern crate wasm_pack_binary_install; mod bindgen; mod build; diff --git a/tests/all/utils/fixture.rs b/tests/all/utils/fixture.rs index 7c4dfe4..b361865 100644 --- a/tests/all/utils/fixture.rs +++ b/tests/all/utils/fixture.rs @@ -1,5 +1,4 @@ use super::logger::null_logger; -use binary_install::Cache; use std::env; use std::fs; use std::mem::ManuallyDrop; @@ -9,6 +8,7 @@ use std::sync::{MutexGuard, Once, ONCE_INIT}; use std::thread; use tempfile::TempDir; use wasm_pack; +use wasm_pack_binary_install::Cache; /// A test fixture in a temporary directory. pub struct Fixture { diff --git a/tests/all/webdriver.rs b/tests/all/webdriver.rs index d5e8cf6..c0bbaa5 100644 --- a/tests/all/webdriver.rs +++ b/tests/all/webdriver.rs @@ -1,6 +1,6 @@ -use binary_install::Cache; use utils::fixture; use wasm_pack::test::webdriver; +use wasm_pack_binary_install::Cache; #[test] #[cfg(any( From b47dfa3009efe802f3324fea0a414cc73344b8e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Wed, 7 Nov 2018 21:10:40 +0100 Subject: [PATCH 016/106] chore: Run latest rustfmt --- tests/all/build.rs | 28 ++++++-------- tests/all/lockfile.rs | 18 +++------ tests/all/manifest.rs | 86 +++++++++++++++++++++++++------------------ 3 files changed, 67 insertions(+), 65 deletions(-) diff --git a/tests/all/build.rs b/tests/all/build.rs index 91a15e0..7cb2136 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -10,17 +10,17 @@ fn build_in_non_crate_directory_doesnt_panic() { "wasm-pack", "build", &fixture.path.display().to_string(), - ]) - .unwrap(); + ]).unwrap(); let result = fixture.run(cli.cmd); assert!( result.is_err(), "running wasm-pack in a non-crate directory should fail, but it should not panic" ); let err = result.unwrap_err(); - assert!(err - .iter_chain() - .any(|e| e.to_string().contains("missing a `Cargo.toml`"))); + assert!( + err.iter_chain() + .any(|e| e.to_string().contains("missing a `Cargo.toml`")) + ); } #[test] @@ -31,8 +31,7 @@ fn it_should_build_js_hello_world_example() { "wasm-pack", "build", &fixture.path.display().to_string(), - ]) - .unwrap(); + ]).unwrap(); fixture.run(cli.cmd).unwrap(); } @@ -46,8 +45,7 @@ fn it_should_build_crates_in_a_workspace() { [workspace] members = ["blah"] "#, - ) - .file( + ).file( Path::new("blah").join("Cargo.toml"), r#" [package] @@ -64,8 +62,7 @@ fn it_should_build_crates_in_a_workspace() { [dependencies] wasm-bindgen = "=0.2.21" "#, - ) - .file( + ).file( Path::new("blah").join("src").join("lib.rs"), r#" extern crate wasm_bindgen; @@ -80,8 +77,7 @@ fn it_should_build_crates_in_a_workspace() { "wasm-pack", "build", &fixture.path.join("blah").display().to_string(), - ]) - .unwrap(); + ]).unwrap(); fixture.run(cli.cmd).unwrap(); } @@ -105,8 +101,7 @@ fn renamed_crate_name_works() { [dependencies] wasm-bindgen = "=0.2.21" "#, - ) - .file( + ).file( "src/lib.rs", r#" extern crate wasm_bindgen; @@ -121,7 +116,6 @@ fn renamed_crate_name_works() { "wasm-pack", "build", &fixture.path.display().to_string(), - ]) - .unwrap(); + ]).unwrap(); fixture.run(cli.cmd).unwrap(); } diff --git a/tests/all/lockfile.rs b/tests/all/lockfile.rs index 01876ba..4c1fb36 100644 --- a/tests/all/lockfile.rs +++ b/tests/all/lockfile.rs @@ -30,8 +30,7 @@ fn it_gets_wasm_bindgen_version_in_crate_inside_workspace() { [workspace] members = ["./blah"] "#, - ) - .file( + ).file( "blah/Cargo.toml", r#" [package] @@ -48,8 +47,7 @@ fn it_gets_wasm_bindgen_version_in_crate_inside_workspace() { [dependencies] wasm-bindgen = "=0.2.21" "#, - ) - .file( + ).file( "blah/src/lib.rs", r#" extern crate wasm_bindgen; @@ -75,8 +73,7 @@ fn it_gets_wasm_bindgen_version_from_dependencies() { [workspace] members = ["./parent", "./child"] "#, - ) - .file( + ).file( "child/Cargo.toml", r#" [package] @@ -93,8 +90,7 @@ fn it_gets_wasm_bindgen_version_from_dependencies() { [dependencies] wasm-bindgen = "=0.2.21" "#, - ) - .file( + ).file( "child/src/lib.rs", r#" extern crate wasm_bindgen; @@ -103,8 +99,7 @@ fn it_gets_wasm_bindgen_version_from_dependencies() { #[wasm_bindgen] pub fn hello() -> u32 { 42 } "#, - ) - .file( + ).file( "parent/Cargo.toml", r#" [package] @@ -118,8 +113,7 @@ fn it_gets_wasm_bindgen_version_from_dependencies() { [lib] crate-type = ["cdylib"] "#, - ) - .file( + ).file( "parent/src/lib.rs", r#" // Just re-export all of `child`. diff --git a/tests/all/manifest.rs b/tests/all/manifest.rs index 2c60f78..9734f2c 100644 --- a/tests/all/manifest.rs +++ b/tests/all/manifest.rs @@ -65,9 +65,11 @@ fn it_creates_a_package_json_default_path() { let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let step = wasm_pack::progressbar::Step::new(1); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); - assert!(crate_data - .write_package_json(&out_dir, &None, false, "", &step) - .is_ok()); + assert!( + crate_data + .write_package_json(&out_dir, &None, false, "", &step) + .is_ok() + ); let package_json_path = &fixture.path.join("pkg").join("package.json"); fs::metadata(package_json_path).unwrap(); utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); @@ -88,9 +90,9 @@ fn it_creates_a_package_json_default_path() { "js_hello_world.d.ts", "js_hello_world.js", ] - .iter() - .map(|&s| String::from(s)) - .collect(); + .iter() + .map(|&s| String::from(s)) + .collect(); assert_eq!(actual_files, expected_files); } @@ -101,9 +103,11 @@ fn it_creates_a_package_json_provided_path() { let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let step = wasm_pack::progressbar::Step::new(1); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); - assert!(crate_data - .write_package_json(&out_dir, &None, false, "", &step) - .is_ok()); + assert!( + crate_data + .write_package_json(&out_dir, &None, false, "", &step) + .is_ok() + ); let package_json_path = &fixture.path.join("pkg").join("package.json"); fs::metadata(package_json_path).unwrap(); utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); @@ -117,9 +121,9 @@ fn it_creates_a_package_json_provided_path() { "js_hello_world.d.ts", "js_hello_world.js", ] - .iter() - .map(|&s| String::from(s)) - .collect(); + .iter() + .map(|&s| String::from(s)) + .collect(); assert_eq!(actual_files, expected_files); } @@ -130,9 +134,11 @@ fn it_creates_a_package_json_provided_path_with_scope() { let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let step = wasm_pack::progressbar::Step::new(1); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); - assert!(crate_data - .write_package_json(&out_dir, &Some("test".to_string()), false, "", &step) - .is_ok()); + assert!( + crate_data + .write_package_json(&out_dir, &Some("test".to_string()), false, "", &step) + .is_ok() + ); let package_json_path = &fixture.path.join("pkg").join("package.json"); fs::metadata(package_json_path).unwrap(); utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); @@ -146,9 +152,9 @@ fn it_creates_a_package_json_provided_path_with_scope() { "js_hello_world.d.ts", "js_hello_world.js", ] - .iter() - .map(|&s| String::from(s)) - .collect(); + .iter() + .map(|&s| String::from(s)) + .collect(); assert_eq!(actual_files, expected_files); } @@ -159,9 +165,11 @@ fn it_creates_a_pkg_json_with_correct_files_on_node() { let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let step = wasm_pack::progressbar::Step::new(1); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); - assert!(crate_data - .write_package_json(&out_dir, &None, false, "nodejs", &step) - .is_ok()); + assert!( + crate_data + .write_package_json(&out_dir, &None, false, "nodejs", &step) + .is_ok() + ); let package_json_path = &out_dir.join("package.json"); fs::metadata(package_json_path).unwrap(); utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); @@ -182,9 +190,9 @@ fn it_creates_a_pkg_json_with_correct_files_on_node() { "js_hello_world.d.ts", "js_hello_world.js", ] - .iter() - .map(|&s| String::from(s)) - .collect(); + .iter() + .map(|&s| String::from(s)) + .collect(); assert_eq!(actual_files, expected_files); } @@ -195,9 +203,11 @@ fn it_creates_a_pkg_json_with_correct_files_on_nomodules() { let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let step = wasm_pack::progressbar::Step::new(1); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); - assert!(crate_data - .write_package_json(&out_dir, &None, false, "no-modules", &step) - .is_ok()); + assert!( + crate_data + .write_package_json(&out_dir, &None, false, "no-modules", &step) + .is_ok() + ); let package_json_path = &out_dir.join("package.json"); fs::metadata(package_json_path).unwrap(); utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); @@ -217,9 +227,9 @@ fn it_creates_a_pkg_json_with_correct_files_on_nomodules() { "js_hello_world.js", "js_hello_world.d.ts", ] - .iter() - .map(|&s| String::from(s)) - .collect(); + .iter() + .map(|&s| String::from(s)) + .collect(); assert_eq!(actual_files, expected_files); } @@ -230,9 +240,11 @@ fn it_creates_a_pkg_json_in_out_dir() { let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let step = wasm_pack::progressbar::Step::new(1); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); - assert!(crate_data - .write_package_json(&out_dir, &None, false, "", &step) - .is_ok()); + assert!( + crate_data + .write_package_json(&out_dir, &None, false, "", &step) + .is_ok() + ); let package_json_path = &fixture.path.join(&out_dir).join("package.json"); fs::metadata(package_json_path).unwrap(); @@ -246,9 +258,11 @@ fn it_creates_a_package_json_with_correct_keys_when_types_are_skipped() { let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let step = wasm_pack::progressbar::Step::new(1); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); - assert!(crate_data - .write_package_json(&out_dir, &None, true, "", &step) - .is_ok()); + assert!( + crate_data + .write_package_json(&out_dir, &None, true, "", &step) + .is_ok() + ); let package_json_path = &out_dir.join("package.json"); fs::metadata(package_json_path).unwrap(); utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); From 99b9602d3102f350152e6f6c5e7e3fb29ed2c0a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Wed, 7 Nov 2018 21:43:50 +0100 Subject: [PATCH 017/106] chore: Run latest rustfmt --- src/bindgen.rs | 6 ++- tests/all/bindgen.rs | 8 ++-- tests/all/build.rs | 28 ++++++++----- tests/all/lockfile.rs | 18 +++++--- tests/all/manifest.rs | 86 ++++++++++++++++---------------------- tests/all/test.rs | 6 ++- tests/all/utils/fixture.rs | 6 ++- 7 files changed, 80 insertions(+), 78 deletions(-) diff --git a/src/bindgen.rs b/src/bindgen.rs index 15be7ec..951a104 100644 --- a/src/bindgen.rs +++ b/src/bindgen.rs @@ -207,6 +207,8 @@ fn wasm_bindgen_version_check(bindgen_path: &PathBuf, dep_version: &str, log: &L dep_version ); v == dep_version - }).unwrap_or(false) - }).unwrap_or(false) + }) + .unwrap_or(false) + }) + .unwrap_or(false) } diff --git a/tests/all/bindgen.rs b/tests/all/bindgen.rs index 5f6b481..e1077c5 100644 --- a/tests/all/bindgen.rs +++ b/tests/all/bindgen.rs @@ -31,9 +31,7 @@ fn downloading_prebuilt_wasm_bindgen_handles_http_errors() { let error = result.err().unwrap(); assert!(error.iter_chain().any(|e| e.to_string().contains("404"))); - assert!( - error - .iter_chain() - .any(|e| e.to_string().contains(bad_version)) - ); + assert!(error + .iter_chain() + .any(|e| e.to_string().contains(bad_version))); } diff --git a/tests/all/build.rs b/tests/all/build.rs index 7cb2136..91a15e0 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -10,17 +10,17 @@ fn build_in_non_crate_directory_doesnt_panic() { "wasm-pack", "build", &fixture.path.display().to_string(), - ]).unwrap(); + ]) + .unwrap(); let result = fixture.run(cli.cmd); assert!( result.is_err(), "running wasm-pack in a non-crate directory should fail, but it should not panic" ); let err = result.unwrap_err(); - assert!( - err.iter_chain() - .any(|e| e.to_string().contains("missing a `Cargo.toml`")) - ); + assert!(err + .iter_chain() + .any(|e| e.to_string().contains("missing a `Cargo.toml`"))); } #[test] @@ -31,7 +31,8 @@ fn it_should_build_js_hello_world_example() { "wasm-pack", "build", &fixture.path.display().to_string(), - ]).unwrap(); + ]) + .unwrap(); fixture.run(cli.cmd).unwrap(); } @@ -45,7 +46,8 @@ fn it_should_build_crates_in_a_workspace() { [workspace] members = ["blah"] "#, - ).file( + ) + .file( Path::new("blah").join("Cargo.toml"), r#" [package] @@ -62,7 +64,8 @@ fn it_should_build_crates_in_a_workspace() { [dependencies] wasm-bindgen = "=0.2.21" "#, - ).file( + ) + .file( Path::new("blah").join("src").join("lib.rs"), r#" extern crate wasm_bindgen; @@ -77,7 +80,8 @@ fn it_should_build_crates_in_a_workspace() { "wasm-pack", "build", &fixture.path.join("blah").display().to_string(), - ]).unwrap(); + ]) + .unwrap(); fixture.run(cli.cmd).unwrap(); } @@ -101,7 +105,8 @@ fn renamed_crate_name_works() { [dependencies] wasm-bindgen = "=0.2.21" "#, - ).file( + ) + .file( "src/lib.rs", r#" extern crate wasm_bindgen; @@ -116,6 +121,7 @@ fn renamed_crate_name_works() { "wasm-pack", "build", &fixture.path.display().to_string(), - ]).unwrap(); + ]) + .unwrap(); fixture.run(cli.cmd).unwrap(); } diff --git a/tests/all/lockfile.rs b/tests/all/lockfile.rs index 4c1fb36..01876ba 100644 --- a/tests/all/lockfile.rs +++ b/tests/all/lockfile.rs @@ -30,7 +30,8 @@ fn it_gets_wasm_bindgen_version_in_crate_inside_workspace() { [workspace] members = ["./blah"] "#, - ).file( + ) + .file( "blah/Cargo.toml", r#" [package] @@ -47,7 +48,8 @@ fn it_gets_wasm_bindgen_version_in_crate_inside_workspace() { [dependencies] wasm-bindgen = "=0.2.21" "#, - ).file( + ) + .file( "blah/src/lib.rs", r#" extern crate wasm_bindgen; @@ -73,7 +75,8 @@ fn it_gets_wasm_bindgen_version_from_dependencies() { [workspace] members = ["./parent", "./child"] "#, - ).file( + ) + .file( "child/Cargo.toml", r#" [package] @@ -90,7 +93,8 @@ fn it_gets_wasm_bindgen_version_from_dependencies() { [dependencies] wasm-bindgen = "=0.2.21" "#, - ).file( + ) + .file( "child/src/lib.rs", r#" extern crate wasm_bindgen; @@ -99,7 +103,8 @@ fn it_gets_wasm_bindgen_version_from_dependencies() { #[wasm_bindgen] pub fn hello() -> u32 { 42 } "#, - ).file( + ) + .file( "parent/Cargo.toml", r#" [package] @@ -113,7 +118,8 @@ fn it_gets_wasm_bindgen_version_from_dependencies() { [lib] crate-type = ["cdylib"] "#, - ).file( + ) + .file( "parent/src/lib.rs", r#" // Just re-export all of `child`. diff --git a/tests/all/manifest.rs b/tests/all/manifest.rs index 9734f2c..2c60f78 100644 --- a/tests/all/manifest.rs +++ b/tests/all/manifest.rs @@ -65,11 +65,9 @@ fn it_creates_a_package_json_default_path() { let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let step = wasm_pack::progressbar::Step::new(1); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); - assert!( - crate_data - .write_package_json(&out_dir, &None, false, "", &step) - .is_ok() - ); + assert!(crate_data + .write_package_json(&out_dir, &None, false, "", &step) + .is_ok()); let package_json_path = &fixture.path.join("pkg").join("package.json"); fs::metadata(package_json_path).unwrap(); utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); @@ -90,9 +88,9 @@ fn it_creates_a_package_json_default_path() { "js_hello_world.d.ts", "js_hello_world.js", ] - .iter() - .map(|&s| String::from(s)) - .collect(); + .iter() + .map(|&s| String::from(s)) + .collect(); assert_eq!(actual_files, expected_files); } @@ -103,11 +101,9 @@ fn it_creates_a_package_json_provided_path() { let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let step = wasm_pack::progressbar::Step::new(1); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); - assert!( - crate_data - .write_package_json(&out_dir, &None, false, "", &step) - .is_ok() - ); + assert!(crate_data + .write_package_json(&out_dir, &None, false, "", &step) + .is_ok()); let package_json_path = &fixture.path.join("pkg").join("package.json"); fs::metadata(package_json_path).unwrap(); utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); @@ -121,9 +117,9 @@ fn it_creates_a_package_json_provided_path() { "js_hello_world.d.ts", "js_hello_world.js", ] - .iter() - .map(|&s| String::from(s)) - .collect(); + .iter() + .map(|&s| String::from(s)) + .collect(); assert_eq!(actual_files, expected_files); } @@ -134,11 +130,9 @@ fn it_creates_a_package_json_provided_path_with_scope() { let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let step = wasm_pack::progressbar::Step::new(1); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); - assert!( - crate_data - .write_package_json(&out_dir, &Some("test".to_string()), false, "", &step) - .is_ok() - ); + assert!(crate_data + .write_package_json(&out_dir, &Some("test".to_string()), false, "", &step) + .is_ok()); let package_json_path = &fixture.path.join("pkg").join("package.json"); fs::metadata(package_json_path).unwrap(); utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); @@ -152,9 +146,9 @@ fn it_creates_a_package_json_provided_path_with_scope() { "js_hello_world.d.ts", "js_hello_world.js", ] - .iter() - .map(|&s| String::from(s)) - .collect(); + .iter() + .map(|&s| String::from(s)) + .collect(); assert_eq!(actual_files, expected_files); } @@ -165,11 +159,9 @@ fn it_creates_a_pkg_json_with_correct_files_on_node() { let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let step = wasm_pack::progressbar::Step::new(1); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); - assert!( - crate_data - .write_package_json(&out_dir, &None, false, "nodejs", &step) - .is_ok() - ); + assert!(crate_data + .write_package_json(&out_dir, &None, false, "nodejs", &step) + .is_ok()); let package_json_path = &out_dir.join("package.json"); fs::metadata(package_json_path).unwrap(); utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); @@ -190,9 +182,9 @@ fn it_creates_a_pkg_json_with_correct_files_on_node() { "js_hello_world.d.ts", "js_hello_world.js", ] - .iter() - .map(|&s| String::from(s)) - .collect(); + .iter() + .map(|&s| String::from(s)) + .collect(); assert_eq!(actual_files, expected_files); } @@ -203,11 +195,9 @@ fn it_creates_a_pkg_json_with_correct_files_on_nomodules() { let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let step = wasm_pack::progressbar::Step::new(1); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); - assert!( - crate_data - .write_package_json(&out_dir, &None, false, "no-modules", &step) - .is_ok() - ); + assert!(crate_data + .write_package_json(&out_dir, &None, false, "no-modules", &step) + .is_ok()); let package_json_path = &out_dir.join("package.json"); fs::metadata(package_json_path).unwrap(); utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); @@ -227,9 +217,9 @@ fn it_creates_a_pkg_json_with_correct_files_on_nomodules() { "js_hello_world.js", "js_hello_world.d.ts", ] - .iter() - .map(|&s| String::from(s)) - .collect(); + .iter() + .map(|&s| String::from(s)) + .collect(); assert_eq!(actual_files, expected_files); } @@ -240,11 +230,9 @@ fn it_creates_a_pkg_json_in_out_dir() { let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let step = wasm_pack::progressbar::Step::new(1); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); - assert!( - crate_data - .write_package_json(&out_dir, &None, false, "", &step) - .is_ok() - ); + assert!(crate_data + .write_package_json(&out_dir, &None, false, "", &step) + .is_ok()); let package_json_path = &fixture.path.join(&out_dir).join("package.json"); fs::metadata(package_json_path).unwrap(); @@ -258,11 +246,9 @@ fn it_creates_a_package_json_with_correct_keys_when_types_are_skipped() { let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let step = wasm_pack::progressbar::Step::new(1); wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); - assert!( - crate_data - .write_package_json(&out_dir, &None, true, "", &step) - .is_ok() - ); + assert!(crate_data + .write_package_json(&out_dir, &None, true, "", &step) + .is_ok()); let package_json_path = &out_dir.join("package.json"); fs::metadata(package_json_path).unwrap(); utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); diff --git a/tests/all/test.rs b/tests/all/test.rs index 323cc2e..718f275 100644 --- a/tests/all/test.rs +++ b/tests/all/test.rs @@ -200,7 +200,8 @@ fn complains_about_missing_wasm_bindgen_test_dependency() { [dev-dependencies] # no wasm-bindgen-test dep here! "#, - ).hello_world_src_lib() + ) + .hello_world_src_lib() .install_local_wasm_bindgen(); let cmd = Command::Test(test::TestOptions { @@ -265,7 +266,8 @@ fn renamed_crate_name_works() { [dev-dependencies] wasm-bindgen-test = "=0.2.21" "#, - ).file( + ) + .file( "src/lib.rs", r#" extern crate wasm_bindgen; diff --git a/tests/all/utils/fixture.rs b/tests/all/utils/fixture.rs index b361865..b916c6b 100644 --- a/tests/all/utils/fixture.rs +++ b/tests/all/utils/fixture.rs @@ -346,7 +346,8 @@ pub fn wbg_test_diff_versions() -> Fixture { # wasm-bindgen-test at 0.2.19, and everything should still work. wasm-bindgen-test = "0.2.19" "#, - ).file( + ) + .file( "src/lib.rs", r#" extern crate wasm_bindgen; @@ -355,7 +356,8 @@ pub fn wbg_test_diff_versions() -> Fixture { #[wasm_bindgen] pub fn one() -> u32 { 1 } "#, - ).file( + ) + .file( "tests/node.rs", r#" extern crate wbg_test_diff_versions; From 59039e41181a47dccdf1fbb5c5e151f04492a7b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Mon, 12 Nov 2018 21:45:36 +0100 Subject: [PATCH 018/106] feat: Catch types in Cargo.toml and warn about them --- Cargo.lock | 10 ++++++++++ Cargo.toml | 1 + src/lib.rs | 1 + src/manifest/mod.rs | 22 ++++++++++++++++++++-- 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2279393..d07284f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -756,6 +756,14 @@ dependencies = [ "syn 0.15.18 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "serde_ignored" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "serde_json" version = "1.0.32" @@ -1056,6 +1064,7 @@ dependencies = [ "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1226,6 +1235,7 @@ dependencies = [ "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "15c141fc7027dd265a47c090bf864cf62b42c4d228bbcf4e51a0c9e2b0d3f7ef" "checksum serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "225de307c6302bec3898c51ca302fc94a7a1697ef0845fcee6448f33c032249c" +"checksum serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "190e9765dcedb56be63b6e0993a006c7e3b071a016a304736e4a315dc01fb142" "checksum serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)" = "43344e7ce05d0d8280c5940cabb4964bea626aa58b1ec0e8c73fa2a8512a38ce" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" "checksum slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e1a2eec401952cd7b12a84ea120e2d57281329940c3f93c2bf04f462539508e" diff --git a/Cargo.toml b/Cargo.toml index b486071..0c7a45b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,6 +25,7 @@ openssl = { version = '0.10.11', optional = true } parking_lot = "0.6" serde = "1.0.74" serde_derive = "1.0.74" +serde_ignored = "0.0.4" serde_json = "1.0.26" siphasher = "0.2.3" slog = "2.3" diff --git a/src/lib.rs b/src/lib.rs index 2cec7a8..0000c4a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,6 +17,7 @@ extern crate parking_lot; extern crate serde; #[macro_use] extern crate serde_derive; +extern crate serde_ignored; extern crate serde_json; extern crate siphasher; #[macro_use] diff --git a/src/manifest/mod.rs b/src/manifest/mod.rs index 8c3e390..7b80936 100644 --- a/src/manifest/mod.rs +++ b/src/manifest/mod.rs @@ -15,6 +15,7 @@ use failure::{Error, ResultExt}; use progressbar::Step; use serde::{self, Deserialize}; use serde_json; +use std::collections::BTreeSet; use toml; use PBAR; @@ -210,8 +211,25 @@ impl CrateData { } let manifest = fs::read_to_string(&manifest_path) .with_context(|_| format!("failed to read: {}", manifest_path.display()))?; - let manifest: CargoManifest = toml::from_str(&manifest) - .with_context(|_| format!("failed to parse manifest: {}", manifest_path.display()))?; + let manifest = &mut toml::Deserializer::new(&manifest); + + let mut unused_keys = BTreeSet::new(); + + let manifest: CargoManifest = serde_ignored::deserialize(manifest, |path| { + let path_string = path.to_string(); + + if path_string.contains("metadata") { + unused_keys.insert(path_string); + } + }) + .with_context(|_| format!("failed to parse manifest: {}", manifest_path.display()))?; + + unused_keys.iter().for_each(|path| { + PBAR.warn(&format!( + "\"{}\" is misspelled and will be ignored. Please check your Cargo.toml.", + path + )); + }); let data = cargo_metadata::metadata(Some(&manifest_path)).map_err(error_chain_to_failure)?; From 2ed3d01541f114cc3374c6c6b295b6495c60fa8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Tue, 13 Nov 2018 20:31:51 +0100 Subject: [PATCH 019/106] refactor: Move parsing and warning code into two new functions --- src/manifest/mod.rs | 76 ++++++++++++++++++++++++++++++++------------- 1 file changed, 54 insertions(+), 22 deletions(-) diff --git a/src/manifest/mod.rs b/src/manifest/mod.rs index 7b80936..b8c5f01 100644 --- a/src/manifest/mod.rs +++ b/src/manifest/mod.rs @@ -26,8 +26,9 @@ pub struct CrateData { manifest: CargoManifest, } +#[doc(hidden)] #[derive(Deserialize)] -struct CargoManifest { +pub struct CargoManifest { package: CargoPackage, } @@ -197,6 +198,12 @@ struct NpmData { main: String, } +#[doc(hidden)] +pub struct ManifestAndUnsedKeys { + pub manifest: CargoManifest, + pub unused_keys: BTreeSet, +} + impl CrateData { /// Reads all metadata for the crate whose manifest is inside the directory /// specified by `path`. @@ -209,31 +216,16 @@ impl CrateData { crate_path.display() ) } - let manifest = fs::read_to_string(&manifest_path) - .with_context(|_| format!("failed to read: {}", manifest_path.display()))?; - let manifest = &mut toml::Deserializer::new(&manifest); - - let mut unused_keys = BTreeSet::new(); - - let manifest: CargoManifest = serde_ignored::deserialize(manifest, |path| { - let path_string = path.to_string(); - - if path_string.contains("metadata") { - unused_keys.insert(path_string); - } - }) - .with_context(|_| format!("failed to parse manifest: {}", manifest_path.display()))?; - - unused_keys.iter().for_each(|path| { - PBAR.warn(&format!( - "\"{}\" is misspelled and will be ignored. Please check your Cargo.toml.", - path - )); - }); let data = cargo_metadata::metadata(Some(&manifest_path)).map_err(error_chain_to_failure)?; + let ManifestAndUnsedKeys { + manifest, + unused_keys, + } = CrateData::parse_crate_data(&manifest_path)?; + CrateData::warn_for_unused_keys(&unused_keys); + let current_idx = data .packages .iter() @@ -259,6 +251,46 @@ impl CrateData { } } + /// Read the `manifest_path` file and deserializes it using the toml Deserializer. + /// Returns a Result containing `ManifestAndUnsedKeys` which contains `CargoManifest` + /// and a `BTreeSet` containing the unused keys from the parsed file. + /// + /// # Errors + /// Will return Err if the file (manifest_path) couldn't be read or + /// if deserializion of to `CargoManifest` fails. + pub fn parse_crate_data(manifest_path: &Path) -> Result { + let manifest = fs::read_to_string(&manifest_path) + .with_context(|_| format!("failed to read: {}", manifest_path.display()))?; + let manifest = &mut toml::Deserializer::new(&manifest); + + let mut unused_keys = BTreeSet::new(); + + let manifest: CargoManifest = serde_ignored::deserialize(manifest, |path| { + let path_string = path.to_string(); + + if path_string.contains("metadata") { + unused_keys.insert(path_string); + } + }) + .with_context(|_| format!("failed to parse manifest: {}", manifest_path.display()))?; + + Ok(ManifestAndUnsedKeys { + manifest, + unused_keys, + }) + } + + /// Iterating through all the passed `unused_keys` and output + /// a warning for each unknown key. + pub fn warn_for_unused_keys(unused_keys: &BTreeSet) { + unused_keys.iter().for_each(|path| { + PBAR.warn(&format!( + "\"{}\" is a unknown key and will be ignored. Please check your Cargo.toml.", + path + )); + }); + } + /// Get the configured profile. pub fn configured_profile(&self, profile: BuildProfile) -> &CargoWasmPackProfile { match profile { From 6894e631107cc9c8d462633b6562a5885bbf2e74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Tue, 13 Nov 2018 20:34:38 +0100 Subject: [PATCH 020/106] chore: Fix typo --- src/manifest/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/manifest/mod.rs b/src/manifest/mod.rs index b8c5f01..9211303 100644 --- a/src/manifest/mod.rs +++ b/src/manifest/mod.rs @@ -257,7 +257,7 @@ impl CrateData { /// /// # Errors /// Will return Err if the file (manifest_path) couldn't be read or - /// if deserializion of to `CargoManifest` fails. + /// if deserialize to `CargoManifest` fails. pub fn parse_crate_data(manifest_path: &Path) -> Result { let manifest = fs::read_to_string(&manifest_path) .with_context(|_| format!("failed to read: {}", manifest_path.display()))?; From 203cf6996cdd76048daf05ce755d77420946003a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Tue, 13 Nov 2018 20:53:57 +0100 Subject: [PATCH 021/106] test: Add test case for `parse_crate_data` --- tests/all/manifest.rs | 48 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/tests/all/manifest.rs b/tests/all/manifest.rs index 6bc9df8..dce984f 100644 --- a/tests/all/manifest.rs +++ b/tests/all/manifest.rs @@ -292,11 +292,9 @@ fn it_does_not_error_when_wasm_bindgen_is_declared() { #[test] fn configure_wasm_bindgen_debug_incorrectly_is_error() { let fixture = utils::fixture::Fixture::new(); - fixture - .readme() - .file( - "Cargo.toml", - r#" + fixture.readme().hello_world_src_lib().file( + "Cargo.toml", + r#" [package] authors = ["The wasm-pack developers"] description = "so awesome rust+wasm package" @@ -314,8 +312,7 @@ fn configure_wasm_bindgen_debug_incorrectly_is_error() { [package.metadata.wasm-pack.profile.dev.wasm-bindgen] debug-js-glue = "not a boolean" "#, - ) - .hello_world_src_lib(); + ); let cli = Cli::from_iter_safe(vec![ "wasm-pack", @@ -333,3 +330,40 @@ fn configure_wasm_bindgen_debug_incorrectly_is_error() { .to_string() .contains("package.metadata.wasm-pack.profile.dev.wasm-bindgen.debug"))); } + +#[test] +fn parse_crate_data_returns_unused_keys_in_cargo_toml() { + let fixture = utils::fixture::Fixture::new(); + fixture + .readme() + .file( + "Cargo.toml", + r#" + [package] + authors = ["The wasm-pack developers"] + description = "so awesome rust+wasm package" + license = "WTFPL" + name = "whatever" + repository = "https://github.com/rustwasm/wasm-pack.git" + version = "0.1.0" + + [lib] + crate-type = ["cdylib"] + + [dependencies] + wasm-bindgen = "0.2" + + [package.metadata.wasmpack.profile.dev.wasm-bindgen] + debug-js-glue = true + "#, + ) + .hello_world_src_lib(); + + let result = manifest::CrateData::parse_crate_data(&fixture.path.join("Cargo.toml")); + + assert!(result.is_ok()); + + let manifest::ManifestAndUnsedKeys { unused_keys, .. } = result.unwrap(); + + assert!(unused_keys.contains("package.metadata.wasmpack")); +} From c39410c81e8f69c2449e0a1465544ff744664f48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Tue, 13 Nov 2018 22:42:59 +0100 Subject: [PATCH 022/106] feat: Use levenshtein function to warn about wasm-pack typos --- Cargo.lock | 7 +++++++ Cargo.toml | 22 +++++++++++++--------- src/lib.rs | 1 + src/manifest/mod.rs | 31 +++++++++++++++++++++++-------- tests/all/manifest.rs | 5 +++-- 5 files changed, 47 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d07284f..d2eaa23 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -835,6 +835,11 @@ name = "strsim" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "structopt" version = "0.2.13" @@ -1070,6 +1075,7 @@ dependencies = [ "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-term 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "structopt 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "tar 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1245,6 +1251,7 @@ dependencies = [ "checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" +"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum structopt 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "41c4a2479a078509940d82773d90ff824a8c89533ab3b59cd3ce8b0c0e369c02" "checksum structopt-derive 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "5352090cfae7a2c85e1a31146268b53396106c88ca5d6ccee2e3fae83b6e35c2" "checksum syn 0.15.18 (registry+https://github.com/rust-lang/crates.io-index)" = "90c39a061e2f412a9f869540471ab679e85e50c6b05604daf28bc3060f75c430" diff --git a/Cargo.toml b/Cargo.toml index 0c7a45b..b39ba12 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,13 +1,13 @@ [package] -name = "wasm-pack" -description = "pack up the wasm and publish it to npm!" -version = "0.5.1" authors = ["Ashley Williams "] -repository = "https://github.com/ashleygwilliams/wasm-pack.git" -license = "MIT/Apache-2.0" -readme = "README.md" categories = ["wasm"] +description = "pack up the wasm and publish it to npm!" documentation = "https://rustwasm.github.io/wasm-pack/" +license = "MIT/Apache-2.0" +name = "wasm-pack" +readme = "README.md" +repository = "https://github.com/ashleygwilliams/wasm-pack.git" +version = "0.5.1" [dependencies] atty = "0.2.11" @@ -21,7 +21,6 @@ hex = "0.3" human-panic = "1.0.1" indicatif = "0.9.0" lazy_static = "1.1.0" -openssl = { version = '0.10.11', optional = true } parking_lot = "0.6" serde = "1.0.74" serde_derive = "1.0.74" @@ -29,16 +28,21 @@ serde_ignored = "0.0.4" serde_json = "1.0.26" siphasher = "0.2.3" slog = "2.3" -slog-term = "2.4" slog-async = "2.3" +slog-term = "2.4" +strsim = "0.8.0" structopt = "0.2" tar = "0.4.16" toml = "0.4" which = "2.0.0" zip = "0.4.2" +[dependencies.openssl] +optional = true +version = "0.10.11" + [dev-dependencies] tempfile = "3" [features] -vendored-openssl = ['openssl/vendored'] +vendored-openssl = ["openssl/vendored"] diff --git a/src/lib.rs b/src/lib.rs index 0000c4a..7ced3bb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,6 +6,7 @@ extern crate cargo_metadata; extern crate console; extern crate curl; extern crate dirs; +extern crate strsim; #[macro_use] extern crate failure; extern crate flate2; diff --git a/src/manifest/mod.rs b/src/manifest/mod.rs index 9211303..6efe1a1 100644 --- a/src/manifest/mod.rs +++ b/src/manifest/mod.rs @@ -16,9 +16,12 @@ use progressbar::Step; use serde::{self, Deserialize}; use serde_json; use std::collections::BTreeSet; +use strsim::levenshtein; use toml; use PBAR; +const WASM_PACK_METADATA_KEY: &'static str = "package.metadata.wasm-pack"; + /// Store for metadata learned about a crate pub struct CrateData { data: Metadata, @@ -202,6 +205,7 @@ struct NpmData { pub struct ManifestAndUnsedKeys { pub manifest: CargoManifest, pub unused_keys: BTreeSet, + pub has_possible_typo: bool, } impl CrateData { @@ -220,12 +224,10 @@ impl CrateData { let data = cargo_metadata::metadata(Some(&manifest_path)).map_err(error_chain_to_failure)?; - let ManifestAndUnsedKeys { - manifest, - unused_keys, - } = CrateData::parse_crate_data(&manifest_path)?; - CrateData::warn_for_unused_keys(&unused_keys); + let manifest_and_keys = CrateData::parse_crate_data(&manifest_path)?; + CrateData::warn_for_unused_keys(&manifest_and_keys); + let manifest = manifest_and_keys.manifest; let current_idx = data .packages .iter() @@ -264,11 +266,17 @@ impl CrateData { let manifest = &mut toml::Deserializer::new(&manifest); let mut unused_keys = BTreeSet::new(); + let mut has_possible_typo = false; + let levenshtein_threshold = 1; let manifest: CargoManifest = serde_ignored::deserialize(manifest, |path| { let path_string = path.to_string(); - if path_string.contains("metadata") { + if levenshtein(WASM_PACK_METADATA_KEY, &path_string) == levenshtein_threshold { + has_possible_typo = true; + } + + if path_string.contains(WASM_PACK_METADATA_KEY) { unused_keys.insert(path_string); } }) @@ -277,13 +285,20 @@ impl CrateData { Ok(ManifestAndUnsedKeys { manifest, unused_keys, + has_possible_typo, }) } /// Iterating through all the passed `unused_keys` and output /// a warning for each unknown key. - pub fn warn_for_unused_keys(unused_keys: &BTreeSet) { - unused_keys.iter().for_each(|path| { + pub fn warn_for_unused_keys(manifest_and_keys: &ManifestAndUnsedKeys) { + if manifest_and_keys.has_possible_typo { + PBAR.warn(&format!( + "It's possible that you misspelled the \"{}\" setting in your Cargo.toml.", + WASM_PACK_METADATA_KEY + )); + } + manifest_and_keys.unused_keys.iter().for_each(|path| { PBAR.warn(&format!( "\"{}\" is a unknown key and will be ignored. Please check your Cargo.toml.", path diff --git a/tests/all/manifest.rs b/tests/all/manifest.rs index dce984f..1d631c8 100644 --- a/tests/all/manifest.rs +++ b/tests/all/manifest.rs @@ -353,7 +353,8 @@ fn parse_crate_data_returns_unused_keys_in_cargo_toml() { [dependencies] wasm-bindgen = "0.2" - [package.metadata.wasmpack.profile.dev.wasm-bindgen] + # Note: production is not valid. + [package.metadata.wasm-pack.profile.production.wasm-bindgen] debug-js-glue = true "#, ) @@ -365,5 +366,5 @@ fn parse_crate_data_returns_unused_keys_in_cargo_toml() { let manifest::ManifestAndUnsedKeys { unused_keys, .. } = result.unwrap(); - assert!(unused_keys.contains("package.metadata.wasmpack")); + assert!(unused_keys.contains("package.metadata.wasm-pack.profile.production")); } From 8dd6fe4453c07e5f8f116b3d12da8ac39916f82e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Wed, 14 Nov 2018 18:29:04 +0100 Subject: [PATCH 023/106] chore: Restore unwanted reordering --- Cargo.toml | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b39ba12..60aa2bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,13 +1,13 @@ [package] -authors = ["Ashley Williams "] -categories = ["wasm"] +name = "wasm-pack" description = "pack up the wasm and publish it to npm!" -documentation = "https://rustwasm.github.io/wasm-pack/" +version = "0.5.1" +authors = ["Ashley Williams "] +repository = "https://github.com/ashleygwilliams/wasm-pack.git" license = "MIT/Apache-2.0" -name = "wasm-pack" readme = "README.md" -repository = "https://github.com/ashleygwilliams/wasm-pack.git" -version = "0.5.1" +categories = ["wasm"] +documentation = "https://rustwasm.github.io/wasm-pack/" [dependencies] atty = "0.2.11" @@ -21,6 +21,7 @@ hex = "0.3" human-panic = "1.0.1" indicatif = "0.9.0" lazy_static = "1.1.0" +openssl = { version = '0.10.11', optional = true } parking_lot = "0.6" serde = "1.0.74" serde_derive = "1.0.74" @@ -28,8 +29,8 @@ serde_ignored = "0.0.4" serde_json = "1.0.26" siphasher = "0.2.3" slog = "2.3" -slog-async = "2.3" slog-term = "2.4" +slog-async = "2.3" strsim = "0.8.0" structopt = "0.2" tar = "0.4.16" @@ -37,12 +38,8 @@ toml = "0.4" which = "2.0.0" zip = "0.4.2" -[dependencies.openssl] -optional = true -version = "0.10.11" - [dev-dependencies] tempfile = "3" [features] -vendored-openssl = ["openssl/vendored"] +vendored-openssl = ['openssl/vendored'] From 07d813f6063bce9e8525a99c4ed7134a25f9a1bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Wed, 14 Nov 2018 21:59:25 +0100 Subject: [PATCH 024/106] fix: Print the possible misspelled key so the user doesnt have to guess --- src/manifest/mod.rs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/manifest/mod.rs b/src/manifest/mod.rs index 6efe1a1..5d44d39 100644 --- a/src/manifest/mod.rs +++ b/src/manifest/mod.rs @@ -205,7 +205,6 @@ struct NpmData { pub struct ManifestAndUnsedKeys { pub manifest: CargoManifest, pub unused_keys: BTreeSet, - pub has_possible_typo: bool, } impl CrateData { @@ -266,17 +265,15 @@ impl CrateData { let manifest = &mut toml::Deserializer::new(&manifest); let mut unused_keys = BTreeSet::new(); - let mut has_possible_typo = false; let levenshtein_threshold = 1; let manifest: CargoManifest = serde_ignored::deserialize(manifest, |path| { let path_string = path.to_string(); - if levenshtein(WASM_PACK_METADATA_KEY, &path_string) == levenshtein_threshold { - has_possible_typo = true; - } - - if path_string.contains(WASM_PACK_METADATA_KEY) { + if path_string.starts_with("package.metadata") + && (path_string.contains("wasm-pack") + || levenshtein(WASM_PACK_METADATA_KEY, &path_string) <= levenshtein_threshold) + { unused_keys.insert(path_string); } }) @@ -285,19 +282,12 @@ impl CrateData { Ok(ManifestAndUnsedKeys { manifest, unused_keys, - has_possible_typo, }) } /// Iterating through all the passed `unused_keys` and output /// a warning for each unknown key. pub fn warn_for_unused_keys(manifest_and_keys: &ManifestAndUnsedKeys) { - if manifest_and_keys.has_possible_typo { - PBAR.warn(&format!( - "It's possible that you misspelled the \"{}\" setting in your Cargo.toml.", - WASM_PACK_METADATA_KEY - )); - } manifest_and_keys.unused_keys.iter().for_each(|path| { PBAR.warn(&format!( "\"{}\" is a unknown key and will be ignored. Please check your Cargo.toml.", From c98287ff1681a9ae4517d3c8b49eb9153a8c4806 Mon Sep 17 00:00:00 2001 From: Junjie Huang <349373001@qq.com> Date: Fri, 5 Oct 2018 23:53:20 +0800 Subject: [PATCH 025/106] bugfix(command/build.rs): Cancel Escape fix #390 --- src/command/build.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/command/build.rs b/src/command/build.rs index d3dc15f..9abd8e3 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -176,13 +176,13 @@ impl Build { info!(&log, "Done in {}.", &duration); info!( &log, - "Your wasm pkg is ready to publish at {:#?}.", &self.out_dir + "Your wasm pkg is ready to publish at {:#}.", &self.out_dir ); PBAR.message(&format!("{} Done in {}", emoji::SPARKLE, &duration)); PBAR.message(&format!( - "{} Your wasm pkg is ready to publish at {:#?}.", + "{} Your wasm pkg is ready to publish at {:#}.", emoji::PACKAGE, self.out_dir.canonicalize().unwrap_or(self.out_dir.clone()) )); From d6aea784af38048e6116edc9aa2df073f271aaf7 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Sat, 6 Oct 2018 13:36:28 +0800 Subject: [PATCH 026/106] Update src/command/build.rs use Path::display to show out_dir --- src/command/build.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/command/build.rs b/src/command/build.rs index 9abd8e3..8adc928 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -176,15 +176,15 @@ impl Build { info!(&log, "Done in {}.", &duration); info!( &log, - "Your wasm pkg is ready to publish at {:#}.", &self.out_dir + "Your wasm pkg is ready to publish at {}.", self.out_dir.display() ); PBAR.message(&format!("{} Done in {}", emoji::SPARKLE, &duration)); PBAR.message(&format!( - "{} Your wasm pkg is ready to publish at {:#}.", + "{} Your wasm pkg is ready to publish at {}.", emoji::PACKAGE, - self.out_dir.canonicalize().unwrap_or(self.out_dir.clone()) + self.out_dir.canonicalize().unwrap_or(self.out_dir.clone()).display() )); Ok(()) } From 6c54d293f591fe336f3aeb83a0d2842a6da0cb52 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Sat, 6 Oct 2018 13:54:04 +0800 Subject: [PATCH 027/106] fmt(command/build.rs): format code changes --- src/command/build.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/command/build.rs b/src/command/build.rs index 8adc928..c7d7efc 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -176,7 +176,8 @@ impl Build { info!(&log, "Done in {}.", &duration); info!( &log, - "Your wasm pkg is ready to publish at {}.", self.out_dir.display() + "Your wasm pkg is ready to publish at {}.", + self.out_dir.display() ); PBAR.message(&format!("{} Done in {}", emoji::SPARKLE, &duration)); @@ -184,7 +185,10 @@ impl Build { PBAR.message(&format!( "{} Your wasm pkg is ready to publish at {}.", emoji::PACKAGE, - self.out_dir.canonicalize().unwrap_or(self.out_dir.clone()).display() + self.out_dir + .canonicalize() + .unwrap_or(self.out_dir.clone()) + .display() )); Ok(()) } From 6edb3732aa87986b88ea3c7d6052c728e2894978 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Mon, 8 Oct 2018 21:31:27 +0800 Subject: [PATCH 028/106] update(command/build): lazily eval if canonicalizing failed --- src/command/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/command/build.rs b/src/command/build.rs index c7d7efc..63a963a 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -187,7 +187,7 @@ impl Build { emoji::PACKAGE, self.out_dir .canonicalize() - .unwrap_or(self.out_dir.clone()) + .unwrap_or_else(|_err| self.out_dir.clone()) .display() )); Ok(()) From 472890c063a83cc5cbf3c7fd4c25dda76afb2fe5 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Thu, 11 Oct 2018 22:12:56 +0800 Subject: [PATCH 029/106] test(command/build): add test for fix-390 --- tests/all/build.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/all/build.rs b/tests/all/build.rs index cc21fbb..29b0fb5 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -227,4 +227,22 @@ fn build_with_and_without_wasm_bindgen_debug() { "Should only contain moved value assertions when debug assertions are enabled" ); } +#[cfg(target_os = "windows")] +#[test] +fn it_format_out_dir_on_windows() { + let fixture = utils::fixture::js_hello_world(); + fixture.install_local_wasm_bindgen(); + let cli = Cli::from_iter_safe(vec![ + "wasm-pack", + "build", + &fixture.path.display().to_string(), + ]) + let result = command::run_wasm_pack(cli.cmd, &logger); + assert!(result.is_ok(), "js_hello_world example should pass"); + + let wasm_pack_log = utils::file::read_file(&fixture.path.join("wasm-pack.log")).unwrap(); + assert!( + wasm_pack_log.contains(r"Your wasm pkg is ready to publish at C:\Users\"), + "directories in wasm-pack.log should be well formatted", + ); } From 054e1739ae69c003fcb6db8da27c4181b2d2e195 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Sat, 13 Oct 2018 22:42:07 +0800 Subject: [PATCH 030/106] test(command/build): right test case the test case would pass after solving #408 --- tests/all/build.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/all/build.rs b/tests/all/build.rs index 29b0fb5..18028d3 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -237,8 +237,9 @@ fn it_format_out_dir_on_windows() { "build", &fixture.path.display().to_string(), ]) - let result = command::run_wasm_pack(cli.cmd, &logger); - assert!(result.is_ok(), "js_hello_world example should pass"); + let logger = logger::new(&cli.cmd, 1).unwrap(); + let _result = + command::run_wasm_pack(cli.cmd, &logger).expect("js_hello_world example should pass"); let wasm_pack_log = utils::file::read_file(&fixture.path.join("wasm-pack.log")).unwrap(); assert!( From cf56fa10d68c2e4b03a04913ae6f571bc53c6571 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Tue, 16 Oct 2018 22:42:46 +0800 Subject: [PATCH 031/106] bugfix(command/build): passing test case this commit fixes #390, #414, and closes #408 for the test case have to pass after a successful build. --- src/bindgen.rs | 4 ++++ tests/all/build.rs | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/bindgen.rs b/src/bindgen.rs index 8282f6b..512eb51 100644 --- a/src/bindgen.rs +++ b/src/bindgen.rs @@ -8,7 +8,11 @@ use failure::{self, ResultExt}; use manifest::CrateData; use progressbar::Step; use slog::Logger; +<<<<<<< HEAD use std::fs; +======= +use std::env; +>>>>>>> bugfix(command/build): passing test case use std::path::{Path, PathBuf}; use std::process::Command; use target; diff --git a/tests/all/build.rs b/tests/all/build.rs index 18028d3..9a42ed9 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -34,6 +34,7 @@ fn it_should_build_js_hello_world_example() { &fixture.path.display().to_string(), ]) .unwrap(); +<<<<<<< HEAD fixture.run(cli.cmd).unwrap(); } @@ -138,6 +139,11 @@ fn it_should_build_nested_project_with_transitive_dependencies() { ]) .unwrap(); fixture.run(cli.cmd).unwrap(); +======= + let logger = logger::new(&cli.cmd, cli.verbosity).unwrap(); + command::run_wasm_pack(cli.cmd, &logger) + .expect("running wasm-pack in a js-hello-world directory should succeed."); +>>>>>>> bugfix(command/build): passing test case } #[test] @@ -237,9 +243,15 @@ fn it_format_out_dir_on_windows() { "build", &fixture.path.display().to_string(), ]) +<<<<<<< HEAD let logger = logger::new(&cli.cmd, 1).unwrap(); let _result = command::run_wasm_pack(cli.cmd, &logger).expect("js_hello_world example should pass"); +======= + .unwrap(); + let result = command::run_wasm_pack(cli.cmd, &logger); + assert!(result.is_ok(), "js_hello_world example should pass"); +>>>>>>> bugfix(command/build): passing test case let wasm_pack_log = utils::file::read_file(&fixture.path.join("wasm-pack.log")).unwrap(); assert!( From b3010155886d38f6a8be10c22b525fc4bd5da9ee Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Sat, 20 Oct 2018 23:42:22 +0800 Subject: [PATCH 032/106] update: rebasing to master fixes conflicts encountered when rebasing to master fixes # 390 --- src/bindgen.rs | 3 --- tests/all/build.rs | 12 ------------ 2 files changed, 15 deletions(-) diff --git a/src/bindgen.rs b/src/bindgen.rs index 512eb51..32f7063 100644 --- a/src/bindgen.rs +++ b/src/bindgen.rs @@ -8,11 +8,8 @@ use failure::{self, ResultExt}; use manifest::CrateData; use progressbar::Step; use slog::Logger; -<<<<<<< HEAD use std::fs; -======= use std::env; ->>>>>>> bugfix(command/build): passing test case use std::path::{Path, PathBuf}; use std::process::Command; use target; diff --git a/tests/all/build.rs b/tests/all/build.rs index 9a42ed9..18028d3 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -34,7 +34,6 @@ fn it_should_build_js_hello_world_example() { &fixture.path.display().to_string(), ]) .unwrap(); -<<<<<<< HEAD fixture.run(cli.cmd).unwrap(); } @@ -139,11 +138,6 @@ fn it_should_build_nested_project_with_transitive_dependencies() { ]) .unwrap(); fixture.run(cli.cmd).unwrap(); -======= - let logger = logger::new(&cli.cmd, cli.verbosity).unwrap(); - command::run_wasm_pack(cli.cmd, &logger) - .expect("running wasm-pack in a js-hello-world directory should succeed."); ->>>>>>> bugfix(command/build): passing test case } #[test] @@ -243,15 +237,9 @@ fn it_format_out_dir_on_windows() { "build", &fixture.path.display().to_string(), ]) -<<<<<<< HEAD let logger = logger::new(&cli.cmd, 1).unwrap(); let _result = command::run_wasm_pack(cli.cmd, &logger).expect("js_hello_world example should pass"); -======= - .unwrap(); - let result = command::run_wasm_pack(cli.cmd, &logger); - assert!(result.is_ok(), "js_hello_world example should pass"); ->>>>>>> bugfix(command/build): passing test case let wasm_pack_log = utils::file::read_file(&fixture.path.join("wasm-pack.log")).unwrap(); assert!( From 6d3f1c283556274b32875b64d421691c58058a82 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Wed, 7 Nov 2018 20:46:45 +0800 Subject: [PATCH 033/106] remove canonicalize and use display directly --- src/command/build.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/command/build.rs b/src/command/build.rs index 63a963a..37ec93d 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -185,10 +185,7 @@ impl Build { PBAR.message(&format!( "{} Your wasm pkg is ready to publish at {}.", emoji::PACKAGE, - self.out_dir - .canonicalize() - .unwrap_or_else(|_err| self.out_dir.clone()) - .display() + self.out_dir.display() )); Ok(()) } From 2512199cb3f79c70620ab069b3702decc034adbd Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Thu, 8 Nov 2018 21:33:31 +0800 Subject: [PATCH 034/106] resolve conlicts and pass the test --- src/bindgen.rs | 1 - tests/all/build.rs | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/bindgen.rs b/src/bindgen.rs index 32f7063..8282f6b 100644 --- a/src/bindgen.rs +++ b/src/bindgen.rs @@ -9,7 +9,6 @@ use manifest::CrateData; use progressbar::Step; use slog::Logger; use std::fs; -use std::env; use std::path::{Path, PathBuf}; use std::process::Command; use target; diff --git a/tests/all/build.rs b/tests/all/build.rs index 18028d3..3cef420 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -237,13 +237,12 @@ fn it_format_out_dir_on_windows() { "build", &fixture.path.display().to_string(), ]) - let logger = logger::new(&cli.cmd, 1).unwrap(); - let _result = - command::run_wasm_pack(cli.cmd, &logger).expect("js_hello_world example should pass"); + .unwrap(); + fixture.run(cli.cmd).unwrap(); let wasm_pack_log = utils::file::read_file(&fixture.path.join("wasm-pack.log")).unwrap(); assert!( - wasm_pack_log.contains(r"Your wasm pkg is ready to publish at C:\Users\"), + wasm_pack_log.contains(r"Your wasm pkg is ready to publish at c:\Users\"), "directories in wasm-pack.log should be well formatted", ); } From 83de8d71d22892e8417728b6dbce312a969a2349 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Thu, 8 Nov 2018 22:55:58 +0800 Subject: [PATCH 035/106] fix test for wasm-bindgen 0.2.21 --- tests/all/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/all/build.rs b/tests/all/build.rs index 3cef420..72d0701 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -242,7 +242,7 @@ fn it_format_out_dir_on_windows() { let wasm_pack_log = utils::file::read_file(&fixture.path.join("wasm-pack.log")).unwrap(); assert!( - wasm_pack_log.contains(r"Your wasm pkg is ready to publish at c:\Users\"), + wasm_pack_log.contains(r"Your wasm pkg is ready to publish at C:\Users\"), "directories in wasm-pack.log should be well formatted", ); } From 06e38ec3e8bc27824f4563d5a004999580ad3f4f Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Sat, 10 Nov 2018 10:47:17 +0800 Subject: [PATCH 036/106] checkout if CI's log contain INFO messages --- tests/all/build.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/all/build.rs b/tests/all/build.rs index 72d0701..b0f8ccc 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -241,6 +241,12 @@ fn it_format_out_dir_on_windows() { fixture.run(cli.cmd).unwrap(); let wasm_pack_log = utils::file::read_file(&fixture.path.join("wasm-pack.log")).unwrap(); + + // may be the CI doesn't output INFO content + assert!( + wasm_pack_log.contains("INFO"), + "wasm_pack.log should output INFO level message", + ); assert!( wasm_pack_log.contains(r"Your wasm pkg is ready to publish at C:\Users\"), "directories in wasm-pack.log should be well formatted", From 7fd731279b4ca97e1cfa801c884157e8cb3c7e62 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Sat, 10 Nov 2018 11:04:43 +0800 Subject: [PATCH 037/106] print out wasm-log for check --- tests/all/build.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/tests/all/build.rs b/tests/all/build.rs index b0f8ccc..7e61e6c 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -241,14 +241,8 @@ fn it_format_out_dir_on_windows() { fixture.run(cli.cmd).unwrap(); let wasm_pack_log = utils::file::read_file(&fixture.path.join("wasm-pack.log")).unwrap(); - - // may be the CI doesn't output INFO content assert!( - wasm_pack_log.contains("INFO"), - "wasm_pack.log should output INFO level message", - ); - assert!( - wasm_pack_log.contains(r"Your wasm pkg is ready to publish at C:\Users\"), + wasm_pack_log.contains(r"Your wasm pkg is ready to publish at \\?\C:\Users\"), "directories in wasm-pack.log should be well formatted", ); } From 837393b5fcec35822538b02d060de2d2d3a7e531 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Sat, 17 Nov 2018 00:27:55 +0800 Subject: [PATCH 038/106] trim head --- tests/all/build.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/all/build.rs b/tests/all/build.rs index 7e61e6c..d40d345 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -227,6 +227,8 @@ fn build_with_and_without_wasm_bindgen_debug() { "Should only contain moved value assertions when debug assertions are enabled" ); } +} + #[cfg(target_os = "windows")] #[test] fn it_format_out_dir_on_windows() { @@ -242,7 +244,7 @@ fn it_format_out_dir_on_windows() { let wasm_pack_log = utils::file::read_file(&fixture.path.join("wasm-pack.log")).unwrap(); assert!( - wasm_pack_log.contains(r"Your wasm pkg is ready to publish at \\?\C:\Users\"), + wasm_pack_log.contains(r"Your wasm pkg is ready to publish at c:\Users\"), "directories in wasm-pack.log should be well formatted", ); } From 06a949b9ed314d1e3ad0400b6b4446cb9817d03c Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Sat, 17 Nov 2018 12:22:37 +0800 Subject: [PATCH 039/106] Capital disk Url --- tests/all/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/all/build.rs b/tests/all/build.rs index d40d345..0c91d06 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -244,7 +244,7 @@ fn it_format_out_dir_on_windows() { let wasm_pack_log = utils::file::read_file(&fixture.path.join("wasm-pack.log")).unwrap(); assert!( - wasm_pack_log.contains(r"Your wasm pkg is ready to publish at c:\Users\"), + wasm_pack_log.contains(r"Your wasm pkg is ready to publish at C:\Users\"), "directories in wasm-pack.log should be well formatted", ); } From 9feb3a857cbbe8df1b3c743e45eae930a8c568e7 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Sat, 17 Nov 2018 23:57:48 +0800 Subject: [PATCH 040/106] check if the log missing things --- tests/all/build.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/all/build.rs b/tests/all/build.rs index 0c91d06..95d86c0 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -243,6 +243,14 @@ fn it_format_out_dir_on_windows() { fixture.run(cli.cmd).unwrap(); let wasm_pack_log = utils::file::read_file(&fixture.path.join("wasm-pack.log")).unwrap(); + assert!( + wasm_pack_log.contains("INFO"), + "wasm-pack.log should contains INFO message" + ); + assert!( + wasm_pack_log.contains("Your wasm pkg is ready to publish at"), + "wasm-pack.log should contains publish message" + ); assert!( wasm_pack_log.contains(r"Your wasm pkg is ready to publish at C:\Users\"), "directories in wasm-pack.log should be well formatted", From c6894c46f7bc392b116e7dbc1668dcc3aa849241 Mon Sep 17 00:00:00 2001 From: huangjj27 Date: Sun, 18 Nov 2018 00:13:40 +0800 Subject: [PATCH 041/106] bugfix(390): pass the ci in the CI, there is no user. begining with "C:\" is just enough --- tests/all/build.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/tests/all/build.rs b/tests/all/build.rs index 95d86c0..7d06f15 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -244,15 +244,7 @@ fn it_format_out_dir_on_windows() { let wasm_pack_log = utils::file::read_file(&fixture.path.join("wasm-pack.log")).unwrap(); assert!( - wasm_pack_log.contains("INFO"), - "wasm-pack.log should contains INFO message" - ); - assert!( - wasm_pack_log.contains("Your wasm pkg is ready to publish at"), - "wasm-pack.log should contains publish message" - ); - assert!( - wasm_pack_log.contains(r"Your wasm pkg is ready to publish at C:\Users\"), + wasm_pack_log.contains(r"Your wasm pkg is ready to publish at C:\"), "directories in wasm-pack.log should be well formatted", ); } From 2d837f795c2448d0d14724c1bb047021342f7a48 Mon Sep 17 00:00:00 2001 From: Mason Stallmo Date: Sun, 14 Oct 2018 09:37:19 -0500 Subject: [PATCH 042/106] Copy license file(s) to out directory Check the Cagro.toml for a license and if one is found glob for LICENSE* files to copy to the out directory --- Cargo.lock | 7 +++ Cargo.toml | 1 + src/command/build.rs | 17 ++++- src/lib.rs | 3 + src/license.rs | 76 ++++++++++++++++++++++ tests/all/license.rs | 125 +++++++++++++++++++++++++++++++++++++ tests/all/main.rs | 1 + tests/all/utils/fixture.rs | 59 +++++++++++++++++ 8 files changed, 288 insertions(+), 1 deletion(-) create mode 100644 src/license.rs create mode 100644 tests/all/license.rs diff --git a/Cargo.lock b/Cargo.lock index 2279393..d0133d5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -317,6 +317,11 @@ name = "fuchsia-zircon-sys" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "glob" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "heck" version = "0.3.0" @@ -1048,6 +1053,7 @@ dependencies = [ "dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "human-panic 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "indicatif 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1172,6 +1178,7 @@ dependencies = [ "checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" "checksum heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea04fa3ead4e05e51a7c806fc07271fdbde4e246a6c6d1efd52e72230b771b82" "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" "checksum human-panic 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "21638c5955a6daf3ecc42cae702335fc37a72a4abcc6959ce457b31a7d43bbdd" diff --git a/Cargo.toml b/Cargo.toml index b486071..e2563ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,7 @@ failure = "0.1.2" flate2 = "1.0.2" hex = "0.3" human-panic = "1.0.1" +glob = "0.2" indicatif = "0.9.0" lazy_static = "1.1.0" openssl = { version = '0.10.11', optional = true } diff --git a/src/command/build.rs b/src/command/build.rs index d3dc15f..2779851 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -7,6 +7,7 @@ use command::utils::{create_pkg_dir, set_crate_path}; use emoji; use failure::Error; use indicatif::HumanDuration; +use license; use lockfile::Lockfile; use manifest; use progressbar::Step; @@ -209,6 +210,7 @@ impl Build { step_create_dir, step_create_json, step_copy_readme, + step_copy_license, step_install_wasm_bindgen, step_run_wasm_bindgen, ], @@ -219,6 +221,7 @@ impl Build { step_create_dir, step_create_json, step_copy_readme, + step_copy_license, step_run_wasm_bindgen ], BuildMode::Force => steps![ @@ -226,6 +229,7 @@ impl Build { step_create_dir, step_create_json, step_copy_readme, + step_copy_license, step_run_wasm_bindgen ], } @@ -300,7 +304,18 @@ impl Build { Ok(()) } - fn step_install_wasm_bindgen(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { + fn step_copy_license(&mut self, step: &Step, log: &Logger) -> Result<(), failure::Error> { + info!(&log, "Copying license from crate..."); + license::copy_from_crate(&self.crate_path, &self.out_dir, step)?; + info!(&log, "Copied license from crate to {:#?}.", &self.out_dir); + Ok(()) + } + + fn step_install_wasm_bindgen( + &mut self, + step: &Step, + log: &Logger, + ) -> Result<(), failure::Error> { info!(&log, "Identifying wasm-bindgen dependency..."); let lockfile = Lockfile::new(&self.crate_data)?; let bindgen_version = lockfile.require_wasm_bindgen()?; diff --git a/src/lib.rs b/src/lib.rs index 2cec7a8..bebdb2a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,6 +10,7 @@ extern crate dirs; extern crate failure; extern crate flate2; extern crate hex; +extern crate glob; extern crate indicatif; #[macro_use] extern crate lazy_static; @@ -36,6 +37,8 @@ pub mod build; pub mod child; pub mod command; pub mod emoji; +pub mod error; +pub mod license; pub mod lockfile; pub mod logger; pub mod manifest; diff --git a/src/license.rs b/src/license.rs new file mode 100644 index 0000000..4e7a41b --- /dev/null +++ b/src/license.rs @@ -0,0 +1,76 @@ +//! Copy `LICENSE` file(s) for the packaged wasm. + +use failure; +use std::fs; +use std::path::Path; + +use emoji; +use glob::glob; +use manifest; +use progressbar::Step; +use PBAR; + +fn get_license(path: &Path) -> Option { + match manifest::get_crate_license(path) { + Ok(license) => license, + Err(_) => None, + } +} + +fn glob_license_files(path: &Path) -> Result, failure::Error> { + let mut license_files: Vec = Vec::new(); + for entry in glob(path.join("LICENSE*").to_str().unwrap())? { + match entry { + Ok(globed_path) => { + license_files.push(String::from( + globed_path.file_name().unwrap().to_str().unwrap(), + )); + } + Err(e) => println!("{:?}", e), + } + } + Ok(license_files) +} + +/// Copy the crate's license into the `pkg` directory. +pub fn copy_from_crate(path: &Path, out_dir: &Path, step: &Step) -> Result<(), failure::Error> { + assert!( + fs::metadata(path).ok().map_or(false, |m| m.is_dir()), + "crate directory should exist" + ); + + assert!( + fs::metadata(&out_dir).ok().map_or(false, |m| m.is_dir()), + "crate's pkg directory should exist" + ); + + match get_license(path) { + Some(_) => { + let msg = format!("{}Copying over your LICENSE...", emoji::DANCERS); + PBAR.step(step, &msg); + let license_files = glob_license_files(path); + + match license_files { + Ok(files) => { + if files.len() == 0 { + PBAR.info("License key is set in Cargo.toml but no LICENSE file(s) were found; Please add the LICENSE file(s) to your project directory"); + return Ok(()); + } + for license_file in files { + let crate_license_path = path.join(&license_file); + let new_license_path = out_dir.join(&license_file); + if let Err(_) = fs::copy(&crate_license_path, &new_license_path) { + PBAR.info("origin crate has no LICENSE"); + } + } + } + Err(_) => PBAR.info("origin crate has no LICENSE"), + } + } + None => { + PBAR.step(step, "No LICENSE found in Cargo.toml skipping..."); + } + }; + + Ok(()) +} diff --git a/tests/all/license.rs b/tests/all/license.rs new file mode 100644 index 0000000..376bd4d --- /dev/null +++ b/tests/all/license.rs @@ -0,0 +1,125 @@ +extern crate failure; +extern crate wasm_pack; + +use std::fs; + +use utils::{self, fixture}; +use wasm_pack::license; + +#[test] +fn it_copies_a_license_default_path() { + let fixture = fixture::single_license(); + let out_dir = fixture.path.join("pkg"); + fs::create_dir(&out_dir).expect("should create pkg directory OK"); + + let step = wasm_pack::progressbar::Step::new(1); + assert!(license::copy_from_crate(&fixture.path, &out_dir, &step).is_ok()); + + let crate_license_path = fixture.path.join("LICENSE-WTFPL"); + let pkg_license_path = out_dir.join("LICENSE-WTFPL"); + println!( + "wasm-pack: should have copied LICENSE from '{}' to '{}'", + crate_license_path.display(), + pkg_license_path.display() + ); + assert!(fs::metadata(&crate_license_path).is_ok()); + + assert!(fs::metadata(&pkg_license_path).is_ok()); + + let crate_license = utils::file::read_file(&crate_license_path).unwrap(); + let pkg_license = utils::file::read_file(&pkg_license_path).unwrap(); + assert_eq!(crate_license, pkg_license); +} + +#[test] +fn it_copies_a_license_provied_path() { + let fixture = fixture::single_license(); + let out_dir = fixture.path.join("pkg"); + fs::create_dir(&out_dir).expect("should create pkg directory OK"); + + let step = wasm_pack::progressbar::Step::new(1); + assert!(license::copy_from_crate(&fixture.path, &out_dir, &step).is_ok()); + let crate_license_path = fixture.path.join("LICENSE-WTFPL"); + let pkg_license_path = out_dir.join("LICENSE-WTFPL"); + println!( + "wasm-pack: should have copied LICENSE-WTFPL from '{}' to '{}'", + crate_license_path.display(), + pkg_license_path.display() + ); + assert!(fs::metadata(&crate_license_path).is_ok()); + assert!(fs::metadata(&pkg_license_path).is_ok()); + + let crate_license = utils::file::read_file(&crate_license_path).unwrap(); + let pkg_license = utils::file::read_file(&pkg_license_path).unwrap(); + assert_eq!(crate_license, pkg_license); +} + +#[test] +fn it_copies_all_licenses_default_path() { + let fixture = fixture::dual_license(); + let out_dir = fixture.path.join("pkg"); + fs::create_dir(&out_dir).expect("should create pkg directory OK"); + + let step = wasm_pack::progressbar::Step::new(1); + assert!(license::copy_from_crate(&fixture.path, &out_dir, &step).is_ok()); + + let crate_license_path = fixture.path.join("LICENSE-WTFPL"); + let pkg_license_path = out_dir.join("LICENSE-WTFPL"); + + let crate_license_path_2 = fixture.path.join("LICENSE-MIT"); + let pkg_license_path_2 = out_dir.join("LICENSE-MIT"); + + println!( + "wasm-pack: should have copied LICENSE from '{}' to '{}'", + crate_license_path.display(), + pkg_license_path.display() + ); + assert!(fs::metadata(&crate_license_path).is_ok()); + assert!(fs::metadata(&pkg_license_path).is_ok()); + + assert!(fs::metadata(&crate_license_path_2).is_ok()); + assert!(fs::metadata(&pkg_license_path_2).is_ok()); + + let crate_license = utils::file::read_file(&crate_license_path).unwrap(); + let pkg_license = utils::file::read_file(&pkg_license_path).unwrap(); + assert_eq!(crate_license, pkg_license); + + let crate_license_2 = utils::file::read_file(&crate_license_path_2).unwrap(); + let pkg_license_2 = utils::file::read_file(&pkg_license_path_2).unwrap(); + assert_eq!(crate_license_2, pkg_license_2); +} + +#[test] +fn it_copies_all_licenses_provided_path() { + let fixture = fixture::dual_license(); + let out_dir = fixture.path.join("pkg"); + fs::create_dir(&out_dir).expect("should create pkg directory OK"); + + let step = wasm_pack::progressbar::Step::new(1); + assert!(license::copy_from_crate(&fixture.path, &out_dir, &step).is_ok()); + + let crate_license_path = fixture.path.join("LICENSE-WTFPL"); + let pkg_license_path = out_dir.join("LICENSE-WTFPL"); + + let crate_license_path_2 = fixture.path.join("LICENSE-MIT"); + let pkg_license_path_2 = out_dir.join("LICENSE-MIT"); + + println!( + "wasm-pack: should have copied LICENSE from '{}' to '{}'", + crate_license_path.display(), + pkg_license_path.display() + ); + assert!(fs::metadata(&crate_license_path).is_ok()); + assert!(fs::metadata(&pkg_license_path).is_ok()); + + assert!(fs::metadata(&crate_license_path_2).is_ok()); + assert!(fs::metadata(&pkg_license_path_2).is_ok()); + + let crate_license = utils::file::read_file(&crate_license_path).unwrap(); + let pkg_license = utils::file::read_file(&pkg_license_path).unwrap(); + assert_eq!(crate_license, pkg_license); + + let crate_license_2 = utils::file::read_file(&crate_license_path_2).unwrap(); + let pkg_license_2 = utils::file::read_file(&pkg_license_path_2).unwrap(); + assert_eq!(crate_license_2, pkg_license_2); +} diff --git a/tests/all/main.rs b/tests/all/main.rs index 3fa272f..563424d 100644 --- a/tests/all/main.rs +++ b/tests/all/main.rs @@ -12,6 +12,7 @@ extern crate wasm_pack; mod bindgen; mod build; +mod license; mod lockfile; mod manifest; mod readme; diff --git a/tests/all/utils/fixture.rs b/tests/all/utils/fixture.rs index 9a9a58c..17ca365 100644 --- a/tests/all/utils/fixture.rs +++ b/tests/all/utils/fixture.rs @@ -68,6 +68,44 @@ impl Fixture { ) } + /// Add `WTFPL LICENSE` file to the fixture. + pub fn wtfpl_license(&self) -> &Self { + self.file( + "LICENSE-WTFPL", + r#" + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. + "#, + ) + } + + /// Add `MIT LICENSE` file to the fixture. + pub fn mit_license(&self) -> &Self { + self.file( + "LICENSE-MIT", + r#" + Copyright + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + "#, + ) + } + /// Add a `Cargo.toml` with a correctly configured `wasm-bindgen` /// dependency, `wasm-bindgen-test` dev-dependency, and `crate-type = /// ["cdylib"]`. @@ -590,3 +628,24 @@ pub fn transitive_dependencies() -> Fixture { project_main_fixture(&mut fixture); fixture } + +pub fn single_license() -> Fixture { + let fixture = Fixture::new(); + fixture + .readme() + .cargo_toml("single_license") + .wtfpl_license() + .hello_world_src_lib(); + fixture +} + +pub fn dual_license() -> Fixture { + let fixture = Fixture::new(); + fixture + .readme() + .cargo_toml("dual_license") + .wtfpl_license() + .mit_license() + .hello_world_src_lib(); + fixture +} From 1c704b7b7ccce54e9d290735fdc5e88146f00106 Mon Sep 17 00:00:00 2001 From: Mason Stallmo Date: Wed, 31 Oct 2018 08:54:42 -0500 Subject: [PATCH 043/106] Reword WTFPL and add punctuation to license not found message. --- src/license.rs | 2 +- tests/all/utils/fixture.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/license.rs b/src/license.rs index 4e7a41b..44391e7 100644 --- a/src/license.rs +++ b/src/license.rs @@ -68,7 +68,7 @@ pub fn copy_from_crate(path: &Path, out_dir: &Path, step: &Step) -> Result<(), f } } None => { - PBAR.step(step, "No LICENSE found in Cargo.toml skipping..."); + PBAR.step(step, "No LICENSE found in Cargo.toml, skipping..."); } }; diff --git a/tests/all/utils/fixture.rs b/tests/all/utils/fixture.rs index 17ca365..51331b6 100644 --- a/tests/all/utils/fixture.rs +++ b/tests/all/utils/fixture.rs @@ -73,7 +73,7 @@ impl Fixture { self.file( "LICENSE-WTFPL", r#" - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + DO WHATEVER YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2004 Sam Hocevar @@ -82,10 +82,10 @@ impl Fixture { copies of this license document, and changing it is allowed as long as the name is changed. - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + DO WHATEVER YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - 0. You just DO WHAT THE FUCK YOU WANT TO. + 0. You just DO WHATEVER YOU WANT TO. "#, ) } From 272ef97befcca09cccd667181c786b1664d57c99 Mon Sep 17 00:00:00 2001 From: Mason Stallmo Date: Sat, 17 Nov 2018 10:53:44 -0600 Subject: [PATCH 044/106] Refactor: make `crate_license` a method of CrateData. --- src/command/build.rs | 2 +- src/lib.rs | 3 +-- src/license.rs | 18 ++++++++---------- src/manifest/mod.rs | 5 +++++ tests/all/license.rs | 13 +++++++++---- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/command/build.rs b/src/command/build.rs index 2779851..c495cdc 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -306,7 +306,7 @@ impl Build { fn step_copy_license(&mut self, step: &Step, log: &Logger) -> Result<(), failure::Error> { info!(&log, "Copying license from crate..."); - license::copy_from_crate(&self.crate_path, &self.out_dir, step)?; + license::copy_from_crate(&self.crate_data, &self.crate_path, &self.out_dir, step)?; info!(&log, "Copied license from crate to {:#?}.", &self.out_dir); Ok(()) } diff --git a/src/lib.rs b/src/lib.rs index bebdb2a..03cd436 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,8 +9,8 @@ extern crate dirs; #[macro_use] extern crate failure; extern crate flate2; -extern crate hex; extern crate glob; +extern crate hex; extern crate indicatif; #[macro_use] extern crate lazy_static; @@ -37,7 +37,6 @@ pub mod build; pub mod child; pub mod command; pub mod emoji; -pub mod error; pub mod license; pub mod lockfile; pub mod logger; diff --git a/src/license.rs b/src/license.rs index 44391e7..0b91e78 100644 --- a/src/license.rs +++ b/src/license.rs @@ -6,17 +6,10 @@ use std::path::Path; use emoji; use glob::glob; -use manifest; +use manifest::CrateData; use progressbar::Step; use PBAR; -fn get_license(path: &Path) -> Option { - match manifest::get_crate_license(path) { - Ok(license) => license, - Err(_) => None, - } -} - fn glob_license_files(path: &Path) -> Result, failure::Error> { let mut license_files: Vec = Vec::new(); for entry in glob(path.join("LICENSE*").to_str().unwrap())? { @@ -33,7 +26,12 @@ fn glob_license_files(path: &Path) -> Result, failure::Error> { } /// Copy the crate's license into the `pkg` directory. -pub fn copy_from_crate(path: &Path, out_dir: &Path, step: &Step) -> Result<(), failure::Error> { +pub fn copy_from_crate( + crate_data: &CrateData, + path: &Path, + out_dir: &Path, + step: &Step, +) -> Result<(), failure::Error> { assert!( fs::metadata(path).ok().map_or(false, |m| m.is_dir()), "crate directory should exist" @@ -44,7 +42,7 @@ pub fn copy_from_crate(path: &Path, out_dir: &Path, step: &Step) -> Result<(), f "crate's pkg directory should exist" ); - match get_license(path) { + match crate_data.crate_license() { Some(_) => { let msg = format!("{}Copying over your LICENSE...", emoji::DANCERS); PBAR.step(step, &msg); diff --git a/src/manifest/mod.rs b/src/manifest/mod.rs index 8c3e390..0be6c28 100644 --- a/src/manifest/mod.rs +++ b/src/manifest/mod.rs @@ -289,6 +289,11 @@ impl CrateData { } } + /// Get the license for the crate at the given path. + pub fn crate_license(&self) -> &Option { + &self.manifest.package.license + } + /// Returns the path to this project's target directory where artifacts are /// located after a cargo build. pub fn target_directory(&self) -> &Path { diff --git a/tests/all/license.rs b/tests/all/license.rs index 376bd4d..ac7d377 100644 --- a/tests/all/license.rs +++ b/tests/all/license.rs @@ -5,15 +5,17 @@ use std::fs; use utils::{self, fixture}; use wasm_pack::license; +use wasm_pack::manifest::CrateData; #[test] fn it_copies_a_license_default_path() { let fixture = fixture::single_license(); let out_dir = fixture.path.join("pkg"); fs::create_dir(&out_dir).expect("should create pkg directory OK"); + let crate_data = CrateData::new(&fixture.path); let step = wasm_pack::progressbar::Step::new(1); - assert!(license::copy_from_crate(&fixture.path, &out_dir, &step).is_ok()); + assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir, &step).is_ok()); let crate_license_path = fixture.path.join("LICENSE-WTFPL"); let pkg_license_path = out_dir.join("LICENSE-WTFPL"); @@ -36,9 +38,10 @@ fn it_copies_a_license_provied_path() { let fixture = fixture::single_license(); let out_dir = fixture.path.join("pkg"); fs::create_dir(&out_dir).expect("should create pkg directory OK"); + let crate_data = CrateData::new(&fixture.path); let step = wasm_pack::progressbar::Step::new(1); - assert!(license::copy_from_crate(&fixture.path, &out_dir, &step).is_ok()); + assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir, &step).is_ok()); let crate_license_path = fixture.path.join("LICENSE-WTFPL"); let pkg_license_path = out_dir.join("LICENSE-WTFPL"); println!( @@ -59,9 +62,10 @@ fn it_copies_all_licenses_default_path() { let fixture = fixture::dual_license(); let out_dir = fixture.path.join("pkg"); fs::create_dir(&out_dir).expect("should create pkg directory OK"); + let crate_data = CrateData::new(&fixture.path); let step = wasm_pack::progressbar::Step::new(1); - assert!(license::copy_from_crate(&fixture.path, &out_dir, &step).is_ok()); + assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir, &step).is_ok()); let crate_license_path = fixture.path.join("LICENSE-WTFPL"); let pkg_license_path = out_dir.join("LICENSE-WTFPL"); @@ -94,9 +98,10 @@ fn it_copies_all_licenses_provided_path() { let fixture = fixture::dual_license(); let out_dir = fixture.path.join("pkg"); fs::create_dir(&out_dir).expect("should create pkg directory OK"); + let crate_data = CrateData::new(&fixture.path); let step = wasm_pack::progressbar::Step::new(1); - assert!(license::copy_from_crate(&fixture.path, &out_dir, &step).is_ok()); + assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir, &step).is_ok()); let crate_license_path = fixture.path.join("LICENSE-WTFPL"); let pkg_license_path = out_dir.join("LICENSE-WTFPL"); From b567fc0f8894b45c156e066d7411f791cb447796 Mon Sep 17 00:00:00 2001 From: Sam Rijs Date: Mon, 19 Nov 2018 08:41:07 +1100 Subject: [PATCH 045/106] update zip to 0.5.0 --- Cargo.lock | 40 +++++++++++++++++++++++++--------------- Cargo.toml | 2 +- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2279393..3bb6ba8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -203,6 +203,14 @@ dependencies = [ "build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "crc32fast" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "curl" version = "0.4.19" @@ -397,6 +405,16 @@ name = "libc" version = "0.2.43" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "libflate" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "libz-sys" version = "1.0.25" @@ -455,15 +473,6 @@ dependencies = [ "miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "msdos_time" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "nodrop" version = "0.1.12" @@ -1066,7 +1075,7 @@ dependencies = [ "tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "which 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "zip 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "zip 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1125,12 +1134,12 @@ dependencies = [ [[package]] name = "zip" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bzip2 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "msdos_time 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crc32fast 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libflate 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1160,6 +1169,7 @@ dependencies = [ "checksum console 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd48adf136733979b49e15bc3b4c43cc0d3c85ece7bd08e6daa414c6fcb13e6" "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" "checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" +"checksum crc32fast 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a8795e4883c14e32604fe28607ae96c921f3377d2a80c46f06a9e6e734c364f4" "checksum curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "c7c9d851c825e0c033979d4516c9173bc19a78a96eb4d6ae51d4045440eafa16" "checksum curl-sys 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)" = "721c204978be2143fab0a84b708c49d79d1f6100b8785610f456043a90708870" "checksum dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "88972de891f6118092b643d85a0b28e0678e0f948d7f879aa32f2d5aafe97d2a" @@ -1182,13 +1192,13 @@ dependencies = [ "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" "checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" +"checksum libflate 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "21138fc6669f438ed7ae3559d5789a5f0ba32f28c1f0608d1e452b0bb06ee936" "checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" "checksum lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "775751a3e69bde4df9b38dd00a1b5d6ac13791e4223d4a0506577f0dd27cfb7a" "checksum memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0a3eb002f0535929f1199681417029ebea04aadc0c7a4224b46be99c7f5d6a16" "checksum miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649" "checksum miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad30a47319c16cde58d0314f5d98202a80c9083b5f61178457403dfb14e509c" "checksum miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28edaef377517fd9fe3e085c37d892ce7acd1fbeab9239c5a36eec352d8a8b7e" -"checksum msdos_time 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aad9dfe950c057b1bfe9c1f2aa51583a8468ef2a5baba2ebbe06d775efeb7729" "checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" "checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" @@ -1270,4 +1280,4 @@ dependencies = [ "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum wincolor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eeb06499a3a4d44302791052df005d5232b927ed1a9658146d842165c4de7767" "checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" -"checksum zip 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "36b9e08fb518a65cf7e08a1e482573eb87a2f4f8c6619316612a3c1f162fe822" +"checksum zip 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "00acf1fafb786ff450b6726e5be41ef029142597b47a40ce80f952f1471730a0" diff --git a/Cargo.toml b/Cargo.toml index b486071..2869362 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ structopt = "0.2" tar = "0.4.16" toml = "0.4" which = "2.0.0" -zip = "0.4.2" +zip = "0.5.0" [dev-dependencies] tempfile = "3" From d788b805831416251ab0043f40aa1309bebe6091 Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Thu, 29 Nov 2018 17:04:11 +0000 Subject: [PATCH 046/106] Generate self-.gitignore as part of pkg folder --- src/command/utils.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/command/utils.rs b/src/command/utils.rs index fee4d4f..5927982 100644 --- a/src/command/utils.rs +++ b/src/command/utils.rs @@ -18,6 +18,7 @@ pub fn create_pkg_dir(out_dir: &Path, step: &Step) -> Result<(), failure::Error> let msg = format!("{}Creating a pkg directory...", emoji::FOLDER); PBAR.step(step, &msg); fs::create_dir_all(&out_dir)?; + fs::write(out_dir.join(".gitignore"), "*")?; Ok(()) } From 87b4c5c7b1655f8032a7cb5de7a0426d1895b850 Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Thu, 29 Nov 2018 17:09:44 +0000 Subject: [PATCH 047/106] Add rust-toolchain file set to nightly This allows new contributors to avoid manually running `rustup override set nightly`. --- .github/PULL_REQUEST_TEMPLATE.md | 6 ++---- rust-toolchain | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) create mode 100644 rust-toolchain diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index e07bd50..43c3cb7 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,12 +1,10 @@ Make sure these boxes are checked! 📦✅ -- [ ] You have the latest version of `rustfmt` installed and have your - cloned directory set to nightly +- [ ] You have the latest version of `rustfmt` installed ```bash -$ rustup override set nightly $ rustup component add rustfmt-preview --toolchain nightly ``` -- [ ] You ran `rustfmt` on the code base before submitting +- [ ] You ran `cargo fmt` on the code base before submitting - [ ] You reference which issue is being closed in the PR text ✨✨ 😄 Thanks so much for contributing to wasm-pack! 😄 ✨✨ diff --git a/rust-toolchain b/rust-toolchain new file mode 100644 index 0000000..bf867e0 --- /dev/null +++ b/rust-toolchain @@ -0,0 +1 @@ +nightly From 2b30ca8e13365494b339151969bd08e548285f31 Mon Sep 17 00:00:00 2001 From: Selwyn Date: Fri, 21 Dec 2018 15:57:23 +0100 Subject: [PATCH 048/106] Fix link to manual setup instructions from getting started --- docs/src/tutorial/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/tutorial/getting-started.md b/docs/src/tutorial/getting-started.md index 8eee61f..a011e99 100644 --- a/docs/src/tutorial/getting-started.md +++ b/docs/src/tutorial/getting-started.md @@ -25,4 +25,4 @@ further in this guide. ⚠️ If you'd rather not use a template, or are having trouble with the template, you can do a manual setup by following [these instructions]. -[these instructions]: ../project-setup/manual-setup/index.html +[these instructions]: ../project-setup/manual-setup.html From d5a7a7beb1473237fb79a48f5fcd26dd2b985bf8 Mon Sep 17 00:00:00 2001 From: csmoe Date: Sun, 11 Nov 2018 12:08:07 +0800 Subject: [PATCH 049/106] pre-build before wasm-pack publish --- src/command/build.rs | 19 +++++++++++++++++-- src/command/publish/mod.rs | 30 +++++++++++++++++++++++------- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/src/command/build.rs b/src/command/build.rs index c495cdc..8f947da 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -102,12 +102,12 @@ pub struct BuildOptions { #[structopt(long = "debug")] /// Deprecated. Renamed to `--dev`. - debug: bool, + pub debug: bool, #[structopt(long = "dev")] /// Create a development build. Enable debug info, and disable /// optimizations. - dev: bool, + pub dev: bool, #[structopt(long = "release")] /// Create a release build. Enable optimizations and disable debug info. @@ -122,6 +122,21 @@ pub struct BuildOptions { pub out_dir: String, } +impl Default for BuildOptions { + fn default() -> Self { + Self { + path: None, + scope: None, + mode: BuildMode::Normal, + disable_dts: false, + target: String::from("browser"), + debug: false, + dev: false, + out_dir: String::from("pkg"), + } + } +} + type BuildStep = fn(&mut Build, &Step, &Logger) -> Result<(), Error>; impl Build { diff --git a/src/command/publish/mod.rs b/src/command/publish/mod.rs index 8b2c564..6e7ee1e 100644 --- a/src/command/publish/mod.rs +++ b/src/command/publish/mod.rs @@ -2,6 +2,7 @@ pub mod access; use self::access::Access; +use command::build::{Build, BuildOptions}; use command::utils::{find_pkg_directory, set_crate_path}; use failure::Error; use npm; @@ -21,14 +22,29 @@ pub fn publish( info!(&log, "Publishing the npm package..."); info!(&log, "npm info located in the npm debug log"); - let pkg_directory = find_pkg_directory(&crate_path).ok_or_else(|| { - format_err!( - "Unable to find the pkg directory at path '{:#?}', or in a child directory of '{:#?}'", - &crate_path, - &crate_path - ) - })?; + let pkg_directory = match find_pkg_directory(&crate_path) { + Some(path) => Ok(path), + None => { + // while `wasm-pack publish`, if the pkg directory cannot be found, + // then try to `wasm-pack build` + let build_opts = BuildOptions { + path: Some(crate_path.clone()), + ..Default::default() + }; + Build::try_from_opts(build_opts) + .and_then(|mut build| build.run(&log)) + .map(|()| crate_path.join("pkg")) + .map_err(|_| { + format_err!( + "Unable to find the pkg directory at path '{:#?}',\ + or in a child directory of '{:#?}'", + &crate_path, + &crate_path + ) + }) + } + }?; npm::npm_publish(log, &pkg_directory.to_string_lossy(), access)?; info!(&log, "Published your package!"); From ddd93481c3820974a5a4c5fac02421f6e1350e82 Mon Sep 17 00:00:00 2001 From: csmoe Date: Wed, 26 Dec 2018 21:44:50 +0800 Subject: [PATCH 050/106] prebuild in interactive way --- Cargo.lock | 52 +++++++++++++++++++++++++++++++++++ Cargo.toml | 1 + src/command/publish/mod.rs | 56 ++++++++++++++++++++++++++++---------- src/lib.rs | 1 + 4 files changed, 95 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9e17765..4a82aa9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -240,6 +240,16 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "dialoguer" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "console 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "dirs" version = "1.0.4" @@ -597,6 +607,16 @@ dependencies = [ "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand" +version = "0.3.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand" version = "0.4.3" @@ -920,6 +940,18 @@ dependencies = [ "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tempfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "tempfile" version = "3.0.4" @@ -1072,6 +1104,7 @@ dependencies = [ "cargo_metadata 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "console 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", + "dialoguer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1190,9 +1223,18 @@ dependencies = [ "checksum console 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd48adf136733979b49e15bc3b4c43cc0d3c85ece7bd08e6daa414c6fcb13e6" "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" "checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" +<<<<<<< HEAD "checksum crc32fast 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a8795e4883c14e32604fe28607ae96c921f3377d2a80c46f06a9e6e734c364f4" "checksum curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "c7c9d851c825e0c033979d4516c9173bc19a78a96eb4d6ae51d4045440eafa16" "checksum curl-sys 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)" = "721c204978be2143fab0a84b708c49d79d1f6100b8785610f456043a90708870" +||||||| merged common ancestors +"checksum curl 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)" = "a9e5285b49b44401518c947d3b808d14d99a538a6c9ffb3ec0205c11f9fc4389" +"checksum curl-sys 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "08459503c415173da1ce6b41036a37b8bfdd86af46d45abb9964d4c61fe670ef" +======= +"checksum curl 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)" = "a9e5285b49b44401518c947d3b808d14d99a538a6c9ffb3ec0205c11f9fc4389" +"checksum curl-sys 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "08459503c415173da1ce6b41036a37b8bfdd86af46d45abb9964d4c61fe670ef" +"checksum dialoguer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1ad1c29a0368928e78c551354dbff79f103a962ad820519724ef0d74f1c62fa9" +>>>>>>> prebuild in interactive way "checksum dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "88972de891f6118092b643d85a0b28e0678e0f948d7f879aa32f2d5aafe97d2a" "checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" "checksum failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6dd377bcc1b1b7ce911967e3ec24fa19c3224394ec05b54aa7b083d498341ac7" @@ -1234,8 +1276,17 @@ dependencies = [ "checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c" "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" "checksum podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "780fb4b6698bbf9cf2444ea5d22411cef2953f0824b98f33cf454ec5615645bd" +<<<<<<< HEAD "checksum proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)" = "ab2fc21ba78ac73e4ff6b3818ece00be4e175ffbef4d0a717d978b48b24150c4" "checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" +||||||| merged common ancestors +"checksum proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "3d7b7eaaa90b4a90a932a9ea6666c95a389e424eff347f0f793979289429feee" +"checksum quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "63b5829244f52738cfee93b3a165c1911388675be000c888d2fae620dee8fa5b" +======= +"checksum proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "3d7b7eaaa90b4a90a932a9ea6666c95a389e424eff347f0f793979289429feee" +"checksum quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "63b5829244f52738cfee93b3a165c1911388675be000c888d2fae620dee8fa5b" +"checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1" +>>>>>>> prebuild in interactive way "checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" "checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" "checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372" @@ -1276,6 +1327,7 @@ dependencies = [ "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" "checksum tar 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)" = "89b518542272d9c12195e72885c7a4c142b89226f681bb129e4a922ba1b1ee74" "checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" +"checksum tempfile 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "11ce2fe9db64b842314052e2421ac61a73ce41b898dc8e3750398b219c5fc1e0" "checksum tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "55c1195ef8513f3273d55ff59fe5da6940287a0d7a98331254397f464833675b" "checksum term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5e6b677dd1e8214ea1ef4297f85dbcbed8e8cdddb561040cc998ca2551c37561" "checksum termcolor 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "adc4587ead41bf016f11af03e55a624c06568b5a19db4e90fde573d805074f83" diff --git a/Cargo.toml b/Cargo.toml index 70fb1f6..02cfdd5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ atty = "0.2.11" cargo_metadata = "0.6.0" console = "0.6.1" curl = "0.4.13" +dialoguer = "0.3.0" dirs = "1.0.4" failure = "0.1.2" flate2 = "1.0.2" diff --git a/src/command/publish/mod.rs b/src/command/publish/mod.rs index 6e7ee1e..ddcbea2 100644 --- a/src/command/publish/mod.rs +++ b/src/command/publish/mod.rs @@ -4,6 +4,7 @@ pub mod access; use self::access::Access; use command::build::{Build, BuildOptions}; use command::utils::{find_pkg_directory, set_crate_path}; +use dialoguer::{Confirmation, Input}; use failure::Error; use npm; use slog::Logger; @@ -28,21 +29,46 @@ pub fn publish( None => { // while `wasm-pack publish`, if the pkg directory cannot be found, // then try to `wasm-pack build` - let build_opts = BuildOptions { - path: Some(crate_path.clone()), - ..Default::default() - }; - Build::try_from_opts(build_opts) - .and_then(|mut build| build.run(&log)) - .map(|()| crate_path.join("pkg")) - .map_err(|_| { - format_err!( - "Unable to find the pkg directory at path '{:#?}',\ - or in a child directory of '{:#?}'", - &crate_path, - &crate_path - ) - }) + if Confirmation::new() + .with_text("Your npm package hasn't be built, build it?") + .interact()? + { + let out_dir = Input::new() + .with_prompt("out_dir") + .default("pkg".to_string()) + .show_default(true) + .interact()?; + let target = Input::new() + .with_prompt("target") + .default("browser".to_string()) + .show_default(true) + .interact()? + .to_string(); + let build_opts = BuildOptions { + path: Some(crate_path.clone()), + target, + out_dir: out_dir.clone(), + ..Default::default() + }; + Build::try_from_opts(build_opts) + .and_then(|mut build| build.run(&log)) + .map(|()| crate_path.join(out_dir)) + .map_err(|_| { + format_err!( + "Unable to find the pkg directory at path '{:#?}',\ + or in a child directory of '{:#?}'", + &crate_path, + &crate_path + ) + }) + } else { + bail!( + "Unable to find the pkg directory at path '{:#?}',\ + or in a child directory of '{:#?}'", + &crate_path, + &crate_path + ) + } } }?; npm::npm_publish(log, &pkg_directory.to_string_lossy(), access)?; diff --git a/src/lib.rs b/src/lib.rs index 8dc7bfb..eb06959 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,6 +5,7 @@ extern crate cargo_metadata; extern crate console; extern crate curl; +extern crate dialoguer; extern crate dirs; extern crate strsim; #[macro_use] From 95268cdaf42cd80dc248576b18a43348aba80b65 Mon Sep 17 00:00:00 2001 From: csmoe Date: Wed, 26 Dec 2018 21:50:59 +0800 Subject: [PATCH 051/106] add target arg to publish --- Cargo.lock | 541 ++++++++++++++++++++++--------------- src/command/build.rs | 10 +- src/command/mod.rs | 12 +- src/command/publish/mod.rs | 3 +- src/logger.rs | 6 +- 5 files changed, 352 insertions(+), 220 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4a82aa9..201a14e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,7 +8,7 @@ name = "aho-corasick" version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -30,10 +30,10 @@ dependencies = [ [[package]] name = "arrayvec" -version = "0.4.7" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -41,30 +41,36 @@ name = "atty" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "autocfg" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "backtrace" -version = "0.3.9" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "backtrace-sys" -version = "0.1.24" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -77,7 +83,7 @@ name = "blake2-rfc" version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -96,34 +102,34 @@ name = "bzip2" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bzip2-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "bzip2-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bzip2-sys" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cargo_metadata" -version = "0.6.1" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cc" -version = "1.0.25" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -138,7 +144,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -162,7 +168,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "clicolors-control" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -182,9 +199,26 @@ dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "clicolors-control 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "console" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "clicolors-control 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -205,10 +239,10 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.0.3" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -218,9 +252,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "curl-sys 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", "schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", "socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -231,10 +265,10 @@ name = "curl-sys" version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -245,8 +279,8 @@ name = "dialoguer" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "console 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "console 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -255,17 +289,22 @@ name = "dirs" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "redox_users 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "encode_unicode" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "error-chain" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -273,7 +312,7 @@ name = "failure" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -282,28 +321,29 @@ name = "failure_derive" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.18 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "filetime" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "flate2" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -342,7 +382,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "heck" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -358,14 +398,14 @@ name = "human-panic" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "os_type 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -374,9 +414,9 @@ name = "indicatif" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "console 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "console 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -386,8 +426,8 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -417,17 +457,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.43" +version = "0.2.45" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libflate" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -435,28 +475,28 @@ name = "libz-sys" version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "lock_api" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "memchr" -version = "2.1.1" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -465,8 +505,8 @@ name = "miniz-sys" version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -482,15 +522,15 @@ name = "miniz_oxide_c_api" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "nodrop" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -508,15 +548,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "openssl" -version = "0.10.15" +version = "0.10.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -526,20 +566,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "openssl-src" -version = "111.0.1+1.1.1" +version = "111.1.0+1.1.1a" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "openssl-sys" -version = "0.9.39" +version = "0.9.40" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-src 111.0.1+1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-src 111.1.0+1.1.1a (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -549,12 +589,12 @@ name = "os_type" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "owning_ref" -version = "0.3.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -565,19 +605,40 @@ name = "parking_lot" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parking_lot" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "parking_lot_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot_core" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -593,7 +654,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "proc-macro2" -version = "0.4.21" +version = "0.4.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -604,7 +665,7 @@ name = "quote" version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -613,7 +674,7 @@ version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -623,7 +684,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -634,11 +695,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_chacha" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_core" version = "0.2.2" @@ -652,9 +740,42 @@ name = "rand_core" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rand_hc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_isaac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_pcg" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_xorshift" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "redox_syscall" -version = "0.1.40" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -662,7 +783,7 @@ name = "redox_termios" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -673,7 +794,7 @@ dependencies = [ "argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -682,7 +803,7 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -690,12 +811,12 @@ dependencies = [ [[package]] name = "regex" -version = "1.0.6" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -705,15 +826,15 @@ name = "regex-syntax" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ucd-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ucd-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -726,7 +847,7 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.9" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -739,7 +860,7 @@ dependencies = [ [[package]] name = "ryu" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -767,7 +888,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -777,17 +898,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.80" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde_derive" -version = "1.0.80" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.18 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -795,17 +916,17 @@ name = "serde_ignored" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "1.0.32" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -842,7 +963,7 @@ dependencies = [ [[package]] name = "smallvec" -version = "0.6.5" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -854,8 +975,8 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -876,30 +997,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "structopt" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt-derive 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt-derive 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "structopt-derive" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)", + "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.18 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "syn" -version = "0.15.18" +version = "0.15.23" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -909,9 +1030,9 @@ name = "synstructure" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.18 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -922,12 +1043,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "tar" -version = "0.4.18" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "filetime 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -946,21 +1067,21 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tempfile" -version = "3.0.4" +version = "3.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -987,8 +1108,8 @@ name = "termion" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -997,7 +1118,7 @@ name = "termios" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1018,25 +1139,25 @@ dependencies = [ [[package]] name = "time" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "toml" -version = "0.4.8" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ucd-util" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1101,44 +1222,44 @@ name = "wasm-pack" version = "0.5.1" dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "cargo_metadata 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cargo_metadata 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "console 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", "dialoguer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "human-panic 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "indicatif 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", "serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-term 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", - "tar 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "which 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "tar 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "zip 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "which" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1183,7 +1304,7 @@ name = "xattr" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1192,10 +1313,10 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bzip2 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "crc32fast 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libflate 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libflate 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", "podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", ] [metadata] @@ -1203,50 +1324,46 @@ dependencies = [ "checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392" -"checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef" +"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" -"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" -"checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0" +"checksum autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4e5f34df7a019573fb8bdc7e24a2bfebe51a2a1d6bfdbaeccedb3c41fc574727" +"checksum backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b5b493b66e03090ebc4343eb02f94ff944e0cbc9ac6571491d170ba026741eb5" +"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" "checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" "checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39" "checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" "checksum bzip2 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "42b7c3cbf0fa9c1b82308d57191728ca0256cb821220f4e2fd410a72ade26e3b" -"checksum bzip2-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2c5162604199bbb17690ede847eaa6120a3f33d5ab4dcc8e7c25b16d849ae79b" -"checksum cargo_metadata 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1aaa1a9856ae2d188340526d0986feb6899c9ad11c5dfd73453c784fed6e373d" -"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16" +"checksum bzip2-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6584aa36f5ad4c9247f5323b0a42f37802b37a836f0ad87084d7a33961abe25f" +"checksum cargo_metadata 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e5d1b4d380e1bab994591a24c2bdd1b054f64b60bef483a8c598c7c345bc3bbe" +"checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" "checksum clicolors-control 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1f84dec9bc083ce2503908cd305af98bd363da6f54bf8d4bf0ac14ee749ad5d1" +"checksum clicolors-control 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "73abfd4c73d003a674ce5d2933fca6ce6c42480ea84a5ffe0a2dc39ed56300f9" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum console 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd48adf136733979b49e15bc3b4c43cc0d3c85ece7bd08e6daa414c6fcb13e6" +"checksum console 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4ceeb6d030ed175896450ad583a39e67a77b8b2ab8802c2aae594112adc783a2" "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" "checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" -<<<<<<< HEAD -"checksum crc32fast 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a8795e4883c14e32604fe28607ae96c921f3377d2a80c46f06a9e6e734c364f4" +"checksum crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e91d5240c6975ef33aeb5f148f35275c25eda8e8a5f95abe421978b05b8bf192" "checksum curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "c7c9d851c825e0c033979d4516c9173bc19a78a96eb4d6ae51d4045440eafa16" "checksum curl-sys 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)" = "721c204978be2143fab0a84b708c49d79d1f6100b8785610f456043a90708870" -||||||| merged common ancestors -"checksum curl 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)" = "a9e5285b49b44401518c947d3b808d14d99a538a6c9ffb3ec0205c11f9fc4389" -"checksum curl-sys 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "08459503c415173da1ce6b41036a37b8bfdd86af46d45abb9964d4c61fe670ef" -======= -"checksum curl 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)" = "a9e5285b49b44401518c947d3b808d14d99a538a6c9ffb3ec0205c11f9fc4389" -"checksum curl-sys 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "08459503c415173da1ce6b41036a37b8bfdd86af46d45abb9964d4c61fe670ef" "checksum dialoguer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1ad1c29a0368928e78c551354dbff79f103a962ad820519724ef0d74f1c62fa9" ->>>>>>> prebuild in interactive way "checksum dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "88972de891f6118092b643d85a0b28e0678e0f948d7f879aa32f2d5aafe97d2a" +"checksum encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "90b2c9496c001e8cb61827acdefad780795c42264c137744cae6f7d9e3450abd" "checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" "checksum failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6dd377bcc1b1b7ce911967e3ec24fa19c3224394ec05b54aa7b083d498341ac7" "checksum failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "64c2d913fe8ed3b6c6518eedf4538255b989945c14c2a7d5cbff62a5e2120596" -"checksum filetime 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6f57e64bf5eae62efd4efed005ae81a7115012a61f522bba54542e1a556af921" -"checksum flate2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3b0c7353385f92079524de3b7116cf99d73947c08a7472774e9b3b04bff3b901" +"checksum filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a2df5c1a8c4be27e7707789dc42ae65976e60b394afd293d1419ab915833e646" +"checksum flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2291c165c8e703ee54ef3055ad6188e3d51108e2ded18e9f2476e774fc5ad3d4" "checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" "checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" -"checksum heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea04fa3ead4e05e51a7c806fc07271fdbde4e246a6c6d1efd52e72230b771b82" +"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" "checksum human-panic 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "21638c5955a6daf3ecc42cae702335fc37a72a4abcc6959ce457b31a7d43bbdd" "checksum indicatif 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a29b2fa6f00010c268bface64c18bb0310aaa70d46a195d5382d288c477fb016" @@ -1255,89 +1372,89 @@ dependencies = [ "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" -"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" -"checksum libflate 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "21138fc6669f438ed7ae3559d5789a5f0ba32f28c1f0608d1e452b0bb06ee936" +"checksum libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "2d2857ec59fadc0773853c664d2d18e7198e83883e7060b63c924cb077bd5c74" +"checksum libflate 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)" = "bff3ac7d6f23730d3b533c35ed75eef638167634476a499feef16c428d74b57b" "checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" -"checksum lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "775751a3e69bde4df9b38dd00a1b5d6ac13791e4223d4a0506577f0dd27cfb7a" -"checksum memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0a3eb002f0535929f1199681417029ebea04aadc0c7a4224b46be99c7f5d6a16" +"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" +"checksum memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "db4c41318937f6e76648f42826b1d9ade5c09cafb5aef7e351240a70f39206e9" "checksum miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649" "checksum miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad30a47319c16cde58d0314f5d98202a80c9083b5f61178457403dfb14e509c" "checksum miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28edaef377517fd9fe3e085c37d892ce7acd1fbeab9239c5a36eec352d8a8b7e" -"checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" +"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" "checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" -"checksum openssl 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)" = "5e1309181cdcbdb51bc3b6bedb33dfac2a83b3d585033d3f6d9e22e8c1928613" +"checksum openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ec7bd7ca4cce6dbdc77e7c1230682740d307d1218a87fb0349a571272be749f9" "checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" -"checksum openssl-src 111.0.1+1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d1edaed888fd85a54a2646bf02992931ddefdda3b1a748fc79f088a8db27fcbe" -"checksum openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)" = "278c1ad40a89aa1e741a1eed089a2f60b18fab8089c3139b542140fc7d674106" +"checksum openssl-src 111.1.0+1.1.1a (registry+https://github.com/rust-lang/crates.io-index)" = "26bb632127731bf4ac49bf86a5dde12d2ca0918c2234fc39d79d4da2ccbc6da7" +"checksum openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)" = "1bb974e77de925ef426b6bc82fce15fd45bdcbeb5728bffcfc7cdeeb7ce1c2d6" "checksum os_type 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7edc011af0ae98b7f88cf7e4a83b70a54a75d2b8cb013d6efd02e5956207e9eb" -"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" +"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" "checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" +"checksum parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9723236a9525c757d9725b993511e3fc941e33f27751942232f0058298297edf" "checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c" +"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" "checksum podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "780fb4b6698bbf9cf2444ea5d22411cef2953f0824b98f33cf454ec5615645bd" -<<<<<<< HEAD -"checksum proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)" = "ab2fc21ba78ac73e4ff6b3818ece00be4e175ffbef4d0a717d978b48b24150c4" +"checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" "checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" -||||||| merged common ancestors -"checksum proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "3d7b7eaaa90b4a90a932a9ea6666c95a389e424eff347f0f793979289429feee" -"checksum quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "63b5829244f52738cfee93b3a165c1911388675be000c888d2fae620dee8fa5b" -======= -"checksum proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "3d7b7eaaa90b4a90a932a9ea6666c95a389e424eff347f0f793979289429feee" -"checksum quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "63b5829244f52738cfee93b3a165c1911388675be000c888d2fae620dee8fa5b" "checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1" ->>>>>>> prebuild in interactive way "checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" "checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" +"checksum rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae9d223d52ae411a33cf7e54ec6034ec165df296ccd23533d671a28252b6f66a" +"checksum rand_chacha 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "771b009e3a508cb67e8823dda454aaa5368c7bc1c16829fb77d3e980440dd34a" "checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372" "checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db" -"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" +"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" +"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" +"checksum rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "086bd09a33c7044e56bb44d5bdde5a60e7f119a9e95b0775f545de759a32fe05" +"checksum rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "effa3fcaa47e18db002bdde6060944b6d2f9cfd8db471c30e873448ad9187be3" +"checksum redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "a84bcd297b87a545980a2d25a0beb72a1f490c31f0a9fde52fca35bfbb1ceb70" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum redox_users 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "214a97e49be64fd2c86f568dd0cb2c757d2cc53de95b273b6ad0a1c908482f26" "checksum regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384" -"checksum regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ee84f70c8c08744ea9641a731c7fadb475bf2ecc52d7f627feb833e0b3990467" +"checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" "checksum regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7" -"checksum regex-syntax 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fbc557aac2b708fe84121caf261346cc2eed71978024337e42eb46b8a252ac6e" +"checksum regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4e47a2ed29da7a9e1960e1639e7a982e6edc6d49be308a3b02daf511504a16d1" "checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" -"checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" +"checksum rustc-demangle 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "01b90379b8664dd83460d59bdc5dd1fd3172b8913788db483ed1325171eab2f7" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7153dd96dade874ab973e098cb62fcdbb89a03682e46b144fd09550998d4a4a7" +"checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" "checksum schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "0e1a231dc10abf6749cfa5d7767f25888d484201accbd919b66ab5413c502d56" "checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "15c141fc7027dd265a47c090bf864cf62b42c4d228bbcf4e51a0c9e2b0d3f7ef" -"checksum serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "225de307c6302bec3898c51ca302fc94a7a1697ef0845fcee6448f33c032249c" +"checksum serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)" = "6fa52f19aee12441d5ad11c9a00459122bd8f98707cadf9778c540674f1935b6" +"checksum serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)" = "96a7f9496ac65a2db5929afa087b54f8fc5008dcfbe48a8874ed20049b0d6154" "checksum serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "190e9765dcedb56be63b6e0993a006c7e3b071a016a304736e4a315dc01fb142" -"checksum serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)" = "43344e7ce05d0d8280c5940cabb4964bea626aa58b1ec0e8c73fa2a8512a38ce" +"checksum serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "c37ccd6be3ed1fdf419ee848f7c758eb31b054d7cd3ae3600e3bae0adf569811" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" "checksum slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e1a2eec401952cd7b12a84ea120e2d57281329940c3f93c2bf04f462539508e" "checksum slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e544d16c6b230d84c866662fe55e31aacfca6ae71e6fc49ae9a311cb379bfc2f" "checksum slog-term 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5951a808c40f419922ee014c15b6ae1cd34d963538b57d8a4778b9ca3fff1e0b" -"checksum smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "153ffa32fd170e9944f7e0838edf824a754ec4c1fc64746fcc9fe1f8fa602e5d" +"checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db" "checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum structopt 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "41c4a2479a078509940d82773d90ff824a8c89533ab3b59cd3ce8b0c0e369c02" -"checksum structopt-derive 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "5352090cfae7a2c85e1a31146268b53396106c88ca5d6ccee2e3fae83b6e35c2" -"checksum syn 0.15.18 (registry+https://github.com/rust-lang/crates.io-index)" = "90c39a061e2f412a9f869540471ab679e85e50c6b05604daf28bc3060f75c430" +"checksum structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "670ad348dc73012fcf78c71f06f9d942232cdd4c859d4b6975e27836c3efc0c3" +"checksum structopt-derive 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "ef98172b1a00b0bec738508d3726540edcbd186d50dfd326f2b1febbb3559f04" +"checksum syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9545a6a093a3f0bd59adb472700acc08cad3776f860f16a897dfce8c88721cbc" "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" -"checksum tar 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)" = "89b518542272d9c12195e72885c7a4c142b89226f681bb129e4a922ba1b1ee74" +"checksum tar 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "a303ba60a099fcd2aaa646b14d2724591a96a75283e4b7ed3d1a1658909d9ae2" "checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" "checksum tempfile 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "11ce2fe9db64b842314052e2421ac61a73ce41b898dc8e3750398b219c5fc1e0" -"checksum tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "55c1195ef8513f3273d55ff59fe5da6940287a0d7a98331254397f464833675b" +"checksum tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7e91405c14320e5c79b3d148e1c86f40749a36e490642202a31689cb1a3452b2" "checksum term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5e6b677dd1e8214ea1ef4297f85dbcbed8e8cdddb561040cc998ca2551c37561" "checksum termcolor 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "adc4587ead41bf016f11af03e55a624c06568b5a19db4e90fde573d805074f83" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" "checksum termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72b620c5ea021d75a735c943269bb07d30c9b77d6ac6b236bc8b5c496ef05625" "checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" -"checksum time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "d825be0eb33fda1a7e68012d51e9c7f451dc1a69391e7fdc197060bb8c56667b" -"checksum toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4a2ecc31b0351ea18b3fe11274b8db6e4d82bce861bbb22e6dbed40417902c65" -"checksum ucd-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d0f8bfa9ff0cadcd210129ad9d2c5f145c13e9ced3d3e5d948a6213487d52444" +"checksum time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "847da467bf0db05882a9e2375934a8a55cffdc9db0d128af1518200260ba1f6c" +"checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" +"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" "checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" @@ -1348,7 +1465,7 @@ dependencies = [ "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum which 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49c4f580e93079b70ac522e7bdebbe1568c8afa7d8d05ee534ee737ca37d2f51" +"checksum which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b57acb10231b9493c8472b20cb57317d0679a49e0bdbee44b3b803a6473af164" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" diff --git a/src/command/build.rs b/src/command/build.rs index 8f947da..98fb62f 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -111,11 +111,11 @@ pub struct BuildOptions { #[structopt(long = "release")] /// Create a release build. Enable optimizations and disable debug info. - release: bool, + pub release: bool, #[structopt(long = "profiling")] /// Create a profiling build. Enable optimizations and debug info. - profiling: bool, + pub profiling: bool, #[structopt(long = "out-dir", short = "d", default_value = "pkg")] /// Sets the output directory with a relative path. @@ -129,10 +129,12 @@ impl Default for BuildOptions { scope: None, mode: BuildMode::Normal, disable_dts: false, - target: String::from("browser"), + target: String::new(), debug: false, dev: false, - out_dir: String::from("pkg"), + release: false, + profiling: false, + out_dir: String::new(), } } } diff --git a/src/command/mod.rs b/src/command/mod.rs index 0b186c0..06353ec 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -36,6 +36,10 @@ pub enum Command { #[structopt(name = "publish")] /// 🎆 pack up your npm package and publish! Publish { + #[structopt(long = "target", short = "t", default_value = "browser")] + /// Sets the target environment. [possible values: browser, nodejs, no-modules] + target: String, + /// The access level for the package to be published #[structopt(long = "access", short = "a")] access: Option, @@ -96,10 +100,14 @@ pub fn run_wasm_pack(command: Command, log: &Logger) -> result::Result<(), Error info!(&log, "Path: {:?}", &path); pack(path, &log) } - Command::Publish { path, access } => { + Command::Publish { + target, + path, + access, + } => { info!(&log, "Running publish command..."); info!(&log, "Path: {:?}", &path); - publish(path, access, &log) + publish(target, path, access, &log) } Command::Login { registry, diff --git a/src/command/publish/mod.rs b/src/command/publish/mod.rs index ddcbea2..e7bab41 100644 --- a/src/command/publish/mod.rs +++ b/src/command/publish/mod.rs @@ -15,6 +15,7 @@ use PBAR; /// Creates a tarball from a 'pkg' directory /// and publishes it to the NPM registry pub fn publish( + target: String, path: Option, access: Option, log: &Logger, @@ -40,7 +41,7 @@ pub fn publish( .interact()?; let target = Input::new() .with_prompt("target") - .default("browser".to_string()) + .default(target) .show_default(true) .interact()? .to_string(); diff --git a/src/logger.rs b/src/logger.rs index f8f6cc4..08add5d 100644 --- a/src/logger.rs +++ b/src/logger.rs @@ -38,7 +38,11 @@ fn log_file_path(cmd: &Command) -> PathBuf { let path = match cmd { Command::Build(build_opts) => &build_opts.path, Command::Pack { path } => path, - Command::Publish { path, access: _ } => path, + Command::Publish { + target: _, + path, + access: _, + } => path, Command::Test(test_opts) => &test_opts.path, Command::Login { .. } => &None, }; From 99ccb75105561d3b4198dfb1e53f0b32d467f49d Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Thu, 27 Dec 2018 20:44:36 +0000 Subject: [PATCH 052/106] Delete rust-toolchain --- rust-toolchain | 1 - 1 file changed, 1 deletion(-) delete mode 100644 rust-toolchain diff --git a/rust-toolchain b/rust-toolchain deleted file mode 100644 index bf867e0..0000000 --- a/rust-toolchain +++ /dev/null @@ -1 +0,0 @@ -nightly From 93384f572f28864e71c79e56c46498ec08621815 Mon Sep 17 00:00:00 2001 From: csmoe Date: Fri, 28 Dec 2018 10:56:37 +0800 Subject: [PATCH 053/106] select build target --- Cargo.lock | 58 +++++++++++++++++++++++++++++--------- Cargo.toml | 1 + src/command/publish/mod.rs | 21 +++++++------- src/command/utils.rs | 10 +++---- src/lib.rs | 1 + 5 files changed, 62 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 201a14e..dfaf50e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -122,8 +122,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -401,8 +401,8 @@ dependencies = [ "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "os_type 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -863,6 +863,14 @@ name = "ryu" version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "same-file" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "schannel" version = "0.1.14" @@ -888,7 +896,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -898,12 +906,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.82" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde_derive" -version = "1.0.82" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -916,7 +924,7 @@ name = "serde_ignored" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -926,7 +934,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1152,7 +1160,7 @@ name = "toml" version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1217,6 +1225,16 @@ name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "walkdir" +version = "2.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "wasm-pack" version = "0.5.1" @@ -1236,8 +1254,8 @@ dependencies = [ "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)", "serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1249,6 +1267,7 @@ dependencies = [ "tar 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "zip 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1286,6 +1305,14 @@ name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "winapi-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -1419,13 +1446,14 @@ dependencies = [ "checksum rustc-demangle 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "01b90379b8664dd83460d59bdc5dd1fd3172b8913788db483ed1325171eab2f7" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" +"checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267" "checksum schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "0e1a231dc10abf6749cfa5d7767f25888d484201accbd919b66ab5413c502d56" "checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)" = "6fa52f19aee12441d5ad11c9a00459122bd8f98707cadf9778c540674f1935b6" -"checksum serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)" = "96a7f9496ac65a2db5929afa087b54f8fc5008dcfbe48a8874ed20049b0d6154" +"checksum serde 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)" = "157e12af46859e968da75dea9845530e13d03bcab2009a41b9b7bb3cf4eb3ec2" +"checksum serde_derive 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)" = "9469829702497daf2daf3c190e130c3fa72f719920f73c86160d43e8f8d76951" "checksum serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "190e9765dcedb56be63b6e0993a006c7e3b071a016a304736e4a315dc01fb142" "checksum serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "c37ccd6be3ed1fdf419ee848f7c758eb31b054d7cd3ae3600e3bae0adf569811" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" @@ -1465,11 +1493,13 @@ dependencies = [ "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +"checksum walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1" "checksum which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b57acb10231b9493c8472b20cb57317d0679a49e0bdbee44b3b803a6473af164" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum wincolor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eeb06499a3a4d44302791052df005d5232b927ed1a9658146d842165c4de7767" "checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" diff --git a/Cargo.toml b/Cargo.toml index 02cfdd5..34e1727 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,6 +38,7 @@ structopt = "0.2" tar = "0.4.16" toml = "0.4" which = "2.0.0" +walkdir = "2" zip = "0.5.0" [dev-dependencies] diff --git a/src/command/publish/mod.rs b/src/command/publish/mod.rs index e7bab41..b2c0916 100644 --- a/src/command/publish/mod.rs +++ b/src/command/publish/mod.rs @@ -4,7 +4,7 @@ pub mod access; use self::access::Access; use command::build::{Build, BuildOptions}; use command::utils::{find_pkg_directory, set_crate_path}; -use dialoguer::{Confirmation, Input}; +use dialoguer::{Confirmation, Input, Select}; use failure::Error; use npm; use slog::Logger; @@ -15,7 +15,7 @@ use PBAR; /// Creates a tarball from a 'pkg' directory /// and publishes it to the NPM registry pub fn publish( - target: String, + _target: String, path: Option, access: Option, log: &Logger, @@ -31,18 +31,19 @@ pub fn publish( // while `wasm-pack publish`, if the pkg directory cannot be found, // then try to `wasm-pack build` if Confirmation::new() - .with_text("Your npm package hasn't be built, build it?") + .with_text("Your package hasn't been built, build it?") .interact()? { let out_dir = Input::new() - .with_prompt("out_dir") - .default("pkg".to_string()) - .show_default(true) + .with_prompt("out_dir[default: pkg]") + .default(".".to_string()) + .show_default(false) .interact()?; - let target = Input::new() - .with_prompt("target") - .default(target) - .show_default(true) + let out_dir = format!("{}/pkg", out_dir); + let target = Select::new() + .with_prompt("target[default: browser]") + .items(&["browser", "nodejs", "no-modules"]) + .default(0) .interact()? .to_string(); let build_opts = BuildOptions { diff --git a/src/command/utils.rs b/src/command/utils.rs index fee4d4f..398bd96 100644 --- a/src/command/utils.rs +++ b/src/command/utils.rs @@ -5,6 +5,7 @@ use failure; use progressbar::Step; use std::fs; use std::path::{Path, PathBuf}; +use walkdir::WalkDir; use PBAR; /// If an explicit path is given, then use it, otherwise assume the current @@ -28,11 +29,10 @@ pub fn find_pkg_directory(path: &Path) -> Option { return Some(path.to_owned()); } - path.read_dir().ok().and_then(|entries| { - entries - .filter_map(|x| x.ok().map(|v| v.path())) - .find(|x| is_pkg_directory(&x)) - }) + WalkDir::new(path) + .into_iter() + .filter_map(|x| x.ok().map(|e| e.into_path())) + .find(|x| is_pkg_directory(&x)) } fn is_pkg_directory(path: &Path) -> bool { diff --git a/src/lib.rs b/src/lib.rs index eb06959..e336d0f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,6 +31,7 @@ extern crate slog_async; extern crate slog_term; extern crate tar; extern crate toml; +extern crate walkdir; extern crate which; extern crate zip; From bcdbaab731e8b7702f513a96ec5f392c9d07f766 Mon Sep 17 00:00:00 2001 From: Mason Stallmo Date: Fri, 28 Dec 2018 15:30:30 -0800 Subject: [PATCH 054/106] Refactor: returns proper error instead of unwrapping during license copy --- src/license.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/license.rs b/src/license.rs index 0b91e78..09fbb36 100644 --- a/src/license.rs +++ b/src/license.rs @@ -15,9 +15,15 @@ fn glob_license_files(path: &Path) -> Result, failure::Error> { for entry in glob(path.join("LICENSE*").to_str().unwrap())? { match entry { Ok(globed_path) => { - license_files.push(String::from( - globed_path.file_name().unwrap().to_str().unwrap(), - )); + let file_name = match globed_path.file_name() { + Some(file_name) => file_name, + None => return Err(format_err!("Could not get file name from path")), + }; + let file_name_string = match file_name.to_str() { + Some(file_name_string) => file_name_string, + None => return Err(format_err!("Could not convert filename to string")), + }; + license_files.push(String::from(file_name_string)); } Err(e) => println!("{:?}", e), } @@ -50,14 +56,14 @@ pub fn copy_from_crate( match license_files { Ok(files) => { - if files.len() == 0 { + if files.is_empty() { PBAR.info("License key is set in Cargo.toml but no LICENSE file(s) were found; Please add the LICENSE file(s) to your project directory"); return Ok(()); } for license_file in files { let crate_license_path = path.join(&license_file); let new_license_path = out_dir.join(&license_file); - if let Err(_) = fs::copy(&crate_license_path, &new_license_path) { + if fs::copy(&crate_license_path, &new_license_path).is_err() { PBAR.info("origin crate has no LICENSE"); } } From c99b93498c227ec67b6cf7c669720c3a27280f7f Mon Sep 17 00:00:00 2001 From: Mason Stallmo Date: Fri, 28 Dec 2018 15:53:23 -0800 Subject: [PATCH 055/106] Refactor: returns error instead of unwrapping path join --- src/license.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/license.rs b/src/license.rs index 09fbb36..2099c64 100644 --- a/src/license.rs +++ b/src/license.rs @@ -12,7 +12,16 @@ use PBAR; fn glob_license_files(path: &Path) -> Result, failure::Error> { let mut license_files: Vec = Vec::new(); - for entry in glob(path.join("LICENSE*").to_str().unwrap())? { + let path_string = match path.join("LICENSE*").to_str() { + Some(path_string) => path_string.to_owned(), + None => { + return Err(format_err!( + "Could not convert joined license path to String" + )); + } + }; + + for entry in glob(&path_string)? { match entry { Ok(globed_path) => { let file_name = match globed_path.file_name() { @@ -20,10 +29,10 @@ fn glob_license_files(path: &Path) -> Result, failure::Error> { None => return Err(format_err!("Could not get file name from path")), }; let file_name_string = match file_name.to_str() { - Some(file_name_string) => file_name_string, - None => return Err(format_err!("Could not convert filename to string")), + Some(file_name_string) => file_name_string.to_owned(), + None => return Err(format_err!("Could not convert filename to String")), }; - license_files.push(String::from(file_name_string)); + license_files.push(file_name_string); } Err(e) => println!("{:?}", e), } From 065a28f293cd2c03e9f0d4946762bfa020a0b71c Mon Sep 17 00:00:00 2001 From: csmoe Date: Thu, 10 Jan 2019 15:08:45 +0800 Subject: [PATCH 056/106] check whether correct target arg passed in --- src/command/build.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/command/build.rs b/src/command/build.rs index 0fbbff3..9a5a152 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -88,7 +88,7 @@ pub struct BuildOptions { pub scope: Option, #[structopt(long = "mode", short = "m", default_value = "normal")] - /// Sets steps to be run. [possible values: no-install, normal] + /// Sets steps to be run. [possible values: no-install, normal, force] pub mode: BuildMode, #[structopt(long = "no-typescript")] @@ -158,6 +158,12 @@ impl Build { _ => bail!("Can only supply one of the --dev, --release, or --profiling flags"), }; + // `possible_values` in clap isn't supported by `structopt` + let possible_targets = ["browser", "nodejs", "no-modules"]; + if !possible_targets.contains(&build_opts.target.as_str()) { + bail!("Supported targets: browser, nodejs, no-modules"); + } + Ok(Build { crate_path, crate_data, From 212d7727dcddf5c091235389a1c7689fe20348b7 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Thu, 10 Jan 2019 16:43:03 -0800 Subject: [PATCH 057/106] docs: use `wasm-pack build` instead of `wasm-pack init` The latter has been deprecated for some time. --- docs/src/commands/pack-and-publish.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/commands/pack-and-publish.md b/docs/src/commands/pack-and-publish.md index 849fb3a..ccc003c 100644 --- a/docs/src/commands/pack-and-publish.md +++ b/docs/src/commands/pack-and-publish.md @@ -1,7 +1,7 @@ # pack and publish The `publish` and `pack` commands interact with the pkg directory that's -created when you run `wasm-pack init`. The `pack` command creates a tarball +created when you run `wasm-pack build`. The `pack` command creates a tarball from the pkg directory and the `publish` command creates a tarball from the pkg directory __and__ publishes it to the NPM registry. From ecbdf90adc902425c8cd907fc9963c1dd20cc44c Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Thu, 10 Jan 2019 16:43:29 -0800 Subject: [PATCH 058/106] docs: delete trailing whitespace --- docs/src/commands/pack-and-publish.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/src/commands/pack-and-publish.md b/docs/src/commands/pack-and-publish.md index ccc003c..0a9a4f7 100644 --- a/docs/src/commands/pack-and-publish.md +++ b/docs/src/commands/pack-and-publish.md @@ -1,9 +1,9 @@ # pack and publish -The `publish` and `pack` commands interact with the pkg directory that's +The `publish` and `pack` commands interact with the pkg directory that's created when you run `wasm-pack build`. The `pack` command creates a tarball -from the pkg directory and the `publish` command creates a tarball from the -pkg directory __and__ publishes it to the NPM registry. +from the pkg directory and the `publish` command creates a tarball from the +pkg directory __and__ publishes it to the NPM registry. Underneath, these commands use `npm pack` and `npm publish`. You can read more about these in the NPM documentation: @@ -11,8 +11,8 @@ more about these in the NPM documentation: - [`npm pack`](https://docs.npmjs.com/cli/pack) - [`npm publish`](https://docs.npmjs.com/cli/publish) -Both these commands take the path to the pkg directory as the first argument. -You can either set the argument directly to the pkg directory or to the parent +Both these commands take the path to the pkg directory as the first argument. +You can either set the argument directly to the pkg directory or to the parent of the pkg directory: ``` From 20c488d559dc00387448a3b651fa36c569dbd967 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Thu, 10 Jan 2019 16:56:44 -0800 Subject: [PATCH 059/106] docs: document that the `pkg` directory is gitignored by default Fixes #473 --- docs/src/commands/build.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/src/commands/build.md b/docs/src/commands/build.md index 884963b..2305f50 100644 --- a/docs/src/commands/build.md +++ b/docs/src/commands/build.md @@ -5,6 +5,10 @@ interoperability and for publishing a package to npm. This involves compiling your code to wasm and generating a pkg folder. This pkg folder will contain the wasm binary, a JS wrapper file, your `README`, and a `package.json` file. +The `pkg` directory is automatically `.gitignore`d by default, since it contains +build artifacts which are not intended to be checked into version +control.[0](#footnote-0) + ## Path The `wasm-pack build` command can be given an optional path argument, e.g.: @@ -85,3 +89,9 @@ wasm-pack build examples/js-hello-world --mode no-install |---------------|------------------------------------------------------------------------------------------| | `no-install` | `wasm-pack init` implicitly and create wasm binding without installing `wasm-bindgen`. | | `normal` | do all the stuffs of `no-install` with installed `wasm-bindgen`. | + +
+ +0 If you need to include additional assets in the pkg +directory and your NPM package, we intend to have a solution for your use case +soon. [↩](#wasm-pack-build) From 0147dae9fe2a863105596ae81c61078bde6cb8af Mon Sep 17 00:00:00 2001 From: Dan Wilhelm Date: Thu, 10 Jan 2019 23:10:13 -0800 Subject: [PATCH 060/106] login: Fix empty input prompt Issue #484. PR392 inadvertantly replaced the `login` interactive process spawner with `child::run`, which is hard-coded to buffer stdout/stderr. This caused `login` to become essentially unusable; the user could no longer see interactive input prompts or error messages displayed by `npm adduser`. The code was not directly reverted because the previous version: 1. Returned Error instead of failure::Error. (Updated to use `bail!`, which is consistent with `publish`.) 2. Displayed all stderr only upon exit, rather than interactively displaying it. This led to repeated interactive prompts without informing the user why. (Updated to use `status()` which inherits stdin/stdout/stderr by default.) 3. Did not provide logging. (Now duplicates the logging in `child::run`.) --- src/npm.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/npm.rs b/src/npm.rs index 76fe841..4f7b18a 100644 --- a/src/npm.rs +++ b/src/npm.rs @@ -62,12 +62,14 @@ pub fn npm_login( args.push_str(&format!(" --auth_type={}", auth_type)); } + // Interactively ask user for npm login info. + // (child::run does not support interactive input) let mut cmd = Command::new("npm"); - cmd.arg("login") - .arg(args) - .stdin(Stdio::inherit()) - .stdout(Stdio::inherit()); - child::run(log, cmd, "npm login") - .with_context(|_| format!("Login to registry {} failed", registry))?; - Ok(()) + cmd.arg("login").arg(args); + + info!(log, "Running {:?}", cmd); + match cmd.status()?.success() { + true => Ok(()), + false => bail!("Login to registry {} failed", registry), + } } From 2343e97e1ec3e622c73e6e70ebbd5b6374612f04 Mon Sep 17 00:00:00 2001 From: Dan Wilhelm Date: Thu, 10 Jan 2019 23:43:16 -0800 Subject: [PATCH 061/106] login: Send arguments separately to npm All arguments were passed to `arg` inside one string when building a `Command`. However, using the `arg` function, "only one argument can be passed per use." This caused all arguments accidentally to be appended to the registry URL. For example: After a successful login with a provided `--auth_type`, the success message incorrectly displayed: "Logged in as asf on https://registry.npmjs.org/%20--auth_type=Basic." The space (%20 in hex) was caused by adding a fixed space before each additional argument. This commit pushes all arguments onto a `Vec`. Then, the `args` function adds the arguments separately to the command. This removes the need to prepend spaces to each argument. Alternatively, `arg` could have been used throughout to build the command argument-by-argument. However, using `args` partitions the code more neatly into two distinct sections. --- src/npm.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/npm.rs b/src/npm.rs index 4f7b18a..6b09e63 100644 --- a/src/npm.rs +++ b/src/npm.rs @@ -46,26 +46,24 @@ pub fn npm_login( always_auth: bool, auth_type: &Option, ) -> Result<(), failure::Error> { - let mut args = String::new(); - - args.push_str(&format!("--registry={}", registry)); + let mut args = vec![format!("login"), format!("--registry={}", registry)]; if let Some(scope) = scope { - args.push_str(&format!(" --scope={}", scope)); + args.push(format!("--scope={}", scope)); } if always_auth == true { - args.push_str(" --always_auth"); + args.push(format!("--always_auth")); } if let Some(auth_type) = auth_type { - args.push_str(&format!(" --auth_type={}", auth_type)); + args.push(format!("--auth_type={}", auth_type)); } // Interactively ask user for npm login info. // (child::run does not support interactive input) let mut cmd = Command::new("npm"); - cmd.arg("login").arg(args); + cmd.args(args); info!(log, "Running {:?}", cmd); match cmd.status()?.success() { From bcc94ace439c8fdabc3638f805784b3184a24698 Mon Sep 17 00:00:00 2001 From: Dan Wilhelm Date: Sun, 13 Jan 2019 02:23:46 -0800 Subject: [PATCH 062/106] docs: Update for template changes, typos --- .../tutorial/template-deep-dive/cargo-toml.md | 46 ++++++++++++------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/docs/src/tutorial/template-deep-dive/cargo-toml.md b/docs/src/tutorial/template-deep-dive/cargo-toml.md index d6af282..3e26a48 100644 --- a/docs/src/tutorial/template-deep-dive/cargo-toml.md +++ b/docs/src/tutorial/template-deep-dive/cargo-toml.md @@ -3,11 +3,11 @@ `Cargo.toml` is the manifest file for Rust's package manager, `cargo`. This file contains metadata such as name, version, and dependencies for packages, which are call "crates" in Rust. -There's a bunch of metadata that the template gives us, but there are 3 key parts to discuss: +There's a bunch of metadata that the template gives us, but there are three key parts to discuss: -- [`crate-type`](#a1-crate-type) -- [`wasm-bindgen` dependency](#a2-wasm-bindgen-dependency) -- [`[features]` and `wee-alloc`, `console-error-panic-hook` dependencies](#a3-features-and-wee-alloc-console-error-panic-hook-dependencies) +1. [`crate-type`](#a1-crate-type) +2. [`wasm-bindgen` dependency](#a2-wasm-bindgen-dependency) +3. [`[features]` and `wee_alloc`, `console_error_panic_hook` dependencies](#a3-features-and-wee_alloc-console_error_panic_hook-dependencies)
@@ -15,7 +15,7 @@ There's a bunch of metadata that the template gives us, but there are 3 key part ```toml [lib] -crate-type = ["cdylib"] +crate-type = ["cdylib", "rlib"] ``` A Rust-`wasm` crate is a bit different from a normal crate, and as a result, we need to note @@ -33,6 +33,9 @@ as a dynamic library to be loaded from another language. In our case, we'll be c `.wasm` file, but this output type will create `*.so` files on Linux, `*.dylib` files on macOS, and `*.dll` files on Windows in non-`wasm` circumstances. +`#[crate_type = "rlib"]` signifies that an intermediate "Rust library" file will be produced. +This allows tests to use the main crate. + You can read more about linking and crate types, [here](https://doc.rust-lang.org/reference/linkage.html). ## 2. `wasm-bindgen` dependency @@ -52,23 +55,24 @@ We'll see more about how to use this library when we discuss what has been gener there is no `^` or `~` symbol- it looks like we're locking to the `0.2` version. However, that's not the case! In Rust, the `^` is implied. -## 3. `[features]` and `wee-alloc`, `console-error-panic-hook` dependencies +## 3. `[features]` and `wee_alloc`, `console_error_panic_hook` dependencies As part of our effort to design a template that helps people discover useful crates -for their particular use case, this template includes 2 dependencies that can be +for their particular use case, this template includes two dependencies that can be very useful for folks developing Rust-`wasm` crates: `console-error-panic-hook` and `wee-alloc`. -Because these dependencies are useful primarily in a specifc portion of the Rust-`wasm` +Because these dependencies are useful primarily in a specific portion of the Rust-`wasm` crate development workflow, we've also set up a bit of glue code that allows us to include -them both as dependences, but allowing for them to be optionally included. +them both as dependencies, but also allows them to be optionally included. ```toml [features] -default-features = ["console_error_panic_hook", "wee_alloc"] +default = ["console_error_panic_hook"] [dependencies] cfg-if = "0.1.2" +wasm-bindgen = "0.2" # The `console_error_panic_hook` crate provides better debugging of panics by # logging them with `console.error`. This is great for development, but requires @@ -79,12 +83,22 @@ console_error_panic_hook = { version = "0.1.1", optional = true } # `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size # compared to the default allocator's ~10K. It is slower than the default # allocator, however. -wee_alloc = { version = "0.4.1", optional = true } +# +# Unfortunately, `wee_alloc` requires nightly Rust when targeting wasm for now. +wee_alloc = { version = "0.4.2", optional = true } ``` -[`cfg-if`] allows us to check if certain features are enabled on a rust crate. We'll -use this crate in `utils.rs` to optionally enable `console_error_panic_hook` or -`wee_alloc`. By default, we have them enabled. To disable them, we can remove their -entry from the `default-features` vector. +[`cfg-if`] allows us to check if certain features are enabled on a Rust crate. We'll +use this crate later to optionally enable `console_error_panic_hook` or +`wee_alloc`. + +By default, only `console_error_panic_hook` is enabled. To disable either +feature, we can remove its name from the `default` vector. + +To learn more about these features, we discuss them in-depth in the `src/lib.rs` and +`src/utils.rs` sections. + +Briefly, they include: -To learn more about these features, we discuss them in depth in the `utils.rs` section. ++ **console_error_panic_hook** for logging panic messages to the developer console. ++ **wee_alloc**, an allocator optimized for small code size. From 8f22319d6fe88665d8507becced239b647914c4a Mon Sep 17 00:00:00 2001 From: Dan Wilhelm Date: Sun, 13 Jan 2019 02:24:31 -0800 Subject: [PATCH 063/106] docs: Add template deep dive for src/lib.rs Issue #345 --- .../tutorial/template-deep-dive/src-lib-rs.md | 126 +++++++++++++++++- 1 file changed, 125 insertions(+), 1 deletion(-) diff --git a/docs/src/tutorial/template-deep-dive/src-lib-rs.md b/docs/src/tutorial/template-deep-dive/src-lib-rs.md index 1e31777..e5f72fe 100644 --- a/docs/src/tutorial/template-deep-dive/src-lib-rs.md +++ b/docs/src/tutorial/template-deep-dive/src-lib-rs.md @@ -1,3 +1,127 @@ # src/lib.rs -🚧 COMING SOON 🚧 +`lib.rs` is the template's main source file. The name `lib.rs` commonly implies that this Rust project will be compiled as a library. + +It contains three key parts: + +1. [`#[wasm_bindgen] functions`](#a1-wasm_bindgen-functions) +2. [Crate imports](#a2-crate-imports) +3. [`wee_alloc` optional dependecy](#a3-wee_alloc-optional-dependecy) + - [What is `wee_alloc`?](#what-is-wee_alloc) + +--- + +We'll start with the most important part of `lib.rs` -- the two `#[wasm_bindgen]` functions. In many cases, this is the only part of `lib.rs` you will need to modify. + +## 1. `#[wasm_bindgen]` functions + +The `#[wasm_bindgen]` attribute indicates that the function below it will be accessible both in JavaScript and Rust. + +```rust +#[wasm_bindgen] +extern { + fn alert(s: &str); +} +``` + +The `extern` block imports the external JavaScript function `alert` into Rust. This declaration is required to call `alert` from Rust. By declaring it in this way, `wasm-bindgen` will create JavaScript stubs for `alert` which allow us to pass strings back and forth between Rust and JavaScript. + +We can see that the `alert` function requires a single parameter `s` of type `&str`, a string. In Rust, any string literal such as `"Hello, test-wasm!"` is of type `&str`. So, `alert` could be called by writing `alert("Hello, test-wasm!");`. + +We knew to declare `alert` in this way because it is how we would call `alert` in JavaScript -- by passing it a string argument. + +```rust +#[wasm_bindgen] +pub fn greet() { + alert("Hello, test-wasm!"); +} +``` + +If we were to write the `greet` function without the `#[wasm_bindgen]` attribute, then `greet` would not be easily accessible within JavaScript. Furthermore, we wouldn't be able to natively convert certain types such as `&str` between JavaScript and Rust. So, both the `#[wasm_bindgen]` attribute and the prior import of `alert` allow `greet` to be called from JavaScript. + +This is all you need to know to interface with JavaScript! If you are curious about the rest, read on. + +## 2. Crate imports + +```rust +extern crate cfg_if; +extern crate wasm_bindgen; +``` + +In `Cargo.toml`, we included the crates `cfg_if` and `wasm_bindgen` as project dependencies. + +Here, we explicitly declare that these crates will be used in `lib.rs`. + +```rust +mod utils; +``` +This statement declares a new module named `utils` that is defined by the contents of `utils.rs`. Equivalently, we could place the contents of `utils.rs` inside the `utils` declaration, replacing the line with: + +```rust +mod utils { + // contents of utils.rs +} +``` + +Either way, the contents of `utils.rs` define a single public function `set_panic_hook`. Because we are placing it inside the `utils` module, we will be able to call the function directly by writing `utils::set_panic_hook()`. We will discuss how and why to use this function in `src/utils.rs`. + + +```rust +use cfg_if::cfg_if; +``` + +`use` allows us to conveniently refer to parts of a crate or module. For example, suppose the crate `cfg_if` contains a function `func`. It is always possible to call this function directly by writing `cfg_if::func()`. However, this is often tedious to write. If we first specify `use cfg_if::func;`, then `func` can be called by just writing `func()` instead. + +With this in mind, this `use` allows us to call the macro `cfg_if!` inside the crate `cfg_if` without writing `cfg_if::cfg_if!`. + +```rust +use wasm_bindgen::prelude::*; +``` + +Many modules contain a prelude, a list of things that should be automatically imported. This allows common features of the module to be conveniently accessed without a lengthy prefix. For example, in this file we can use `#[wasm_bindgen]` only because it is brought into scope by the prelude. + +The asterisk at the end of this `use` indicates that everything inside the module `wasm_bindgen::prelude` (i.e. the module `prelude` inside the crate `wasm_bindgen`) can be referred to without prefixing it with `wasm_bindgen::prelude`. + +For example, `#[wasm_bindgen]` could also be written as `#[wasm_bindgen::prelude::wasm_bindgen]`, although this is not recommended. + +## 3. `wee_alloc` optional dependecy + +```rust +cfg_if! { + if #[cfg(feature = "wee_alloc")] { + extern crate wee_alloc; + #[global_allocator] + static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; + } +} +``` + +This code block is intended to initialize `wee_alloc` as the global memory allocator, but only if the `wee_alloc` feature is enabled in `Cargo.toml`. + +We immediately notice that `cfg_if!` is a macro because it ends in `!`, similarly to other Rust macros such as `println!` and `vec!`. A macro is directly replaced by other code during compile time. + +During compile time, `cfg_if!` evaluates the `if` statement. This tests whether the feature `wee_alloc` is present in the `[features]` section of `Cargo.toml` (among other possible ways to set it). + +As we saw earlier, the `default` vector in `[features]` only contains `"console_error_panic_hook"` and not `"wee_alloc"`. So, in this case, the `cfg_if!` block will be replaced by no code at all, and hence the default memory allocator will be used instead of `wee_alloc`. + +```rust +extern crate wee_alloc; +#[global_allocator] +static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; +``` + +However, suppose `"wee_alloc"` is appended to the `default` vector in `Cargo.toml`. Then, the `cfg_if!` block is instead replaced with the contents of the `if` block, shown above. + +This code sets the `wee_alloc` allocator to be used as the global memory allocator. + +### What is `wee_alloc`? + +Reducing the size of compiled WebAssembly code is important, since it is often transmitted over the Internet or placed on embedded devices. + +> `wee_alloc` is a tiny allocator designed for WebAssembly that has a (pre-compression) code-size footprint of only a single kilobyte. + +[An analysis](http://fitzgeraldnick.com/2018/02/09/wee-alloc.html) suggests that over half of the bare minimum WebAssembly memory footprint is required by Rust's default memory allocator. Yet, WebAssembly code often does not require a sophisticated allocator, since it often just requests a couple of large initial allocations. + +`wee_alloc` trades off size for speed. Although it has a tiny code-size footprint, it is relatively slow if additional allocations are needed. + +For more details, see the [`wee_alloc` repository](https://github.com/rustwasm/wee_alloc). \ No newline at end of file From 5205847d842d828470a9d37c1f423349370b417e Mon Sep 17 00:00:00 2001 From: Dan Wilhelm Date: Sun, 13 Jan 2019 02:25:42 -0800 Subject: [PATCH 064/106] docs: Add template deep dive for src/utils.rs Issue #346 --- .../template-deep-dive/src-utils-rs.md | 65 ++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/docs/src/tutorial/template-deep-dive/src-utils-rs.md b/docs/src/tutorial/template-deep-dive/src-utils-rs.md index ea0c3c0..3ea5cb2 100644 --- a/docs/src/tutorial/template-deep-dive/src-utils-rs.md +++ b/docs/src/tutorial/template-deep-dive/src-utils-rs.md @@ -1,3 +1,66 @@ # src/utils.rs -🚧 COMING SOON 🚧 +The purpose of `utils.rs` is to define the `utils` module, which contains a single function `set_panic_hook`. This function becomes part of the `utils` module in `lib.rs`, as described in the preceding section. + +If the `console_error_panic_hook` feature is not enabled, then `set_panic_hook` is defined to be an inlined empty function. So, there is no run-time performance or code-size penalty incurred by its use. + +We will discuss: +1. [Defining `set_panic_hook`](#a1-defining-set_panic_hook) +2. [What is `console_error_panic_hook`?](#a2-what-is-console_error_panic_hook) + + +--- + +## 1. Defining `set_panic_hook` + +``` +use cfg_if::cfg_if; +``` + +This allows us to write `cfg_if!` instead of `cfg_if::cfg_if!`, identically to the line in `src/lib.rs`. + +``` +cfg_if! { + if #[cfg(feature = "console_error_panic_hook")] { + extern crate console_error_panic_hook; + pub use self::console_error_panic_hook::set_once as set_panic_hook; + } else { + #[inline] + pub fn set_panic_hook() {} + } +} +``` + +As described in the preceding section, the macro `cfg_if!` evaluates the `if` statement during compile time. This is possible because it is essentially testing whether `"console_error_panic_hook"` is defined in the `[features]` section of `Cargo.toml`, which is available during compile time. + +The entire macro block will either be replaced with the statements in the `if` block or with those in the `else` block. These two cases are now described in turn: + +``` +extern crate console_error_panic_hook; +pub use self::console_error_panic_hook::set_once as set_panic_hook; +``` + +Due to the `use` statement, the function `self::console_error_panic_hook::set_once` can now be accessed more conveniently as `set_panic_hook`. Due to `pub`, this function will be publicly accessible outside of the `utils` module as `utils::set_panic_hook`. + +``` +#[inline] +pub fn set_panic_hook() {} +``` + +An inline function replaces the function call with the contents of the function during compile time. Here, `set_panic_hook` is defined to be an empty inline function. This allows the use of `set_panic_hook` without any run-time or code-size performance penalty if the feature is not enabled. + +## 2. What is `console_error_panic_hook`? + +The crate `console_error_panic_hook` enhances error messages in the web browser. This allows you to easily debug WebAssembly code. + +Let's compare error messages before and after enabling the feature: + +**Before:** `"RuntimeError: Unreachable executed"` + +**After:** `"panicked at 'index out of bounds: the len is 3 but the index is 4', libcore/slice/mod.rs:2046:10"` + +To do this, a panic hook for WebAssembly is provided that logs panics to the developer console via the JavaScript `console.error` function. + +Note that although the template sets up the function, your error messages will not automatically be enhanced. To enable the enhanced errors, call the function `utils::set_panic_hook()` in `lib.rs` when your code first runs. The function may be called multiple times if needed. + +For more details, see the [`console_error_panic_hook` repository](https://github.com/rustwasm/console_error_panic_hook). \ No newline at end of file From 669c43d85371d191e61253796ac377f0a1aadb0b Mon Sep 17 00:00:00 2001 From: Vsevolod Velichko Date: Sun, 16 Dec 2018 12:22:51 +0300 Subject: [PATCH 065/106] add an option to pass an arbitrary set of arguments to cargo build --- src/build.rs | 2 ++ src/command/build.rs | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/build.rs b/src/build.rs index 4628d37..bd14b50 100644 --- a/src/build.rs +++ b/src/build.rs @@ -68,6 +68,7 @@ pub fn cargo_build_wasm( path: &Path, profile: BuildProfile, step: &Step, + extra_options: &Vec, ) -> Result<(), Error> { let msg = format!("{}Compiling to WASM...", emoji::CYCLONE); PBAR.step(step, &msg); @@ -91,6 +92,7 @@ pub fn cargo_build_wasm( } } cmd.arg("--target").arg("wasm32-unknown-unknown"); + cmd.args(extra_options); child::run(log, cmd, "cargo build").context("Compiling your crate to WebAssembly failed")?; Ok(()) } diff --git a/src/command/build.rs b/src/command/build.rs index 9a5a152..c6545a3 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -31,6 +31,7 @@ pub struct Build { pub out_dir: PathBuf, pub bindgen: Option, pub cache: Cache, + pub extra_options: Vec, } /// The `BuildMode` determines which mode of initialization we are running, and @@ -120,6 +121,10 @@ pub struct BuildOptions { #[structopt(long = "out-dir", short = "d", default_value = "pkg")] /// Sets the output directory with a relative path. pub out_dir: String, + + #[structopt(last = true)] + /// List of extra options to pass to `cargo build` + pub extra_options: Vec, } impl Default for BuildOptions { @@ -135,6 +140,7 @@ impl Default for BuildOptions { release: false, profiling: false, out_dir: String::new(), + extra_options: Vec::new(), } } } @@ -175,6 +181,7 @@ impl Build { out_dir, bindgen: None, cache: Cache::new()?, + extra_options: build_opts.extra_options, }) } @@ -283,7 +290,13 @@ impl Build { fn step_build_wasm(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { info!(&log, "Building wasm..."); - build::cargo_build_wasm(log, &self.crate_path, self.profile, step)?; + build::cargo_build_wasm( + log, + &self.crate_path, + self.profile, + step, + &self.extra_options, + )?; info!( &log, From 43488dae1dcbe95a867df4208b9e0f3c1a79a9a1 Mon Sep 17 00:00:00 2001 From: Vsevolod Velichko Date: Wed, 19 Dec 2018 01:17:08 +0300 Subject: [PATCH 066/106] add test and some documentation for custom extra options passed to build command --- docs/src/commands/build.md | 11 +++++++++++ tests/all/build.rs | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/docs/src/commands/build.md b/docs/src/commands/build.md index 2305f50..96371fc 100644 --- a/docs/src/commands/build.md +++ b/docs/src/commands/build.md @@ -90,6 +90,17 @@ wasm-pack build examples/js-hello-world --mode no-install | `no-install` | `wasm-pack init` implicitly and create wasm binding without installing `wasm-bindgen`. | | `normal` | do all the stuffs of `no-install` with installed `wasm-bindgen`. | +## Extra options + +The `build` command can pass extra options straight to `cargo build` even if they are not +supported in wasm-pack. To use them you should add standalone `--` argument at the very +end of your command, and all the arguments you want to pass to cargo should go after. +For example to build previous example using unstable cargo offline feature: + +``` +wasm-pack build examples/js-hello-world --mode no-install -- -Z offline +``` +
0 If you need to include additional assets in the pkg diff --git a/tests/all/build.rs b/tests/all/build.rs index 7d06f15..1142805 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -248,3 +248,19 @@ fn it_format_out_dir_on_windows() { "directories in wasm-pack.log should be well formatted", ); } + +#[test] +fn build_with_arbitrary_cargo_options() { + let fixture = utils::fixture::js_hello_world(); + fixture.install_local_wasm_bindgen(); + + let cli = Cli::from_iter_safe(vec![ + "wasm-pack", + "build", + &fixture.path.display().to_string(), + "--", + "--no-default-features", + ]) + .unwrap(); + fixture.run(cli.cmd).unwrap(); +} From 3088e790a0042361ba05d67cfb2a7e4876da790e Mon Sep 17 00:00:00 2001 From: Dan Wilhelm Date: Sat, 12 Jan 2019 01:12:38 -0800 Subject: [PATCH 067/106] Remove redundant or misleading Command configs `child::run` overrides the stdout config, so is misleading to to set it differently beforehand. `child::run` uses `spawn()`, which inherits stdin by default. So, no need to set stdin to default beforehand, particularly when the spawned program is non-interactive. --- src/npm.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/npm.rs b/src/npm.rs index 6b09e63..4066b0d 100644 --- a/src/npm.rs +++ b/src/npm.rs @@ -4,7 +4,7 @@ use child; use command::publish::access::Access; use failure::{self, ResultExt}; use slog::Logger; -use std::process::{Command, Stdio}; +use std::process::Command; /// The default npm registry used when we aren't working with a custom registry. pub const DEFAULT_NPM_REGISTRY: &'static str = "https://registry.npmjs.org/"; @@ -24,14 +24,8 @@ pub fn npm_publish(log: &Logger, path: &str, access: Option) -> Result<( Some(a) => cmd .current_dir(path) .arg("publish") - .arg(&format!("{}", a.to_string())) - .stdin(Stdio::inherit()) - .stdout(Stdio::inherit()), - None => cmd - .current_dir(path) - .arg("publish") - .stdin(Stdio::inherit()) - .stdout(Stdio::inherit()), + .arg(&format!("{}", a.to_string())), + None => cmd.current_dir(path).arg("publish"), }; child::run(log, cmd, "npm publish").context("Publishing to npm failed")?; @@ -52,7 +46,7 @@ pub fn npm_login( args.push(format!("--scope={}", scope)); } - if always_auth == true { + if always_auth { args.push(format!("--always_auth")); } From 92d24ff2989f3a5341a749bd2acebe278843485c Mon Sep 17 00:00:00 2001 From: Dan Wilhelm Date: Sat, 12 Jan 2019 02:21:25 -0800 Subject: [PATCH 068/106] Fix npm error when spawned in Windows Issue #277 - Affects running login, pack, and publish on Windows. `Command::new("npm")` launched `npm` with quotes, `"npm"`, causing a run-time error on Windows. Now, `Command::new` is wrapped by `child::new_command(program: &str)`. This prepends `cmd /c` to the program name if `cfg!(windows)`. See rustc: #42436, #42791, #44542 --- src/child.rs | 30 ++++++++++++++++++++++-------- src/npm.rs | 7 +++---- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/child.rs b/src/child.rs index e312c20..72c8e87 100644 --- a/src/child.rs +++ b/src/child.rs @@ -7,7 +7,9 @@ use failure::Error; use slog::Logger; use std::{ io::{self, Read}, - mem, process, string, + mem, + process::{Command, Stdio}, + string, sync::mpsc, thread, }; @@ -19,6 +21,22 @@ enum OutputFragment { Stderr(Vec), } +/// Return a new Command object +pub fn new_command(program: &str) -> Command { + // On Windows, initializes launching as `cmd /c `. + // Initializing only with `Command::new("npm")` will launch + // `npm` with quotes, `"npm"`, causing a run-time error on Windows. + // See rustc: #42436, #42791, #44542 + + if cfg!(windows) { + let mut cmd = Command::new("cmd"); + cmd.arg("/c").arg(program); + cmd + } else { + Command::new(program) + } +} + /// Read data from the give reader and send it as an `OutputFragment` over the /// given sender. fn read_and_send( @@ -115,16 +133,12 @@ where } /// Run the given command and return its stdout. -pub fn run( - logger: &Logger, - mut command: process::Command, - command_name: &str, -) -> Result { +pub fn run(logger: &Logger, mut command: Command, command_name: &str) -> Result { info!(logger, "Running {:?}", command); let mut child = command - .stdout(process::Stdio::piped()) - .stderr(process::Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) .spawn()?; let stdout = child.stdout.take().unwrap(); diff --git a/src/npm.rs b/src/npm.rs index 4066b0d..74a0250 100644 --- a/src/npm.rs +++ b/src/npm.rs @@ -4,14 +4,13 @@ use child; use command::publish::access::Access; use failure::{self, ResultExt}; use slog::Logger; -use std::process::Command; /// The default npm registry used when we aren't working with a custom registry. pub const DEFAULT_NPM_REGISTRY: &'static str = "https://registry.npmjs.org/"; /// Run the `npm pack` command. pub fn npm_pack(log: &Logger, path: &str) -> Result<(), failure::Error> { - let mut cmd = Command::new("npm"); + let mut cmd = child::new_command("npm"); cmd.current_dir(path).arg("pack"); child::run(log, cmd, "npm pack").context("Packaging up your code failed")?; Ok(()) @@ -19,7 +18,7 @@ pub fn npm_pack(log: &Logger, path: &str) -> Result<(), failure::Error> { /// Run the `npm publish` command. pub fn npm_publish(log: &Logger, path: &str, access: Option) -> Result<(), failure::Error> { - let mut cmd = Command::new("npm"); + let mut cmd = child::new_command("npm"); match access { Some(a) => cmd .current_dir(path) @@ -56,7 +55,7 @@ pub fn npm_login( // Interactively ask user for npm login info. // (child::run does not support interactive input) - let mut cmd = Command::new("npm"); + let mut cmd = child::new_command("npm"); cmd.args(args); info!(log, "Running {:?}", cmd); From 80be336ee24bb8af9c774b596f0feb0154df20fc Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 5 Nov 2018 15:30:25 -0800 Subject: [PATCH 069/106] Replace `slog` with `log` This commit replaces the `slog` family of crates used by `wasm-pack` with the `log` crate plus `env_logger`. This also means that by default `wasm-pack` also won't create a `wasm-pack.log` file in the current directory. Enabling logging will now be done through `RUST_LOG=wasm_pack` instead of `-v` flags. Closes #425 --- Cargo.lock | 397 ++++++++++++++++++------------------- Cargo.toml | 8 +- src/bindgen.rs | 29 +-- src/build.rs | 19 +- src/child.rs | 10 +- src/command/build.rs | 89 ++++----- src/command/login.rs | 17 +- src/command/mod.rs | 34 ++-- src/command/pack.rs | 14 +- src/command/publish/mod.rs | 13 +- src/command/test.rs | 96 +++++---- src/lib.rs | 6 +- src/logger.rs | 76 ------- src/main.rs | 7 +- src/npm.rs | 13 +- src/test/mod.rs | 14 +- tests/all/main.rs | 2 - tests/all/utils/fixture.rs | 9 +- tests/all/utils/logger.rs | 6 - tests/all/utils/mod.rs | 1 - 20 files changed, 356 insertions(+), 504 deletions(-) delete mode 100644 src/logger.rs delete mode 100644 tests/all/utils/logger.rs diff --git a/Cargo.lock b/Cargo.lock index eb3fba5..77ac158 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -41,7 +41,7 @@ name = "atty" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -59,8 +59,8 @@ dependencies = [ "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -70,7 +70,7 @@ version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -103,7 +103,7 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bzip2-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -112,7 +112,7 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -122,9 +122,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -137,16 +137,6 @@ name = "cfg-if" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "chrono" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "clap" version = "2.32.0" @@ -168,7 +158,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -179,7 +169,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -199,8 +189,8 @@ dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "clicolors-control 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -216,8 +206,8 @@ dependencies = [ "clicolors-control 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -250,9 +240,9 @@ name = "curl" version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "curl-sys 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", + "curl-sys 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", "schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -262,11 +252,11 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.15" +version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -289,7 +279,7 @@ name = "dirs" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "redox_users 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -299,6 +289,17 @@ name = "encode_unicode" version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "env_logger" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "error-chain" version = "0.12.0" @@ -309,21 +310,21 @@ dependencies = [ [[package]] name = "failure" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "failure_derive" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -333,8 +334,8 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -343,7 +344,7 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -399,10 +400,10 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "os_type 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -410,25 +411,22 @@ dependencies = [ ] [[package]] -name = "indicatif" -version = "0.9.0" +name = "humantime" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "console 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "isatty" -version = "0.1.9" +name = "indicatif" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "console 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -457,7 +455,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.45" +version = "0.2.46" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -476,7 +474,7 @@ version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -490,13 +488,21 @@ dependencies = [ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "log" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "memchr" version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -506,7 +512,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -524,7 +530,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -533,19 +539,6 @@ name = "nodrop" version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "num-integer" -version = "0.1.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-traits" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "openssl" version = "0.10.16" @@ -555,7 +548,7 @@ dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -578,7 +571,7 @@ version = "0.9.40" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-src 111.1.0+1.1.1a (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -611,7 +604,7 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -623,7 +616,7 @@ name = "parking_lot_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -635,8 +628,8 @@ name = "parking_lot_core" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -660,6 +653,11 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "quick-error" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "quote" version = "0.6.10" @@ -674,17 +672,19 @@ version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -695,36 +695,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" -version = "0.6.1" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_os 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_chacha" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -756,6 +755,19 @@ dependencies = [ "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand_os" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_pcg" version = "0.1.1" @@ -767,7 +779,15 @@ dependencies = [ [[package]] name = "rand_xorshift" -version = "0.1.0" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rdrand" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -775,7 +795,7 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.1.44" +version = "0.1.50" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -783,7 +803,7 @@ name = "redox_termios" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -792,9 +812,9 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -847,7 +867,7 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.11" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -896,7 +916,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -906,17 +926,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.83" +version = "1.0.84" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde_derive" -version = "1.0.83" +version = "1.0.84" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -924,17 +944,17 @@ name = "serde_ignored" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "1.0.33" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -942,33 +962,6 @@ name = "siphasher" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "slog" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "slog-async" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "slog-term" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "smallvec" version = "0.6.7" @@ -983,8 +976,8 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1020,12 +1013,12 @@ dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "syn" -version = "0.15.23" +version = "0.15.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1040,23 +1033,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "take_mut" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "tar" version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1065,7 +1053,7 @@ name = "tempdir" version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1075,9 +1063,9 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1087,28 +1075,27 @@ version = "3.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "term" -version = "0.5.1" +name = "termcolor" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "wincolor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "termcolor" -version = "0.3.6" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wincolor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1116,8 +1103,8 @@ name = "termion" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1126,7 +1113,7 @@ name = "termios" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1147,11 +1134,11 @@ dependencies = [ [[package]] name = "time" -version = "0.1.41" +version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1160,7 +1147,7 @@ name = "toml" version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1202,7 +1189,7 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1242,21 +1229,23 @@ dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "cargo_metadata 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "console 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", "dialoguer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "human-panic 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "indicatif 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "slog-term 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", + "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1272,7 +1261,7 @@ version = "0.1.0" dependencies = [ "curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1285,8 +1274,8 @@ name = "which" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1334,12 +1323,21 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "wincolor" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "xattr" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1351,7 +1349,7 @@ dependencies = [ "crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "libflate 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", "podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [metadata] @@ -1373,7 +1371,6 @@ dependencies = [ "checksum cargo_metadata 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e5d1b4d380e1bab994591a24c2bdd1b054f64b60bef483a8c598c7c345bc3bbe" "checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" -"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" "checksum clicolors-control 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1f84dec9bc083ce2503908cd305af98bd363da6f54bf8d4bf0ac14ee749ad5d1" "checksum clicolors-control 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "73abfd4c73d003a674ce5d2933fca6ce6c42480ea84a5ffe0a2dc39ed56300f9" @@ -1384,13 +1381,14 @@ dependencies = [ "checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" "checksum crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e91d5240c6975ef33aeb5f148f35275c25eda8e8a5f95abe421978b05b8bf192" "checksum curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "c7c9d851c825e0c033979d4516c9173bc19a78a96eb4d6ae51d4045440eafa16" -"checksum curl-sys 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)" = "721c204978be2143fab0a84b708c49d79d1f6100b8785610f456043a90708870" +"checksum curl-sys 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ca79238a79fb294be6173b4057c95b22a718c94c4e38475d5faa82b8383f3502" "checksum dialoguer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1ad1c29a0368928e78c551354dbff79f103a962ad820519724ef0d74f1c62fa9" "checksum dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "88972de891f6118092b643d85a0b28e0678e0f948d7f879aa32f2d5aafe97d2a" "checksum encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "90b2c9496c001e8cb61827acdefad780795c42264c137744cae6f7d9e3450abd" +"checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38" "checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" -"checksum failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6dd377bcc1b1b7ce911967e3ec24fa19c3224394ec05b54aa7b083d498341ac7" -"checksum failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "64c2d913fe8ed3b6c6518eedf4538255b989945c14c2a7d5cbff62a5e2120596" +"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" +"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" "checksum filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a2df5c1a8c4be27e7707789dc42ae65976e60b394afd293d1419ab915833e646" "checksum flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2291c165c8e703ee54ef3055ad6188e3d51108e2ded18e9f2476e774fc5ad3d4" "checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" @@ -1401,23 +1399,22 @@ dependencies = [ "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" "checksum human-panic 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "21638c5955a6daf3ecc42cae702335fc37a72a4abcc6959ce457b31a7d43bbdd" +"checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" "checksum indicatif 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a29b2fa6f00010c268bface64c18bb0310aaa70d46a195d5382d288c477fb016" -"checksum isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e31a8281fc93ec9693494da65fbf28c0c2aa60a2eaec25dc58e2f31952e95edc" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" -"checksum libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "2d2857ec59fadc0773853c664d2d18e7198e83883e7060b63c924cb077bd5c74" +"checksum libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)" = "023a4cd09b2ff695f9734c1934145a315594b7986398496841c7031a5a1bbdbd" "checksum libflate 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)" = "bff3ac7d6f23730d3b533c35ed75eef638167634476a499feef16c428d74b57b" "checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" +"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "db4c41318937f6e76648f42826b1d9ade5c09cafb5aef7e351240a70f39206e9" "checksum miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649" "checksum miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad30a47319c16cde58d0314f5d98202a80c9083b5f61178457403dfb14e509c" "checksum miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28edaef377517fd9fe3e085c37d892ce7acd1fbeab9239c5a36eec352d8a8b7e" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" -"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" -"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ec7bd7ca4cce6dbdc77e7c1230682740d307d1218a87fb0349a571272be749f9" "checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" "checksum openssl-src 111.1.0+1.1.1a (registry+https://github.com/rust-lang/crates.io-index)" = "26bb632127731bf4ac49bf86a5dde12d2ca0918c2234fc39d79d4da2ccbc6da7" @@ -1425,25 +1422,28 @@ dependencies = [ "checksum os_type 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7edc011af0ae98b7f88cf7e4a83b70a54a75d2b8cb013d6efd02e5956207e9eb" "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" "checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" -"checksum parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9723236a9525c757d9725b993511e3fc941e33f27751942232f0058298297edf" +"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" "checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c" "checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" "checksum podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "780fb4b6698bbf9cf2444ea5d22411cef2953f0824b98f33cf454ec5615645bd" "checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" +"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" "checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1" -"checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" +"checksum rand 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "dee497e66d8d76bf08ce20c8d36e16f93749ab0bf89975b4f8ae5cee660c2da2" "checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" -"checksum rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae9d223d52ae411a33cf7e54ec6034ec165df296ccd23533d671a28252b6f66a" -"checksum rand_chacha 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "771b009e3a508cb67e8823dda454aaa5368c7bc1c16829fb77d3e980440dd34a" +"checksum rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3906503e80ac6cbcacb2c2973fa8e473f24d7e2747c8c92bb230c2441cad96b5" +"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" "checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372" "checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db" "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" +"checksum rand_os 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f46fbd5550acf75b0c2730f5dd1873751daf9beb8f11b44027778fae50d7feca" "checksum rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "086bd09a33c7044e56bb44d5bdde5a60e7f119a9e95b0775f545de759a32fe05" -"checksum rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "effa3fcaa47e18db002bdde6060944b6d2f9cfd8db471c30e873448ad9187be3" -"checksum redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "a84bcd297b87a545980a2d25a0beb72a1f490c31f0a9fde52fca35bfbb1ceb70" +"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" +"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +"checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum redox_users 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "214a97e49be64fd2c86f568dd0cb2c757d2cc53de95b273b6ad0a1c908482f26" "checksum regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384" @@ -1451,7 +1451,7 @@ dependencies = [ "checksum regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7" "checksum regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4e47a2ed29da7a9e1960e1639e7a982e6edc6d49be308a3b02daf511504a16d1" "checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" -"checksum rustc-demangle 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "01b90379b8664dd83460d59bdc5dd1fd3172b8913788db483ed1325171eab2f7" +"checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" "checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267" @@ -1460,14 +1460,11 @@ dependencies = [ "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)" = "157e12af46859e968da75dea9845530e13d03bcab2009a41b9b7bb3cf4eb3ec2" -"checksum serde_derive 1.0.83 (registry+https://github.com/rust-lang/crates.io-index)" = "9469829702497daf2daf3c190e130c3fa72f719920f73c86160d43e8f8d76951" +"checksum serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)" = "0e732ed5a5592c17d961555e3b552985baf98d50ce418b7b655f31f6ba7eb1b7" +"checksum serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d6115a3ca25c224e409185325afc16a0d5aaaabc15c42b09587d6f1ba39a5b" "checksum serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "190e9765dcedb56be63b6e0993a006c7e3b071a016a304736e4a315dc01fb142" -"checksum serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "c37ccd6be3ed1fdf419ee848f7c758eb31b054d7cd3ae3600e3bae0adf569811" +"checksum serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)" = "bdf540260cfee6da923831f4776ddc495ada940c30117977c70f1313a6130545" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" -"checksum slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e1a2eec401952cd7b12a84ea120e2d57281329940c3f93c2bf04f462539508e" -"checksum slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e544d16c6b230d84c866662fe55e31aacfca6ae71e6fc49ae9a311cb379bfc2f" -"checksum slog-term 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5951a808c40f419922ee014c15b6ae1cd34d963538b57d8a4778b9ca3fff1e0b" "checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db" "checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" @@ -1475,20 +1472,19 @@ dependencies = [ "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "670ad348dc73012fcf78c71f06f9d942232cdd4c859d4b6975e27836c3efc0c3" "checksum structopt-derive 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "ef98172b1a00b0bec738508d3726540edcbd186d50dfd326f2b1febbb3559f04" -"checksum syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9545a6a093a3f0bd59adb472700acc08cad3776f860f16a897dfce8c88721cbc" +"checksum syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)" = "734ecc29cd36e8123850d9bf21dfd62ef8300aaa8f879aabaa899721808be37c" "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" -"checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" "checksum tar 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "a303ba60a099fcd2aaa646b14d2724591a96a75283e4b7ed3d1a1658909d9ae2" "checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" "checksum tempfile 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "11ce2fe9db64b842314052e2421ac61a73ce41b898dc8e3750398b219c5fc1e0" "checksum tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7e91405c14320e5c79b3d148e1c86f40749a36e490642202a31689cb1a3452b2" -"checksum term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5e6b677dd1e8214ea1ef4297f85dbcbed8e8cdddb561040cc998ca2551c37561" "checksum termcolor 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "adc4587ead41bf016f11af03e55a624c06568b5a19db4e90fde573d805074f83" +"checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" "checksum termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72b620c5ea021d75a735c943269bb07d30c9b77d6ac6b236bc8b5c496ef05625" "checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" -"checksum time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "847da467bf0db05882a9e2375934a8a55cffdc9db0d128af1518200260ba1f6c" +"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" "checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" "checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1" @@ -1510,5 +1506,6 @@ dependencies = [ "checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum wincolor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eeb06499a3a4d44302791052df005d5232b927ed1a9658146d842165c4de7767" +"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" "checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" "checksum zip 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "00acf1fafb786ff450b6726e5be41ef029142597b47a40ce80f952f1471730a0" diff --git a/Cargo.toml b/Cargo.toml index dcf45e9..69b21b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,21 +14,23 @@ atty = "0.2.11" cargo_metadata = "0.6.0" console = "0.6.1" dialoguer = "0.3.0" +curl = "0.4.13" +dirs = "1.0.4" +env_logger = { version = "0.5.13", default-features = false } failure = "0.1.2" human-panic = "1.0.1" glob = "0.2" indicatif = "0.9.0" lazy_static = "1.1.0" +log = "0.4.6" openssl = { version = '0.10.11', optional = true } parking_lot = "0.6" serde = "1.0.74" serde_derive = "1.0.74" serde_ignored = "0.0.4" serde_json = "1.0.26" -slog = "2.3" -slog-term = "2.4" -slog-async = "2.3" strsim = "0.8.0" +siphasher = "0.2.3" structopt = "0.2" toml = "0.4" which = "2.0.0" diff --git a/src/bindgen.rs b/src/bindgen.rs index 0a84950..c2ad7b2 100644 --- a/src/bindgen.rs +++ b/src/bindgen.rs @@ -4,9 +4,10 @@ use child; use command::build::BuildProfile; use emoji; use failure::{self, ResultExt}; +use log::debug; +use log::{info, warn}; use manifest::CrateData; use progressbar::Step; -use slog::Logger; use std::fs; use std::path::{Path, PathBuf}; use std::process::Command; @@ -26,7 +27,6 @@ pub fn install_wasm_bindgen( version: &str, install_permitted: bool, step: &Step, - log: &Logger, ) -> Result { // If `wasm-bindgen` is installed globally and it has the right version, use // that. Assume that other tools are installed next to it. @@ -34,12 +34,8 @@ pub fn install_wasm_bindgen( // This situation can arise if `wasm-bindgen` is already installed via // `cargo install`, for example. if let Ok(path) = which("wasm-bindgen") { - debug!( - log, - "found global wasm-bindgen binary at: {}", - path.display() - ); - if wasm_bindgen_version_check(&path, version, log) { + debug!("found global wasm-bindgen binary at: {}", path.display()); + if wasm_bindgen_version_check(&path, version) { return Ok(Download::at(path.parent().unwrap())); } } @@ -52,14 +48,13 @@ pub fn install_wasm_bindgen( Ok(dl) => return Ok(dl), Err(e) => { warn!( - log, "could not download pre-built `wasm-bindgen`: {}. Falling back to `cargo install`.", e ); } } - cargo_install_wasm_bindgen(log, &cache, version, install_permitted) + cargo_install_wasm_bindgen(&cache, version, install_permitted) } /// Downloads a precompiled copy of wasm-bindgen, if available. @@ -102,7 +97,6 @@ fn prebuilt_url(version: &str) -> Option { /// Use `cargo install` to install the `wasm-bindgen` CLI locally into the given /// crate. pub fn cargo_install_wasm_bindgen( - logger: &Logger, cache: &Cache, version: &str, install_permitted: bool, @@ -132,7 +126,7 @@ pub fn cargo_install_wasm_bindgen( .arg("--root") .arg(&tmp); - child::run(logger, cmd, "cargo install").context("Installing wasm-bindgen with cargo")?; + child::run(cmd, "cargo install").context("Installing wasm-bindgen with cargo")?; fs::rename(&tmp, &destination)?; Ok(Download::at(&destination)) @@ -148,7 +142,6 @@ pub fn wasm_bindgen_build( target: &str, profile: BuildProfile, step: &Step, - log: &Logger, ) -> Result<(), failure::Error> { let msg = format!("{}Running WASM-bindgen...", emoji::RUNNER); PBAR.step(step, &msg); @@ -196,15 +189,15 @@ pub fn wasm_bindgen_build( cmd.arg("--keep-debug"); } - child::run(log, cmd, "wasm-bindgen").context("Running the wasm-bindgen CLI")?; + child::run(cmd, "wasm-bindgen").context("Running the wasm-bindgen CLI")?; Ok(()) } /// Check if the `wasm-bindgen` dependency is locally satisfied. -fn wasm_bindgen_version_check(bindgen_path: &PathBuf, dep_version: &str, log: &Logger) -> bool { +fn wasm_bindgen_version_check(bindgen_path: &PathBuf, dep_version: &str) -> bool { let mut cmd = Command::new(bindgen_path); cmd.arg("--version"); - child::run(log, cmd, "wasm-bindgen") + child::run(cmd, "wasm-bindgen") .map(|stdout| { stdout .trim() @@ -212,10 +205,8 @@ fn wasm_bindgen_version_check(bindgen_path: &PathBuf, dep_version: &str, log: &L .nth(1) .map(|v| { info!( - log, "Checking installed `wasm-bindgen` version == expected version: {} == {}", - v, - dep_version + v, dep_version ); v == dep_version }) diff --git a/src/build.rs b/src/build.rs index 4628d37..e240c43 100644 --- a/src/build.rs +++ b/src/build.rs @@ -5,7 +5,6 @@ use command::build::BuildProfile; use emoji; use failure::{Error, ResultExt}; use progressbar::Step; -use slog::Logger; use std::path::Path; use std::process::Command; use std::str; @@ -52,23 +51,17 @@ fn rustc_minor_version() -> Option { /// Ensure that `rustup` has the `wasm32-unknown-unknown` target installed for /// current toolchain -pub fn rustup_add_wasm_target(log: &Logger, step: &Step) -> Result<(), Error> { +pub fn rustup_add_wasm_target(step: &Step) -> Result<(), Error> { let msg = format!("{}Adding WASM target...", emoji::TARGET); PBAR.step(step, &msg); let mut cmd = Command::new("rustup"); cmd.arg("target").arg("add").arg("wasm32-unknown-unknown"); - child::run(log, cmd, "rustup") - .context("Adding the wasm32-unknown-unknown target with rustup")?; + child::run(cmd, "rustup").context("Adding the wasm32-unknown-unknown target with rustup")?; Ok(()) } /// Run `cargo build` targetting `wasm32-unknown-unknown`. -pub fn cargo_build_wasm( - log: &Logger, - path: &Path, - profile: BuildProfile, - step: &Step, -) -> Result<(), Error> { +pub fn cargo_build_wasm(path: &Path, profile: BuildProfile, step: &Step) -> Result<(), Error> { let msg = format!("{}Compiling to WASM...", emoji::CYCLONE); PBAR.step(step, &msg); let mut cmd = Command::new("cargo"); @@ -91,18 +84,18 @@ pub fn cargo_build_wasm( } } cmd.arg("--target").arg("wasm32-unknown-unknown"); - child::run(log, cmd, "cargo build").context("Compiling your crate to WebAssembly failed")?; + child::run(cmd, "cargo build").context("Compiling your crate to WebAssembly failed")?; Ok(()) } /// Run `cargo build --tests` targetting `wasm32-unknown-unknown`. -pub fn cargo_build_wasm_tests(log: &Logger, path: &Path, debug: bool) -> Result<(), Error> { +pub fn cargo_build_wasm_tests(path: &Path, debug: bool) -> Result<(), Error> { let mut cmd = Command::new("cargo"); cmd.current_dir(path).arg("build").arg("--tests"); if !debug { cmd.arg("--release"); } cmd.arg("--target").arg("wasm32-unknown-unknown"); - child::run(log, cmd, "cargo build").context("Compilation of your program failed")?; + child::run(cmd, "cargo build").context("Compilation of your program failed")?; Ok(()) } diff --git a/src/child.rs b/src/child.rs index 72c8e87..6558ebd 100644 --- a/src/child.rs +++ b/src/child.rs @@ -4,7 +4,7 @@ //! properly logged and their output is logged as well. use failure::Error; -use slog::Logger; +use log::info; use std::{ io::{self, Read}, mem, @@ -133,8 +133,8 @@ where } /// Run the given command and return its stdout. -pub fn run(logger: &Logger, mut command: Command, command_name: &str) -> Result { - info!(logger, "Running {:?}", command); +pub fn run(mut command: Command, command_name: &str) -> Result { + info!("Running {:?}", command); let mut child = command .stdout(Stdio::piped()) @@ -158,11 +158,11 @@ pub fn run(logger: &Logger, mut command: Command, command_name: &str) -> Result< thread::spawn(move || read_and_send(stderr, stderr_send, OutputFragment::Stderr)); let mut stdout = OutputAccumulator::new(|line| { - info!(logger, "{} (stdout): {}", command_name, line); + info!("{} (stdout): {}", command_name, line); PBAR.message(line) }); let mut stderr = OutputAccumulator::new(|line| { - info!(logger, "{} (stderr): {}", command_name, line); + info!("{} (stderr): {}", command_name, line); PBAR.message(line) }); diff --git a/src/command/build.rs b/src/command/build.rs index 9a5a152..4b1efa4 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -8,10 +8,10 @@ use failure::Error; use indicatif::HumanDuration; use license; use lockfile::Lockfile; +use log::info; use manifest; use progressbar::Step; use readme; -use slog::Logger; use std::path::PathBuf; use std::str::FromStr; use std::time::Instant; @@ -139,7 +139,7 @@ impl Default for BuildOptions { } } -type BuildStep = fn(&mut Build, &Step, &Logger) -> Result<(), Error>; +type BuildStep = fn(&mut Build, &Step) -> Result<(), Error>; impl Build { /// Construct a build command from the given options. @@ -184,7 +184,7 @@ impl Build { } /// Execute this `Build` command. - pub fn run(&mut self, log: &Logger) -> Result<(), Error> { + pub fn run(&mut self) -> Result<(), Error> { let process_steps = Build::get_process_steps(&self.mode); let mut step_counter = Step::new(process_steps.len()); @@ -192,14 +192,13 @@ impl Build { let started = Instant::now(); for (_, process_step) in process_steps { - process_step(self, &step_counter, log)?; + process_step(self, &step_counter)?; step_counter.inc(); } let duration = HumanDuration(started.elapsed()); - info!(&log, "Done in {}.", &duration); + info!("Done in {}.", &duration); info!( - &log, "Your wasm pkg is ready to publish at {}.", self.out_dir.display() ); @@ -259,34 +258,33 @@ impl Build { } } - fn step_check_rustc_version(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { - info!(&log, "Checking rustc version..."); + fn step_check_rustc_version(&mut self, step: &Step) -> Result<(), Error> { + info!("Checking rustc version..."); let version = build::check_rustc_version(step)?; let msg = format!("rustc version is {}.", version); - info!(&log, "{}", &msg); + info!("{}", &msg); Ok(()) } - fn step_check_crate_config(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { - info!(&log, "Checking crate configuration..."); + fn step_check_crate_config(&mut self, step: &Step) -> Result<(), Error> { + info!("Checking crate configuration..."); self.crate_data.check_crate_config(step)?; - info!(&log, "Crate is correctly configured."); + info!("Crate is correctly configured."); Ok(()) } - fn step_add_wasm_target(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { - info!(&log, "Adding wasm-target..."); - build::rustup_add_wasm_target(log, step)?; - info!(&log, "Adding wasm-target was successful."); + fn step_add_wasm_target(&mut self, step: &Step) -> Result<(), Error> { + info!("Adding wasm-target..."); + build::rustup_add_wasm_target(step)?; + info!("Adding wasm-target was successful."); Ok(()) } - fn step_build_wasm(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { - info!(&log, "Building wasm..."); - build::cargo_build_wasm(log, &self.crate_path, self.profile, step)?; + fn step_build_wasm(&mut self, step: &Step) -> Result<(), Error> { + info!("Building wasm..."); + build::cargo_build_wasm(&self.crate_path, self.profile, step)?; info!( - &log, "wasm built at {:#?}.", &self .crate_path @@ -297,15 +295,15 @@ impl Build { Ok(()) } - fn step_create_dir(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { - info!(&log, "Creating a pkg directory..."); + fn step_create_dir(&mut self, step: &Step) -> Result<(), Error> { + info!("Creating a pkg directory..."); create_pkg_dir(&self.out_dir, step)?; - info!(&log, "Created a pkg directory at {:#?}.", &self.crate_path); + info!("Created a pkg directory at {:#?}.", &self.crate_path); Ok(()) } - fn step_create_json(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { - info!(&log, "Writing a package.json..."); + fn step_create_json(&mut self, step: &Step) -> Result<(), Error> { + info!("Writing a package.json..."); self.crate_data.write_package_json( &self.out_dir, &self.scope, @@ -314,55 +312,45 @@ impl Build { step, )?; info!( - &log, "Wrote a package.json at {:#?}.", &self.out_dir.join("package.json") ); Ok(()) } - fn step_copy_readme(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { - info!(&log, "Copying readme from crate..."); + fn step_copy_readme(&mut self, step: &Step) -> Result<(), Error> { + info!("Copying readme from crate..."); readme::copy_from_crate(&self.crate_path, &self.out_dir, step)?; - info!(&log, "Copied readme from crate to {:#?}.", &self.out_dir); + info!("Copied readme from crate to {:#?}.", &self.out_dir); Ok(()) } - fn step_copy_license(&mut self, step: &Step, log: &Logger) -> Result<(), failure::Error> { - info!(&log, "Copying license from crate..."); + fn step_copy_license(&mut self, step: &Step) -> Result<(), failure::Error> { + info!("Copying license from crate..."); license::copy_from_crate(&self.crate_data, &self.crate_path, &self.out_dir, step)?; - info!(&log, "Copied license from crate to {:#?}.", &self.out_dir); + info!("Copied license from crate to {:#?}.", &self.out_dir); Ok(()) } - fn step_install_wasm_bindgen( - &mut self, - step: &Step, - log: &Logger, - ) -> Result<(), failure::Error> { - info!(&log, "Identifying wasm-bindgen dependency..."); + fn step_install_wasm_bindgen(&mut self, step: &Step) -> Result<(), failure::Error> { + info!("Identifying wasm-bindgen dependency..."); let lockfile = Lockfile::new(&self.crate_data)?; let bindgen_version = lockfile.require_wasm_bindgen()?; - info!(&log, "Installing wasm-bindgen-cli..."); + info!("Installing wasm-bindgen-cli..."); let install_permitted = match self.mode { BuildMode::Normal => true, BuildMode::Force => true, BuildMode::Noinstall => false, }; - let bindgen = bindgen::install_wasm_bindgen( - &self.cache, - &bindgen_version, - install_permitted, - step, - log, - )?; + let bindgen = + bindgen::install_wasm_bindgen(&self.cache, &bindgen_version, install_permitted, step)?; self.bindgen = Some(bindgen); - info!(&log, "Installing wasm-bindgen-cli was successful."); + info!("Installing wasm-bindgen-cli was successful."); Ok(()) } - fn step_run_wasm_bindgen(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { - info!(&log, "Building the wasm bindings..."); + fn step_run_wasm_bindgen(&mut self, step: &Step) -> Result<(), Error> { + info!("Building the wasm bindings..."); bindgen::wasm_bindgen_build( &self.crate_data, self.bindgen.as_ref().unwrap(), @@ -371,9 +359,8 @@ impl Build { &self.target, self.profile, step, - log, )?; - info!(&log, "wasm bindings were built at {:#?}.", &self.out_dir); + info!("wasm bindings were built at {:#?}.", &self.out_dir); Ok(()) } } diff --git a/src/command/login.rs b/src/command/login.rs index a660cb9..0ee09c3 100644 --- a/src/command/login.rs +++ b/src/command/login.rs @@ -1,5 +1,5 @@ +use log::info; use npm; -use slog::Logger; use std::result; use PBAR; @@ -8,22 +8,17 @@ pub fn login( scope: Option, always_auth: bool, auth_type: Option, - log: &Logger, ) -> result::Result<(), failure::Error> { let registry = registry.unwrap_or(npm::DEFAULT_NPM_REGISTRY.to_string()); - info!(&log, "Logging in to npm..."); + info!("Logging in to npm..."); info!( - &log, "Scope: {:?} Registry: {}, Always Auth: {}, Auth Type: {:?}.", - &scope, - ®istry, - always_auth, - &auth_type + &scope, ®istry, always_auth, &auth_type ); - info!(&log, "npm info located in the npm debug log"); - npm::npm_login(log, ®istry, &scope, always_auth, &auth_type)?; - info!(&log, "Logged you in!"); + info!("npm info located in the npm debug log"); + npm::npm_login(®istry, &scope, always_auth, &auth_type)?; + info!("Logged you in!"); PBAR.message(&format!("👋 logged you in!")); Ok(()) diff --git a/src/command/mod.rs b/src/command/mod.rs index 06353ec..86a8235 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -14,7 +14,7 @@ use self::pack::pack; use self::publish::{access::Access, publish}; use self::test::{Test, TestOptions}; use failure::Error; -use slog::Logger; +use log::info; use std::path::PathBuf; use std::result; @@ -87,27 +87,27 @@ pub enum Command { } /// Run a command with the given logger! -pub fn run_wasm_pack(command: Command, log: &Logger) -> result::Result<(), Error> { +pub fn run_wasm_pack(command: Command) -> result::Result<(), Error> { // Run the correct command based off input and store the result of it so that we can clear // the progress bar then return it let status = match command { Command::Build(build_opts) => { - info!(&log, "Running build command..."); - Build::try_from_opts(build_opts).and_then(|mut b| b.run(&log)) + info!("Running build command..."); + Build::try_from_opts(build_opts).and_then(|mut b| b.run()) } Command::Pack { path } => { - info!(&log, "Running pack command..."); - info!(&log, "Path: {:?}", &path); - pack(path, &log) + info!("Running pack command..."); + info!("Path: {:?}", &path); + pack(path) } Command::Publish { target, path, access, } => { - info!(&log, "Running publish command..."); - info!(&log, "Path: {:?}", &path); - publish(target, path, access, &log) + info!("Running publish command..."); + info!("Path: {:?}", &path); + publish(target, path, access) } Command::Login { registry, @@ -115,20 +115,16 @@ pub fn run_wasm_pack(command: Command, log: &Logger) -> result::Result<(), Error always_auth, auth_type, } => { - info!(&log, "Running login command..."); + info!("Running login command..."); info!( - &log, "Registry: {:?}, Scope: {:?}, Always Auth: {}, Auth Type: {:?}", - ®istry, - &scope, - &always_auth, - &auth_type + ®istry, &scope, &always_auth, &auth_type ); - login(registry, scope, always_auth, auth_type, &log) + login(registry, scope, always_auth, auth_type) } Command::Test(test_opts) => { - info!(&log, "Running test command..."); - Test::try_from_opts(test_opts).and_then(|t| t.run(&log)) + info!("Running test command..."); + Test::try_from_opts(test_opts).and_then(|t| t.run()) } }; diff --git a/src/command/pack.rs b/src/command/pack.rs index d9f7055..5ede602 100644 --- a/src/command/pack.rs +++ b/src/command/pack.rs @@ -1,17 +1,17 @@ use command::utils::{find_pkg_directory, set_crate_path}; use failure::Error; +use log::info; use npm; -use slog::Logger; use std::path::PathBuf; use std::result; use PBAR; /// Executes the 'npm pack' command on the 'pkg' directory /// which creates a tarball that can be published to the NPM registry -pub fn pack(path: Option, log: &Logger) -> result::Result<(), Error> { +pub fn pack(path: Option) -> result::Result<(), Error> { let crate_path = set_crate_path(path)?; - info!(&log, "Packing up the npm package..."); + info!("Packing up the npm package..."); let pkg_directory = find_pkg_directory(&crate_path).ok_or_else(|| { format_err!( "Unable to find the pkg directory at path {:#?}, or in a child directory of {:#?}", @@ -19,12 +19,8 @@ pub fn pack(path: Option, log: &Logger) -> result::Result<(), Error> { &crate_path ) })?; - npm::npm_pack(log, &pkg_directory.to_string_lossy())?; - info!( - &log, - "Your package is located at {:#?}", - crate_path.join("pkg") - ); + npm::npm_pack(&pkg_directory.to_string_lossy())?; + info!("Your package is located at {:#?}", crate_path.join("pkg")); PBAR.message("🎒 packed up your package!"); Ok(()) diff --git a/src/command/publish/mod.rs b/src/command/publish/mod.rs index b2c0916..568104b 100644 --- a/src/command/publish/mod.rs +++ b/src/command/publish/mod.rs @@ -6,8 +6,8 @@ use command::build::{Build, BuildOptions}; use command::utils::{find_pkg_directory, set_crate_path}; use dialoguer::{Confirmation, Input, Select}; use failure::Error; +use log::info; use npm; -use slog::Logger; use std::path::PathBuf; use std::result; use PBAR; @@ -18,12 +18,11 @@ pub fn publish( _target: String, path: Option, access: Option, - log: &Logger, ) -> result::Result<(), Error> { let crate_path = set_crate_path(path)?; - info!(&log, "Publishing the npm package..."); - info!(&log, "npm info located in the npm debug log"); + info!("Publishing the npm package..."); + info!("npm info located in the npm debug log"); let pkg_directory = match find_pkg_directory(&crate_path) { Some(path) => Ok(path), @@ -53,7 +52,7 @@ pub fn publish( ..Default::default() }; Build::try_from_opts(build_opts) - .and_then(|mut build| build.run(&log)) + .and_then(|mut build| build.run()) .map(|()| crate_path.join(out_dir)) .map_err(|_| { format_err!( @@ -73,8 +72,8 @@ pub fn publish( } } }?; - npm::npm_publish(log, &pkg_directory.to_string_lossy(), access)?; - info!(&log, "Published your package!"); + npm::npm_publish(&pkg_directory.to_string_lossy(), access)?; + info!("Published your package!"); PBAR.message("💥 published your package!"); Ok(()) diff --git a/src/command/test.rs b/src/command/test.rs index 81e5c2b..99c95e2 100644 --- a/src/command/test.rs +++ b/src/command/test.rs @@ -9,9 +9,9 @@ use emoji; use failure::Error; use indicatif::HumanDuration; use lockfile::Lockfile; +use log::info; use manifest; use progressbar::Step; -use slog::Logger; use std::path::PathBuf; use std::time::Instant; use test::{self, webdriver}; @@ -97,7 +97,7 @@ pub struct Test { test_runner_path: Option, } -type TestStep = fn(&mut Test, &Step, &Logger) -> Result<(), Error>; +type TestStep = fn(&mut Test, &Step) -> Result<(), Error>; impl Test { /// Construct a test command from the given options. @@ -155,17 +155,17 @@ impl Test { } /// Execute this test command. - pub fn run(mut self, log: &Logger) -> Result<(), Error> { + pub fn run(mut self) -> Result<(), Error> { let process_steps = self.get_process_steps(); let mut step_counter = Step::new(process_steps.len()); let started = Instant::now(); for (_, process_step) in process_steps { - process_step(&mut self, &step_counter, log)?; + process_step(&mut self, &step_counter)?; step_counter.inc(); } let duration = HumanDuration(started.elapsed()); - info!(&log, "Done in {}.", &duration); + info!("Done in {}.", &duration); Ok(()) } @@ -225,34 +225,34 @@ impl Test { } } - fn step_check_rustc_version(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { - info!(log, "Checking rustc version..."); + fn step_check_rustc_version(&mut self, step: &Step) -> Result<(), Error> { + info!("Checking rustc version..."); let _ = build::check_rustc_version(step)?; - info!(log, "Rustc version is correct."); + info!("Rustc version is correct."); Ok(()) } - fn step_add_wasm_target(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { - info!(&log, "Adding wasm-target..."); - build::rustup_add_wasm_target(log, step)?; - info!(&log, "Adding wasm-target was successful."); + fn step_add_wasm_target(&mut self, step: &Step) -> Result<(), Error> { + info!("Adding wasm-target..."); + build::rustup_add_wasm_target(step)?; + info!("Adding wasm-target was successful."); Ok(()) } - fn step_build_tests(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { - info!(log, "Compiling tests to wasm..."); + fn step_build_tests(&mut self, step: &Step) -> Result<(), Error> { + info!("Compiling tests to wasm..."); let msg = format!("{}Compiling tests to WASM...", emoji::CYCLONE); PBAR.step(step, &msg); - build::cargo_build_wasm_tests(log, &self.crate_path, !self.release)?; + build::cargo_build_wasm_tests(&self.crate_path, !self.release)?; - info!(log, "Finished compiling tests to wasm."); + info!("Finished compiling tests to wasm."); Ok(()) } - fn step_install_wasm_bindgen(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { - info!(&log, "Identifying wasm-bindgen dependency..."); + fn step_install_wasm_bindgen(&mut self, step: &Step) -> Result<(), Error> { + info!("Identifying wasm-bindgen dependency..."); let lockfile = Lockfile::new(&self.crate_data)?; let bindgen_version = lockfile.require_wasm_bindgen()?; @@ -272,51 +272,45 @@ impl Test { let install_permitted = match self.mode { BuildMode::Normal => { - info!(&log, "Ensuring wasm-bindgen-cli is installed..."); + info!("Ensuring wasm-bindgen-cli is installed..."); true } BuildMode::Force => { - info!(&log, "Ensuring wasm-bindgen-cli is installed..."); + info!("Ensuring wasm-bindgen-cli is installed..."); true } BuildMode::Noinstall => { - info!(&log, "Searching for existing wasm-bindgen-cli install..."); + info!("Searching for existing wasm-bindgen-cli install..."); false } }; - let dl = bindgen::install_wasm_bindgen( - &self.cache, - &bindgen_version, - install_permitted, - step, - log, - )?; + let dl = + bindgen::install_wasm_bindgen(&self.cache, &bindgen_version, install_permitted, step)?; self.test_runner_path = Some(dl.binary("wasm-bindgen-test-runner")); - info!(&log, "Getting wasm-bindgen-cli was successful."); + info!("Getting wasm-bindgen-cli was successful."); Ok(()) } - fn step_test_node(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { + fn step_test_node(&mut self, step: &Step) -> Result<(), Error> { assert!(self.node); - info!(log, "Running tests in node..."); + info!("Running tests in node..."); PBAR.step(step, "Running tests in node..."); test::cargo_test_wasm( &self.crate_path, self.release, - log, Some(( "CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER", &self.test_runner_path.as_ref().unwrap(), )), )?; - info!(log, "Finished running tests in node."); + info!("Finished running tests in node."); Ok(()) } - fn step_get_chromedriver(&mut self, step: &Step, _log: &Logger) -> Result<(), Error> { + fn step_get_chromedriver(&mut self, step: &Step) -> Result<(), Error> { PBAR.step(step, "Getting chromedriver..."); assert!(self.chrome && self.chromedriver.is_none()); @@ -327,14 +321,14 @@ impl Test { Ok(()) } - fn step_test_chrome(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { + fn step_test_chrome(&mut self, step: &Step) -> Result<(), Error> { PBAR.step(step, "Running tests in Chrome..."); let chromedriver = self.chromedriver.as_ref().unwrap().display().to_string(); let chromedriver = chromedriver.as_str(); info!( - log, - "Running tests in Chrome with chromedriver at {}", chromedriver + "Running tests in Chrome with chromedriver at {}", + chromedriver ); let test_runner = self @@ -344,7 +338,7 @@ impl Test { .display() .to_string(); let test_runner = test_runner.as_str(); - info!(log, "Using wasm-bindgen test runner at {}", test_runner); + info!("Using wasm-bindgen test runner at {}", test_runner); let mut envs = vec![ ("CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER", test_runner), @@ -354,11 +348,11 @@ impl Test { envs.push(("NO_HEADLESS", "1")); } - test::cargo_test_wasm(&self.crate_path, self.release, log, envs)?; + test::cargo_test_wasm(&self.crate_path, self.release, envs)?; Ok(()) } - fn step_get_geckodriver(&mut self, step: &Step, _log: &Logger) -> Result<(), Error> { + fn step_get_geckodriver(&mut self, step: &Step) -> Result<(), Error> { PBAR.step(step, "Getting geckodriver..."); assert!(self.firefox && self.geckodriver.is_none()); @@ -369,14 +363,14 @@ impl Test { Ok(()) } - fn step_test_firefox(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { + fn step_test_firefox(&mut self, step: &Step) -> Result<(), Error> { PBAR.step(step, "Running tests in Firefox..."); let geckodriver = self.geckodriver.as_ref().unwrap().display().to_string(); let geckodriver = geckodriver.as_str(); info!( - log, - "Running tests in Firefox with geckodriver at {}", geckodriver + "Running tests in Firefox with geckodriver at {}", + geckodriver ); let test_runner = self @@ -386,7 +380,7 @@ impl Test { .display() .to_string(); let test_runner = test_runner.as_str(); - info!(log, "Using wasm-bindgen test runner at {}", test_runner); + info!("Using wasm-bindgen test runner at {}", test_runner); let mut envs = vec![ ("CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER", test_runner), @@ -396,11 +390,11 @@ impl Test { envs.push(("NO_HEADLESS", "1")); } - test::cargo_test_wasm(&self.crate_path, self.release, log, envs)?; + test::cargo_test_wasm(&self.crate_path, self.release, envs)?; Ok(()) } - fn step_get_safaridriver(&mut self, step: &Step, _log: &Logger) -> Result<(), Error> { + fn step_get_safaridriver(&mut self, step: &Step) -> Result<(), Error> { PBAR.step(step, "Getting safaridriver..."); assert!(self.safari && self.safaridriver.is_none()); @@ -408,14 +402,14 @@ impl Test { Ok(()) } - fn step_test_safari(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { + fn step_test_safari(&mut self, step: &Step) -> Result<(), Error> { PBAR.step(step, "Running tests in Safari..."); let safaridriver = self.safaridriver.as_ref().unwrap().display().to_string(); let safaridriver = safaridriver.as_str(); info!( - log, - "Running tests in Safari with safaridriver at {}", safaridriver + "Running tests in Safari with safaridriver at {}", + safaridriver ); let test_runner = self @@ -425,7 +419,7 @@ impl Test { .display() .to_string(); let test_runner = test_runner.as_str(); - info!(log, "Using wasm-bindgen test runner at {}", test_runner); + info!("Using wasm-bindgen test runner at {}", test_runner); let mut envs = vec![ ("CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER", test_runner), @@ -435,7 +429,7 @@ impl Test { envs.push(("NO_HEADLESS", "1")); } - test::cargo_test_wasm(&self.crate_path, self.release, log, envs)?; + test::cargo_test_wasm(&self.crate_path, self.release, envs)?; Ok(()) } } diff --git a/src/lib.rs b/src/lib.rs index 901e1a3..0f0e4a0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -20,11 +20,8 @@ extern crate serde_ignored; extern crate serde_json; #[macro_use] extern crate structopt; -#[macro_use] -extern crate slog; extern crate dialoguer; -extern crate slog_async; -extern crate slog_term; +extern crate log; extern crate toml; extern crate walkdir; extern crate wasm_pack_binary_install; @@ -36,7 +33,6 @@ pub mod command; pub mod emoji; pub mod license; pub mod lockfile; -pub mod logger; pub mod manifest; pub mod npm; pub mod progressbar; diff --git a/src/logger.rs b/src/logger.rs deleted file mode 100644 index 08add5d..0000000 --- a/src/logger.rs +++ /dev/null @@ -1,76 +0,0 @@ -//! Logging facilities for `wasm-pack`. - -use command::Command; -use failure; -use slog::{Drain, Level, Logger}; -use slog_async::Async; -use slog_term::{FullFormat, PlainDecorator}; -use std::fs::OpenOptions; -use std::path::PathBuf; - -/// Create the logger for wasm-pack that will output any info warning or errors we encounter -pub fn new(cmd: &Command, verbosity: u8) -> Result { - let log_path = log_file_path(&cmd); - let file = OpenOptions::new() - .create(true) - .append(true) - .open(log_path)?; - - let decorator = PlainDecorator::new(file); - let drain = FullFormat::new(decorator).build().fuse(); - - // Set the log level based off the number of v passed in to the command line args. - // Level level means only messages of that level and higher are logged. If we have - // an error then we'll log it unconditionally, but extra levels are only available - // with extra v - let log_level = match verbosity { - 0 => Level::Error, - 1 => Level::Info, - 2 => Level::Debug, - _ => Level::Trace, - }; - let drain = Async::new(drain).build().filter_level(log_level).fuse(); - Ok(Logger::root(drain, o!())) -} - -/// Figure out where to stick the log based off the command arguments given -fn log_file_path(cmd: &Command) -> PathBuf { - let path = match cmd { - Command::Build(build_opts) => &build_opts.path, - Command::Pack { path } => path, - Command::Publish { - target: _, - path, - access: _, - } => path, - Command::Test(test_opts) => &test_opts.path, - Command::Login { .. } => &None, - }; - - // If the path exists attempt to use it, if not default to the current directory - if let Some(ref path) = path { - let mut path_buf = PathBuf::from(path); - path_buf.push("Cargo.toml"); - - // If the manifest file exists put the log in that directory otherwise default - // to the current directory. - if path_buf.exists() { - path_buf.pop(); - path_buf.push("wasm-pack.log"); - path_buf - } else { - let mut path_buf = this_dir(); - path_buf.push("wasm-pack.log"); - path_buf - } - } else { - let mut path_buf = this_dir(); - path_buf.push("wasm-pack.log"); - path_buf - } -} - -/// Return a `PathBuf` for the current directory -fn this_dir() -> PathBuf { - PathBuf::from(".") -} diff --git a/src/main.rs b/src/main.rs index 0af8296..26698a2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ extern crate atty; +extern crate env_logger; #[macro_use] extern crate failure; #[macro_use] @@ -9,11 +10,12 @@ extern crate which; use std::env; use structopt::StructOpt; -use wasm_pack::{command::run_wasm_pack, logger, Cli}; +use wasm_pack::{command::run_wasm_pack, Cli}; mod installer; fn main() { + env_logger::init(); setup_panic!(); if let Err(e) = run() { eprintln!("Error: {}", e); @@ -39,7 +41,6 @@ fn run() -> Result<(), failure::Error> { } let args = Cli::from_args(); - let log = logger::new(&args.cmd, args.verbosity)?; - run_wasm_pack(args.cmd, &log)?; + run_wasm_pack(args.cmd)?; Ok(()) } diff --git a/src/npm.rs b/src/npm.rs index 74a0250..d99732f 100644 --- a/src/npm.rs +++ b/src/npm.rs @@ -3,21 +3,21 @@ use child; use command::publish::access::Access; use failure::{self, ResultExt}; -use slog::Logger; +use log::info; /// The default npm registry used when we aren't working with a custom registry. pub const DEFAULT_NPM_REGISTRY: &'static str = "https://registry.npmjs.org/"; /// Run the `npm pack` command. -pub fn npm_pack(log: &Logger, path: &str) -> Result<(), failure::Error> { +pub fn npm_pack(path: &str) -> Result<(), failure::Error> { let mut cmd = child::new_command("npm"); cmd.current_dir(path).arg("pack"); - child::run(log, cmd, "npm pack").context("Packaging up your code failed")?; + child::run(cmd, "npm pack").context("Packaging up your code failed")?; Ok(()) } /// Run the `npm publish` command. -pub fn npm_publish(log: &Logger, path: &str, access: Option) -> Result<(), failure::Error> { +pub fn npm_publish(path: &str, access: Option) -> Result<(), failure::Error> { let mut cmd = child::new_command("npm"); match access { Some(a) => cmd @@ -27,13 +27,12 @@ pub fn npm_publish(log: &Logger, path: &str, access: Option) -> Result<( None => cmd.current_dir(path).arg("publish"), }; - child::run(log, cmd, "npm publish").context("Publishing to npm failed")?; + child::run(cmd, "npm publish").context("Publishing to npm failed")?; Ok(()) } /// Run the `npm login` command. pub fn npm_login( - log: &Logger, registry: &String, scope: &Option, always_auth: bool, @@ -58,7 +57,7 @@ pub fn npm_login( let mut cmd = child::new_command("npm"); cmd.args(args); - info!(log, "Running {:?}", cmd); + info!("Running {:?}", cmd); match cmd.status()?.success() { true => Ok(()), false => bail!("Login to registry {} failed", registry), diff --git a/src/test/mod.rs b/src/test/mod.rs index 1b71fed..0ec11e9 100644 --- a/src/test/mod.rs +++ b/src/test/mod.rs @@ -4,19 +4,14 @@ pub mod webdriver; use child; use failure::{self, ResultExt}; -use slog::Logger; +use log::info; use std::ffi::OsStr; use std::path::Path; use std::process::Command; /// Run `cargo test` with the `nightly` toolchain and targeting /// `wasm32-unknown-unknown`. -pub fn cargo_test_wasm( - path: &Path, - release: bool, - log: &Logger, - envs: I, -) -> Result<(), failure::Error> +pub fn cargo_test_wasm(path: &Path, release: bool, envs: I) -> Result<(), failure::Error> where I: IntoIterator, K: AsRef, @@ -30,12 +25,11 @@ where cmd.arg("--release"); } cmd.arg("--target").arg("wasm32-unknown-unknown"); - child::run(log, cmd, "cargo test") - .context("Running Wasm tests with wasm-bindgen-test failed")? + child::run(cmd, "cargo test").context("Running Wasm tests with wasm-bindgen-test failed")? }; for line in output.lines() { - info!(log, "test output: {}", line); + info!("test output: {}", line); println!("{}", line); } Ok(()) diff --git a/tests/all/main.rs b/tests/all/main.rs index 572d655..61875e0 100644 --- a/tests/all/main.rs +++ b/tests/all/main.rs @@ -4,8 +4,6 @@ extern crate lazy_static; #[macro_use] extern crate serde_derive; extern crate serde_json; -#[macro_use] -extern crate slog; extern crate structopt; extern crate tempfile; extern crate wasm_pack; diff --git a/tests/all/utils/fixture.rs b/tests/all/utils/fixture.rs index 0596873..2ed126e 100644 --- a/tests/all/utils/fixture.rs +++ b/tests/all/utils/fixture.rs @@ -1,4 +1,3 @@ -use super::logger::null_logger; use std::env; use std::fs; use std::mem::ManuallyDrop; @@ -170,7 +169,6 @@ impl Fixture { static INSTALL_WASM_BINDGEN: Once = ONCE_INIT; let cache = self.cache(); let version = "0.2.21"; - let log = &null_logger(); let download = || { if let Ok(download) = @@ -179,7 +177,7 @@ impl Fixture { return Ok(download); } - wasm_pack::bindgen::cargo_install_wasm_bindgen(log, &cache, version, true) + wasm_pack::bindgen::cargo_install_wasm_bindgen(&cache, version, true) }; // Only one thread can perform the actual download, and then afterwards @@ -243,18 +241,17 @@ impl Fixture { } pub fn run(&self, cmd: wasm_pack::command::Command) -> Result<(), failure::Error> { - let logger = wasm_pack::logger::new(&cmd, 3)?; match cmd { wasm_pack::command::Command::Test(cmd) => { let _lock = self.lock(); let mut test = wasm_pack::command::test::Test::try_from_opts(cmd)?; test.set_cache(self.cache()); - test.run(&logger) + test.run() } wasm_pack::command::Command::Build(cmd) => { let mut build = wasm_pack::command::build::Build::try_from_opts(cmd)?; build.set_cache(self.cache()); - build.run(&logger) + build.run() } _ => unreachable!(), } diff --git a/tests/all/utils/logger.rs b/tests/all/utils/logger.rs deleted file mode 100644 index 46cc0d7..0000000 --- a/tests/all/utils/logger.rs +++ /dev/null @@ -1,6 +0,0 @@ -use slog::Logger; - -// Create a logger that ignores log messages for testing. -pub fn null_logger() -> Logger { - Logger::root(slog::Discard, o!()) -} diff --git a/tests/all/utils/mod.rs b/tests/all/utils/mod.rs index 655b80d..8b4244f 100644 --- a/tests/all/utils/mod.rs +++ b/tests/all/utils/mod.rs @@ -1,4 +1,3 @@ pub mod file; pub mod fixture; -pub mod logger; pub mod manifest; From 9778194c3ec6ee4f04135af884577e343e629829 Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Mon, 14 Jan 2019 19:04:05 -0500 Subject: [PATCH 070/106] doc(logs): document env_logger setup --- README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b145e06..53af817 100644 --- a/README.md +++ b/README.md @@ -38,14 +38,15 @@ This project requires Rust 1.30.0 or later. ## 📝 Logging -We generate a `wasm-pack.log` file if `wasm-pack` errors on you, and you can -customize the log verbosity using the verbosity flag. - -| Verbosity | Result | -| ------------- |-----------------------------------------------------| -| -v | All Info, Warn, and Errors are logged | -| -vv | All Debug, Info, Warn, and Errors are logged | -| -vvv | All Trace, Debug, Info, Warn, and Errors are logged | +`wasm-pack` uses [`env_logger`] to produces logs when `wasm-pack` runs. + +To configure your log level, use the `RUST_LOG` environment variable. For example: + +``` +RUST_LOG=info wasm-pack build +``` + +[`env_logger`]: https://crates.io/crates/env_logger ## 👯 Contributing From 9491d549a0ca2defbcf70873752bc85ddaaa60c5 Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Mon, 14 Jan 2019 19:27:15 -0500 Subject: [PATCH 071/106] feat(test): remove windows output fmting test --- tests/all/build.rs | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/tests/all/build.rs b/tests/all/build.rs index 7d06f15..cc21fbb 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -228,23 +228,3 @@ fn build_with_and_without_wasm_bindgen_debug() { ); } } - -#[cfg(target_os = "windows")] -#[test] -fn it_format_out_dir_on_windows() { - let fixture = utils::fixture::js_hello_world(); - fixture.install_local_wasm_bindgen(); - let cli = Cli::from_iter_safe(vec![ - "wasm-pack", - "build", - &fixture.path.display().to_string(), - ]) - .unwrap(); - fixture.run(cli.cmd).unwrap(); - - let wasm_pack_log = utils::file::read_file(&fixture.path.join("wasm-pack.log")).unwrap(); - assert!( - wasm_pack_log.contains(r"Your wasm pkg is ready to publish at C:\"), - "directories in wasm-pack.log should be well formatted", - ); -} From a9a4237b7910df55addc7ea816a2fac6215f2511 Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Tue, 15 Jan 2019 09:11:24 -0500 Subject: [PATCH 072/106] feat(binstall): prepare for publish --- Cargo.lock | 30 +- Cargo.toml | 2 +- binary-install/Cargo.lock | 593 +++++++++++++++++++++++++++++++++++++ binary-install/Cargo.toml | 10 +- binary-install/README.md | 2 + binary-install/src/lib.rs | 10 +- src/bindgen.rs | 2 +- src/command/build.rs | 4 +- src/command/test.rs | 4 +- src/lib.rs | 2 +- src/test/webdriver.rs | 2 +- tests/all/bindgen.rs | 2 +- tests/all/main.rs | 2 +- tests/all/utils/fixture.rs | 2 +- tests/all/webdriver.rs | 2 +- 15 files changed, 636 insertions(+), 33 deletions(-) create mode 100644 binary-install/Cargo.lock create mode 100644 binary-install/README.md diff --git a/Cargo.lock b/Cargo.lock index 77ac158..5d89ca7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -73,6 +73,20 @@ dependencies = [ "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "binary-install" +version = "0.0.1" +dependencies = [ + "curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", + "dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tar 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", + "zip 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "bitflags" version = "1.0.4" @@ -1227,6 +1241,7 @@ name = "wasm-pack" version = "0.5.1" dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "binary-install 0.0.1", "cargo_metadata 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "console 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1251,24 +1266,9 @@ dependencies = [ "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-pack-binary-install 0.1.0", "which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "wasm-pack-binary-install" -version = "0.1.0" -dependencies = [ - "curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", - "dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tar 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", - "zip 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "which" version = "2.0.1" diff --git a/Cargo.toml b/Cargo.toml index 69b21b3..e2daa4d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ siphasher = "0.2.3" structopt = "0.2" toml = "0.4" which = "2.0.0" -wasm-pack-binary-install = { version = "0.1.0", path = "./binary-install" } +binary-install = { version = "0.0.1", path = "./binary-install" } walkdir = "2" [dev-dependencies] diff --git a/binary-install/Cargo.lock b/binary-install/Cargo.lock new file mode 100644 index 0000000..028ecb9 --- /dev/null +++ b/binary-install/Cargo.lock @@ -0,0 +1,593 @@ +[[package]] +name = "adler32" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "argon2rs" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "arrayvec" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "autocfg" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "backtrace" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "backtrace-sys" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "binary-install" +version = "0.0.1" +dependencies = [ + "curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", + "dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tar 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", + "zip 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bitflags" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "blake2-rfc" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "build_const" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "byteorder" +version = "1.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bzip2" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bzip2-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cc" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cfg-if" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "constant_time_eq" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "crc" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crc32fast" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "curl" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "curl-sys 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", + "schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "curl-sys" +version = "0.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dirs" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_users 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure_derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.25 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "filetime" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "flate2" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "hex" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lazy_static" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libc" +version = "0.2.47" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libflate" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libz-sys" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miniz-sys" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miniz_oxide" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miniz_oxide_c_api" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "nodrop" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "openssl-probe" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "openssl-sys" +version = "0.9.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pkg-config" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "podio" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "proc-macro2" +version = "0.4.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quote" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "redox_syscall" +version = "0.1.50" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "redox_users" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "schannel" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "scoped_threadpool" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "siphasher" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "socket2" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syn" +version = "0.15.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "synstructure" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.25 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tar" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", + "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "time" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "vcpkg" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "xattr" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "zip" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bzip2 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libflate 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", + "podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[metadata] +"checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c" +"checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392" +"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" +"checksum autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4e5f34df7a019573fb8bdc7e24a2bfebe51a2a1d6bfdbaeccedb3c41fc574727" +"checksum backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b5b493b66e03090ebc4343eb02f94ff944e0cbc9ac6571491d170ba026741eb5" +"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" +"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" +"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +"checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39" +"checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" +"checksum bzip2 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "42b7c3cbf0fa9c1b82308d57191728ca0256cb821220f4e2fd410a72ade26e3b" +"checksum bzip2-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6584aa36f5ad4c9247f5323b0a42f37802b37a836f0ad87084d7a33961abe25f" +"checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" +"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" +"checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" +"checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" +"checksum crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e91d5240c6975ef33aeb5f148f35275c25eda8e8a5f95abe421978b05b8bf192" +"checksum curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "c7c9d851c825e0c033979d4516c9173bc19a78a96eb4d6ae51d4045440eafa16" +"checksum curl-sys 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ca79238a79fb294be6173b4057c95b22a718c94c4e38475d5faa82b8383f3502" +"checksum dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "88972de891f6118092b643d85a0b28e0678e0f948d7f879aa32f2d5aafe97d2a" +"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" +"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" +"checksum filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a2df5c1a8c4be27e7707789dc42ae65976e60b394afd293d1419ab915833e646" +"checksum flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2291c165c8e703ee54ef3055ad6188e3d51108e2ded18e9f2476e774fc5ad3d4" +"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" +"checksum libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "48450664a984b25d5b479554c29cc04e3150c97aa4c01da5604a2d4ed9151476" +"checksum libflate 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)" = "bff3ac7d6f23730d3b533c35ed75eef638167634476a499feef16c428d74b57b" +"checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" +"checksum miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649" +"checksum miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad30a47319c16cde58d0314f5d98202a80c9083b5f61178457403dfb14e509c" +"checksum miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28edaef377517fd9fe3e085c37d892ce7acd1fbeab9239c5a36eec352d8a8b7e" +"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" +"checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" +"checksum openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)" = "1bb974e77de925ef426b6bc82fce15fd45bdcbeb5728bffcfc7cdeeb7ce1c2d6" +"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" +"checksum podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "780fb4b6698bbf9cf2444ea5d22411cef2953f0824b98f33cf454ec5615645bd" +"checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" +"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" +"checksum rand 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "dee497e66d8d76bf08ce20c8d36e16f93749ab0bf89975b4f8ae5cee660c2da2" +"checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db" +"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +"checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2" +"checksum redox_users 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "214a97e49be64fd2c86f568dd0cb2c757d2cc53de95b273b6ad0a1c908482f26" +"checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" +"checksum schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "0e1a231dc10abf6749cfa5d7767f25888d484201accbd919b66ab5413c502d56" +"checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" +"checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" +"checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7" +"checksum syn 0.15.25 (registry+https://github.com/rust-lang/crates.io-index)" = "71b7693d9626935a362a3d1d4e59380800a919ebfa478d77a4f49e2a6d2c3ad5" +"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" +"checksum tar 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "a303ba60a099fcd2aaa646b14d2724591a96a75283e4b7ed3d1a1658909d9ae2" +"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" +"checksum zip 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "00acf1fafb786ff450b6726e5be41ef029142597b47a40ce80f952f1471730a0" diff --git a/binary-install/Cargo.toml b/binary-install/Cargo.toml index 76d71b1..a14b484 100644 --- a/binary-install/Cargo.toml +++ b/binary-install/Cargo.toml @@ -1,6 +1,12 @@ [package] -name = "wasm-pack-binary-install" -version = "0.1.0" +name = "binary-install" +description = "install a binary from a path to a global cache" +authors = ["The wasm-pack team"] +repository = "https://github.com/rustwasm/wasm-pack/tree/master/binary-install" +license = "MIT/Apache-2.0" +version = "0.0.1" +documentation = "https://docs.rs/binary-install" +readme = "./README.md" [dependencies] curl = "0.4.13" diff --git a/binary-install/README.md b/binary-install/README.md new file mode 100644 index 0000000..a79d5df --- /dev/null +++ b/binary-install/README.md @@ -0,0 +1,2 @@ +# `binary-install` +> install a binary from a path to a global cache diff --git a/binary-install/src/lib.rs b/binary-install/src/lib.rs index dcef39f..c2dcf2c 100644 --- a/binary-install/src/lib.rs +++ b/binary-install/src/lib.rs @@ -36,13 +36,15 @@ impl Cache { /// /// This function may return an error if a cache directory cannot be /// determined. - pub fn new() -> Result { + pub fn new(name: &str) -> Result { + let cache_name = format!(".{}", name); let destination = dirs::cache_dir() - .map(|p| p.join("wasm-pack")) + .map(|p| p.join(&cache_name)) .or_else(|| { let home = dirs::home_dir()?; - Some(home.join(".wasm-pack")) - }).ok_or_else(|| format_err!("couldn't find your home directory, is $HOME not set?"))?; + Some(home.join(&cache_name)) + }) + .ok_or_else(|| format_err!("couldn't find your home directory, is $HOME not set?"))?; Ok(Cache::at(&destination)) } diff --git a/src/bindgen.rs b/src/bindgen.rs index c2ad7b2..5263a75 100644 --- a/src/bindgen.rs +++ b/src/bindgen.rs @@ -1,5 +1,6 @@ //! Functionality related to installing and running `wasm-bindgen`. +use binary_install::{Cache, Download}; use child; use command::build::BuildProfile; use emoji; @@ -12,7 +13,6 @@ use std::fs; use std::path::{Path, PathBuf}; use std::process::Command; use target; -use wasm_pack_binary_install::{Cache, Download}; use which::which; use PBAR; diff --git a/src/command/build.rs b/src/command/build.rs index 4b1efa4..475d4db 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -1,5 +1,6 @@ //! Implementation of the `wasm-pack build` command. +use binary_install::{Cache, Download}; use bindgen; use build; use command::utils::{create_pkg_dir, set_crate_path}; @@ -15,7 +16,6 @@ use readme; use std::path::PathBuf; use std::str::FromStr; use std::time::Instant; -use wasm_pack_binary_install::{Cache, Download}; use PBAR; /// Everything required to configure and run the `wasm-pack init` command. @@ -174,7 +174,7 @@ impl Build { mode: build_opts.mode, out_dir, bindgen: None, - cache: Cache::new()?, + cache: Cache::new("wasm_pack")?, }) } diff --git a/src/command/test.rs b/src/command/test.rs index 99c95e2..71f3f21 100644 --- a/src/command/test.rs +++ b/src/command/test.rs @@ -1,6 +1,7 @@ //! Implementation of the `wasm-pack test` command. use super::build::BuildMode; +use binary_install::Cache; use bindgen; use build; use command::utils::set_crate_path; @@ -15,7 +16,6 @@ use progressbar::Step; use std::path::PathBuf; use std::time::Instant; use test::{self, webdriver}; -use wasm_pack_binary_install::Cache; use PBAR; #[derive(Debug, Default, StructOpt)] @@ -132,7 +132,7 @@ impl Test { } Ok(Test { - cache: Cache::new()?, + cache: Cache::new("wasm_pack")?, crate_path, crate_data, node, diff --git a/src/lib.rs b/src/lib.rs index 0f0e4a0..164988e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -20,11 +20,11 @@ extern crate serde_ignored; extern crate serde_json; #[macro_use] extern crate structopt; +extern crate binary_install; extern crate dialoguer; extern crate log; extern crate toml; extern crate walkdir; -extern crate wasm_pack_binary_install; pub mod bindgen; pub mod build; diff --git a/src/test/webdriver.rs b/src/test/webdriver.rs index 9709c40..9fc3c56 100644 --- a/src/test/webdriver.rs +++ b/src/test/webdriver.rs @@ -1,10 +1,10 @@ //! Getting WebDriver client binaries. +use binary_install::Cache; use command::build::BuildMode; use failure; use std::path::PathBuf; use target; -use wasm_pack_binary_install::Cache; /// Get the path to an existing `chromedriver`, or install it if no existing /// binary is found. diff --git a/tests/all/bindgen.rs b/tests/all/bindgen.rs index e1077c5..e935b8a 100644 --- a/tests/all/bindgen.rs +++ b/tests/all/bindgen.rs @@ -1,6 +1,6 @@ +use binary_install::Cache; use tempfile; use wasm_pack::bindgen; -use wasm_pack_binary_install::Cache; #[test] #[cfg(any( diff --git a/tests/all/main.rs b/tests/all/main.rs index 61875e0..06806cd 100644 --- a/tests/all/main.rs +++ b/tests/all/main.rs @@ -3,11 +3,11 @@ extern crate failure; extern crate lazy_static; #[macro_use] extern crate serde_derive; +extern crate binary_install; extern crate serde_json; extern crate structopt; extern crate tempfile; extern crate wasm_pack; -extern crate wasm_pack_binary_install; mod bindgen; mod build; diff --git a/tests/all/utils/fixture.rs b/tests/all/utils/fixture.rs index 2ed126e..f98b2e2 100644 --- a/tests/all/utils/fixture.rs +++ b/tests/all/utils/fixture.rs @@ -1,3 +1,4 @@ +use binary_install::Cache; use std::env; use std::fs; use std::mem::ManuallyDrop; @@ -7,7 +8,6 @@ use std::sync::{MutexGuard, Once, ONCE_INIT}; use std::thread; use tempfile::TempDir; use wasm_pack; -use wasm_pack_binary_install::Cache; /// A test fixture in a temporary directory. pub struct Fixture { diff --git a/tests/all/webdriver.rs b/tests/all/webdriver.rs index c0bbaa5..d5e8cf6 100644 --- a/tests/all/webdriver.rs +++ b/tests/all/webdriver.rs @@ -1,6 +1,6 @@ +use binary_install::Cache; use utils::fixture; use wasm_pack::test::webdriver; -use wasm_pack_binary_install::Cache; #[test] #[cfg(any( From 1071b6ed659f29a5890884e030637bde418bdc5d Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Tue, 15 Jan 2019 12:47:20 -0500 Subject: [PATCH 073/106] feat(binstall): don't track lib's cargo lock --- .gitignore | 1 + binary-install/Cargo.lock | 593 -------------------------------------- 2 files changed, 1 insertion(+), 593 deletions(-) delete mode 100644 binary-install/Cargo.lock diff --git a/.gitignore b/.gitignore index 6ecdd21..6c61922 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ wasm-pack.log /build-installer docs/book docs/installer +binary-install/Cargo.lock diff --git a/binary-install/Cargo.lock b/binary-install/Cargo.lock deleted file mode 100644 index 028ecb9..0000000 --- a/binary-install/Cargo.lock +++ /dev/null @@ -1,593 +0,0 @@ -[[package]] -name = "adler32" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "argon2rs" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "arrayvec" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "autocfg" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "backtrace" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "backtrace-sys" -version = "0.1.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "binary-install" -version = "0.0.1" -dependencies = [ - "curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", - "dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tar 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", - "zip 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "bitflags" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "blake2-rfc" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", - "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "build_const" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "byteorder" -version = "1.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "bzip2" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bzip2-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "bzip2-sys" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cc" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "cfg-if" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "constant_time_eq" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "crc" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crc32fast" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "curl" -version = "0.4.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "curl-sys 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", - "schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "curl-sys" -version = "0.4.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "dirs" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_users 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "failure" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "failure_derive" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.25 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "filetime" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "flate2" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "hex" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "lazy_static" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "libc" -version = "0.2.47" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "libflate" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "libz-sys" -version = "1.0.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "miniz-sys" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "miniz_oxide" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "miniz_oxide_c_api" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "nodrop" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "openssl-probe" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "openssl-sys" -version = "0.9.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "pkg-config" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "podio" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "proc-macro2" -version = "0.4.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quote" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_core" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "redox_syscall" -version = "0.1.50" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "redox_users" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "schannel" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "scoped_threadpool" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "siphasher" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "socket2" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syn" -version = "0.15.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "synstructure" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.25 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tar" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", - "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "time" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "vcpkg" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "xattr" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "zip" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bzip2 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libflate 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", - "podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[metadata] -"checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c" -"checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392" -"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" -"checksum autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4e5f34df7a019573fb8bdc7e24a2bfebe51a2a1d6bfdbaeccedb3c41fc574727" -"checksum backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b5b493b66e03090ebc4343eb02f94ff944e0cbc9ac6571491d170ba026741eb5" -"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" -"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" -"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" -"checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39" -"checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" -"checksum bzip2 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "42b7c3cbf0fa9c1b82308d57191728ca0256cb821220f4e2fd410a72ade26e3b" -"checksum bzip2-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6584aa36f5ad4c9247f5323b0a42f37802b37a836f0ad87084d7a33961abe25f" -"checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" -"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" -"checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" -"checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" -"checksum crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e91d5240c6975ef33aeb5f148f35275c25eda8e8a5f95abe421978b05b8bf192" -"checksum curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "c7c9d851c825e0c033979d4516c9173bc19a78a96eb4d6ae51d4045440eafa16" -"checksum curl-sys 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ca79238a79fb294be6173b4057c95b22a718c94c4e38475d5faa82b8383f3502" -"checksum dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "88972de891f6118092b643d85a0b28e0678e0f948d7f879aa32f2d5aafe97d2a" -"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" -"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" -"checksum filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a2df5c1a8c4be27e7707789dc42ae65976e60b394afd293d1419ab915833e646" -"checksum flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2291c165c8e703ee54ef3055ad6188e3d51108e2ded18e9f2476e774fc5ad3d4" -"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" -"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" -"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" -"checksum libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "48450664a984b25d5b479554c29cc04e3150c97aa4c01da5604a2d4ed9151476" -"checksum libflate 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)" = "bff3ac7d6f23730d3b533c35ed75eef638167634476a499feef16c428d74b57b" -"checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" -"checksum miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649" -"checksum miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad30a47319c16cde58d0314f5d98202a80c9083b5f61178457403dfb14e509c" -"checksum miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28edaef377517fd9fe3e085c37d892ce7acd1fbeab9239c5a36eec352d8a8b7e" -"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" -"checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" -"checksum openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)" = "1bb974e77de925ef426b6bc82fce15fd45bdcbeb5728bffcfc7cdeeb7ce1c2d6" -"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" -"checksum podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "780fb4b6698bbf9cf2444ea5d22411cef2953f0824b98f33cf454ec5615645bd" -"checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" -"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" -"checksum rand 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "dee497e66d8d76bf08ce20c8d36e16f93749ab0bf89975b4f8ae5cee660c2da2" -"checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db" -"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -"checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2" -"checksum redox_users 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "214a97e49be64fd2c86f568dd0cb2c757d2cc53de95b273b6ad0a1c908482f26" -"checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" -"checksum schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "0e1a231dc10abf6749cfa5d7767f25888d484201accbd919b66ab5413c502d56" -"checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" -"checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" -"checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7" -"checksum syn 0.15.25 (registry+https://github.com/rust-lang/crates.io-index)" = "71b7693d9626935a362a3d1d4e59380800a919ebfa478d77a4f49e2a6d2c3ad5" -"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" -"checksum tar 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "a303ba60a099fcd2aaa646b14d2724591a96a75283e4b7ed3d1a1658909d9ae2" -"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" -"checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" -"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" -"checksum zip 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "00acf1fafb786ff450b6726e5be41ef029142597b47a40ce80f952f1471730a0" From 6d63a537cac8d81a0e24b9befddb4413e5640b38 Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Tue, 15 Jan 2019 13:07:54 -0500 Subject: [PATCH 074/106] feat(binstall): leverage workspaces --- .gitignore | 1 - Cargo.toml | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6c61922..6ecdd21 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,3 @@ wasm-pack.log /build-installer docs/book docs/installer -binary-install/Cargo.lock diff --git a/Cargo.toml b/Cargo.toml index e2daa4d..d2f67ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,11 @@ readme = "README.md" categories = ["wasm"] documentation = "https://rustwasm.github.io/wasm-pack/" +[workspace] +members = [ + "./binary-install", +] + [dependencies] atty = "0.2.11" cargo_metadata = "0.6.0" From 2b822b813263bc001c87fe869bc06f54b4dea908 Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Tue, 15 Jan 2019 14:04:06 -0500 Subject: [PATCH 075/106] feat(binstall): no workspace since it's a dep --- Cargo.toml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d2f67ba..e2daa4d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,11 +9,6 @@ readme = "README.md" categories = ["wasm"] documentation = "https://rustwasm.github.io/wasm-pack/" -[workspace] -members = [ - "./binary-install", -] - [dependencies] atty = "0.2.11" cargo_metadata = "0.6.0" From c96f9d45c0cbf5044b5bbeb342be98df97acd4ad Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Fri, 11 Jan 2019 12:13:45 -0500 Subject: [PATCH 076/106] v0.6.0 --- CHANGELOG.md | 341 +++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.lock | 106 ++++++++-------- Cargo.toml | 4 +- 3 files changed, 396 insertions(+), 55 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b93943..7cf822a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,346 @@ # Changelog +## 🌅 0.6.0 + +- ### ✨ Features + + - **Add three build profiles and infrastructure for their toml config - [fitzgen], [issue/153] [issue/160] [pull/440]** + + When originally conceived, `wasm-pack` was exclusively a packaging and publishing tool, which naively assumed + that the crate author would simply run `wasm-pack` when they were ready to publish a wasm package. As a result, + `wasm-pack` always ran `cargo build` in `--release` mode. Since then, `wasm-pack` has grown into an integrated build + tool used at all stages of development, from idea conception to publishing, and as such has developed new needs. + + In previous releases, we've supported a flag called `--debug` which will run `cargo build` in `dev` mode, which + trades faster compilation speed for a lack of optimizations. We've renamed this flag to `--dev` to match `cargo` + and added an additional flag, representing a third, intermediary, build profile, called `--profiling` which + is useful for investigating performance issues. You can see all three flags and their uses in the table below: + + | Profile | Debug Assertions | Debug Info | Optimizations | Notes | + |---------------|------------------|------------|---------------|---------------------------------------| + | `--dev` | Yes | Yes | No | Useful for development and debugging. | + | `--profiling` | No | Yes | Yes | Useful when profiling and investigating performance issues. | + | `--release` | No | No | Yes | Useful for shipping to production. | + + The meaning of these flags will evolve as the platform grows, and always be tied to the behavior of these flags + in `cargo`. You can learn more about these in the [`cargo profile` documentation]. + + This PR also introduces a way to configure `wasm-pack` in your `Cargo.toml` file that we intend to use much more + in the future. As a largely convention-based tool, `wasm-pack` will never require that you configure it manually, + however, as our community and their projects mature alongside the tool, it became clear that allowing folks the + ability to drop down and configure things was something we needed to do to meet their needs. + + Currently, you can only configure things related to the above-mentioned build profiles. To learn more, + [check out the documentation][profile-config-docs]. It leverages the `package.metadata.wasm-pack` key in your + `Carol.toml`, and looks like this: + + ```toml + # Cargo.toml + + [package.metadata.wasm-pack.profile.dev.wasm-bindgen] + # Should we enable wasm-bindgen's debug assertions in its generated JS glue? + debug-js-glue = true + # Should wasm-bindgen demangle the symbols in the "name" custom section? + demangle-name-section = true + # Should we emit the DWARF debug info custom sections? + dwarf-debug-info = false + ``` + + As always- there are defaults for you to use, but if you love to configure (or have a project that requires it), + get excited, as your options have grown now and will continue to! + + [profile-config-docs]: https://rustwasm.github.io/wasm-pack/book/cargo-toml-configuration.html + [`cargo profile` documentation]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-profile-sections + [issue/153]: https://github.com/rustwasm/wasm-pack/issues/153 + [issue/160]: https://github.com/rustwasm/wasm-pack/issues/160 + [pull/440]: https://github.com/rustwasm/wasm-pack/pull/440 + + - **DEPRECATION: Rename `--debug` to `--dev` to match `cargo` - [fitzgen], [pull/439]** + + See the discussion of the build profiles feature above. This is a strict renaming of the previous `--debug` flag, + which will now warn as deprecated. + + [pull/439]: https://github.com/rustwasm/wasm-pack/pull/439 + + - **Add an option to pass an arbitrary set of arguments to `cargo build` - [torkve], [issue/455] [pull/461]** + + As an integrated build tool, `wasm-pack` orchestrates many secondary command line tools to build your package + in a single command. Notably, one of these tools is `cargo`. `cargo` has a wide array of features and flags, and + we couldn't reasonably expect to implement them all as first class features of `wasm-pack`. As a result, we've + created the option to allow users to pass an arbitrary number of additional flags to `wasm-pack` by appending them + to the `wasm-pack build` command, after passing `--`. For example: + + ``` + wasm-pack build examples/js-hello-world --mode no-install -- -Z offline + ``` + + In the above example, the flag `-Z offline` will be passed to `cargo build`. This feature is documented + [here][cargo opts docs]. + + [cargo opts docs]: https://rustwasm.github.io/wasm-pack/book/commands/build.html#extra-options + [torkve]: https://github.com/torkve + [issue/455]: https://github.com/rustwasm/wasm-pack/issues/455 + [pull/461]: https://github.com/rustwasm/wasm-pack/pull/461 + + + - **Pre-build before wasm-pack publish - [csmoe], [issue/438] [pull/444]** + + Previously, if you ran `wasm-pack publish` before you had successfully run `wasm-pack build`, + you'd receive an error that a package could not be found- because there would be no `pkg` or + out-directory containing a `package.json`. + + In this situation, you would hope that `wasm-pack` would build your package for you when you + ran `wasm-pack publish`. This is slightly complicated by the fact that not everyone wants to + build their package to the default target or to a directory named `pkg`. + + To solve this, running `wasm-pack publish` before a successful build will give you an interactive + prompt to build your package- allowing you to specify your out directory as well as the target you'd + like to build to. Check it out in the gif below: + + ![pre-build publish workflow](https://user-images.githubusercontent.com/35686186/50500909-5984fe80-0a8f-11e9-9de6-43d1423b2969.gif) + + [issue/438]: https://github.com/rustwasm/wasm-pack/issues/438 + [pull/444]: https://github.com/rustwasm/wasm-pack/pull/444 + + - **Generate self-.gitignore as part of pkg folder - [RReverser], [pull/453]** + + Since `wasm-pack` was first published, the `pkg` directory was intended to be treated as a + build artifact, and as such should never be published to version control. This was + never enforced by any assets generated by `wasm-pack`, however. + + Now, when building your package, `wasm-pack` will also generate a `.gitignore` file so that the + `pkg`, or out-directory, will be ignored. + + If you use another version control tool, you'll need to still create or edit your own ignore file- + pull requests to support other version control tools are welcome! + + If you require editing of the generated `package.json` or add additonal assets to your package + before publishing, you'll want to remove the `.gitignore` file and commit to version control. We + intend to have a solution that makes this workflow significantly easier in upcoming releases! + + [RReverser]: https://github.com/RReverser + [pull/453]: https://github.com/rustwasm/wasm-pack/pull/453 + + - **Support cargo workspaces - [fitzgen], [issue/252] [issue/305] [pull/430]** + + Workspaces are a well-liked and used feature of cargo that allow you to build multiple crates + in a single cargo project. Because of how `wasm-pack` handled paths for `target` and out-directories, + we did not support cargo workspaces out of the box. Now they should work well and the feature is + well guarded by tests! + + [issue/252]: https://github.com/rustwasm/wasm-pack/issues/252 + [issue/305]: https://github.com/rustwasm/wasm-pack/issues/305 + [pull/430]: https://github.com/rustwasm/wasm-pack/pull/430 + + - **Use a global cache for all downloaded binaries - [alexcrichton], [pull/426]** + + `wasm-pack` is an integrated build tool that orchestrates several other command line tools to build + your wasm project for you. How `wasm-pack` does this has evolved significantly since it's early versions. + In the last version, a `bin` directory was created to house the tool binaries that `wasm-pack` needed to + build our project, but this had several limitations. Firstly, it created a `bin` directory in your project's + root, which could be confusing. Secondly, it meant that sharing these tools across multiple projects was + not possible. We did this because it gaves us the fine-grained control over the version of these tools that + you used. + + Now, `wasm-pack` will not generate a `bin` directory, but rather will use a global cache. We retain the + fine-grained control over the versions of these tools that are used, but allow multiple projects that use + the same tools at the same versions to share the already installed asset. Your global cache will generally + be in your user's home directory- we use the [`dirs` crate] to determine where to place this global cache. + This is not currently customizable but is something we intend to look into doing! + + This feature ensures that `wasm-pack` users are downloading a minimal number of binaries from the network, + which, for `wasm-pack` users with multiple projects, should speed up build times. + + [`dirs` crate]: https://docs.rs/dirs/1.0.4/dirs/fn.cache_dir.html + [pull/426]: https://github.com/rustwasm/wasm-pack/pull/426 + +- ### 🤕 Fixes + + - **Fix `pack`, `login`, and `publish` for Windows users - [danwilhelm], [issue/277] [pull/489]** + + Rust's behavior for spawning processes on some Windows targets introduced an interesting case where + Rust would fail unless the command was explicitly spawned with a prepended `cmd /c`. This failure + of `wasm-pack` was well noticed by our community - and thanks to the efforts of `danwilhelm` is now + fixed! You can read more on the background of this issue in [rust-lang/rust issue/44542]. + + [rust-lang/rust issue/44542]: https://github.com/rust-lang/rust/pull/44542 + [issue/277]: https://github.com/rustwasm/wasm-pack/issues/277 + [pull/489]: https://github.com/rustwasm/wasm-pack/pull/489 + + - **Validate `--target` argument - [csmoe], [issue/483] [pull/484]** + + For a few releases now, `wasm-pack` has supported allowing users to specifying the target module system + they'd like their package built for- `browser`, `nodejs`, and `no-modules`. We did not however, validate + this input, and so if a user made even a slight mistake, e.g. `node`, `wasm-pack` would not catch the + error and would build your project using the default, `browser`. This is of course, surprising, and + unpleasant behavior and so now we'll error out with a message containing the supported target names. + + [issue/483]: https://github.com/rustwasm/wasm-pack/issues/483 + [pull/484]: https://github.com/rustwasm/wasm-pack/pull/484 + + - **Fix login - [danwilhelm], [issue/486] [pull/487]** + + [danwilhelm]: https://github.com/danwilhelm + [issue/486]: https://github.com/rustwasm/wasm-pack/issues/486 + [pull/487]: https://github.com/rustwasm/wasm-pack/pull/487 + + - **Eliminate unecessary escaping in build success terminal output - [huangjj27], [issue/390] [pull/396]** + + Previously, on some systems, a successful `wasm-pack build` would print a unfortunate looking string: + + ``` + | :-) Your wasm pkg is ready to publish at "\\\\?\\C:\\Users\\Ferris\\tmp\\wasm-bug\\pkg". + ``` + + We've updated this to make sure the path to your project is well-formed, and most importantly, + human-readable. + + [issue/390]: https://github.com/rustwasm/wasm-pack/issues/390 + [pull/396]: https://github.com/rustwasm/wasm-pack/pull/396 + + - **Copy license file(s) to out directory - [mstallmo], [issue/407] [pull/411]** + + Since `wasm-pack` was first published, we've copied over your `Cargo.toml` license definition over to + your `package.json`. However, we overlooked copying the actual `LICENSE` files over! Now we do! + + [issue/407]: https://github.com/rustwasm/wasm-pack/issues/407 + [pull/411]: https://github.com/rustwasm/wasm-pack/pull/411 + + - **Don't require cdylib crate-type for testing - [alexcrichton], [pull/442]** + + `wasm-pack` was unecssarily checking `Cargo.toml` for the `cdylib` crate type during calls to `wasm-pack test`. + The `cdylib` output isn't necessary for the `wasm-pack test` stage because `wasm-bindgen` isn't being run over + a wasm file during testing. This check is now removed! + + [pull/442]: https://github.com/rustwasm/wasm-pack/pull/442 + + - **Fix wasm-bindgen if lib is renamed via `lib.name` - [alexcrichton], [issue/339] [pull/435]** + + In some circumstances, a library author may wish to specify a `name` in the `[package]` portion of their + `Cargo.toml`, as well as a different `name` in the `[lib]` portion, e.g.: + + ```toml + [package] + name = "hello-wasm" + + [lib] + name = "wasm-lib" + ``` + + This would cause the `wasm-bindgen` build stage of `wasm-pack` to error out because `wasm-pack` would attempt + to run `wasm-bindgen-cli` on a path using the `[package]` name, which wouldn't exist (because it would be using + the `[lib]` name). Now it works- thanks to more usage of [`cargo_metadata`] in `wasm-pack` internals! + + [`cargo_metadata`]: https://crates.io/crates/cargo_metadata + [issue/339]: https://github.com/rustwasm/wasm-pack/issues/339 + [pull/435]: https://github.com/rustwasm/wasm-pack/pull/435 + + - **Print standard error only once for failing commands - [fitzgen], [issue/422] [pull/424]** + + Previously, `wasm-pack` may have printed `stderr` twice in some circumstances. This was both confusing and not + a pleasant experience, so now we've ensued that `wasm-pack` prints `stderr` exactly once! (It's hard enough to have + errors, you don't want `wasm-pack` rubbing it in, right?) + + [issue/422]: https://github.com/rustwasm/wasm-pack/issues/422 + [pull/424]: https://github.com/rustwasm/wasm-pack/pull/424 + + - **Add no-modules to --target flag's help text - [fitzgen], [issue/416] [pull/417]** + + This is an interesting one! `fitzgen` very reasonably filed an issue asking to add `wasm-bindgen`'s + `--target no-modules` feature to `wasm-pack`. This was confusing as this feature was indeed already implemented, + and documented- BUT, notably missing from the `wasm-pack --help` text. We've fixed that now- and it was an omission + so glaring we definitely considered it a bug! + + [issue/416]: https://github.com/rustwasm/wasm-pack/issues/416 + [pull/417]: https://github.com/rustwasm/wasm-pack/pull/417 + +- ### 🛠️ Maintenance + + - **Replace `slog` with `log` - [alexcrichton], [issue/425] [pull/434]** + + For internal maintenance reasons, as well as several end-user ones, we've migrated away from the `slog` family + of crates, and are now using the `log` crate plus `env_logger`. Now, `wasm-pack` won't create a `wasm-pack.log`. + Additionally, enabling logging will now be done through `RUST_LOG=wasm_pack` instead of `-v` flags. + + [issue/425]: https://github.com/rustwasm/wasm-pack/issues/425 + [pull/434]: https://github.com/rustwasm/wasm-pack/pull/434 + + - **Move binary installation to its own crate - [drager], [issue/384] [pull/415]** + + In `wasm-pack 0.5.0`, we move away from `cargo install`ing many of the tools that `wasm-pack` orchestrates. Because + we used `cargo install`, this required an end user to sit through the compilation of each tool, which was a + prohibitively long time. We moved, instead, to building, and then installing, binaries of the tools. This sped up + build times dramatically! + + This pattern has been very beneficial to `wasm-pack` and is potentially something that could be beneficial to other + projects! As a result, we've refactored it out into a crate and have published it as it's own crate, [`binary-install`]. + + [`binary-install`]: https://crates.io/crates/binary-install + [drager]: https://github.com/drager + [issue/384]: https://github.com/rustwasm/wasm-pack/issues/384 + [pull/415]: https://github.com/rustwasm/wasm-pack/pull/415 + + - **Replace internal `Error` with `failure::Error` - [alexcrichton], [pull/436]** + + The story of error message handling in `wasm-pack` has not been the prettiest. We originally were manually implementing + errors, adding the [`failure` crate] at one point, but not fully updating the entire codebase. With this PR, we are + nearly completely handling errors with `failure`, bringing the code into a much more maintainable and + pleasant-to-work-on place. + + [`failure` crate]: https://crates.io/crates/failure + [pull/436]: https://github.com/rustwasm/wasm-pack/pull/436 + + - **Update `mdbook` version used by Travis - [fitzgen], [pull/433]** + + [pull/433]: https://github.com/rustwasm/wasm-pack/pull/433 + + - **Read the `Cargo.toml` file only once - [fitzgen], [issue/25] [pull/431]** + + This is a very fun one since it fixes one of the original issues filed by `ag_dubs` at the very beginning of `wasm-pack` + development. In a rush to implement a POC tool, `ag_dubs` noted for posterity that the `Cargo.toml` was being read + multiple times (twice), when it did not need to be. Thanks to `fitzgen` now it's read only once! A minor performance + improvement in the scheme of things, but a nice one :) + + [issue/25]: https://github.com/rustwasm/wasm-pack/issues/25 + [pull/431]: https://github.com/rustwasm/wasm-pack/pull/431 + + - **Use `name` field for Travis CI jobs - [fitzgen], [pull/432]** + + [pull/432]: https://github.com/rustwasm/wasm-pack/pull/432 + + - **Add a test for build command - [huangjj27], [pull/408]** + + [huangjj27]: https://github.com/huangjj27 + [pull/408]: https://github.com/rustwasm/wasm-pack/pull/408 + + - **Test paths on Windows - [xmclark], [issue/380] [pull/389]** + + [xmclark]: https://github.com/xmclark + [issue/380]: https://github.com/rustwasm/wasm-pack/issues/380 + [pull/389]: https://github.com/rustwasm/wasm-pack/pull/389 + + - **Fix typo in test function name for copying the README - [mstallmo], [pull/412]** + + [pull/412]: https://github.com/rustwasm/wasm-pack/pull/412 + +- ### 📖 Documentation + + - **Complete template deep dive docs - [danwilhelm], [issue/345] [issue/346] [pull/490]** + + In a rush to publish a release, `ag_dubs` left some "Coming soon!" comments on most pages + of the "Template Deep Dive" docs. These docs help walk new users through the boilerplate + that using the `wasm-pack` template generates for you. Thanks so much to `danwilhem` for + picking this up and doing an excellent job! + + [issue/345]: https://github.com/rustwasm/wasm-pack/issues/345 + [issue/346]: https://github.com/rustwasm/wasm-pack/issues/346 + [pull/490]: https://github.com/rustwasm/wasm-pack/pull/490 + + - **Minor docs updates - [fitzgen], [issue/473] [pull/485]** + + [issue/473]: https://github.com/rustwasm/wasm-pack/issues/473 + [pull/485]: https://github.com/rustwasm/wasm-pack/pull/485 + ## 🌄 0.5.1 - ### 🤕 Fixes diff --git a/Cargo.lock b/Cargo.lock index 5d89ca7..001ef1e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -41,7 +41,7 @@ name = "atty" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -59,7 +59,7 @@ dependencies = [ "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -70,7 +70,7 @@ version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -117,7 +117,7 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bzip2-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -126,7 +126,7 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -138,7 +138,7 @@ dependencies = [ "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -172,7 +172,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -183,7 +183,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -203,7 +203,7 @@ dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "clicolors-control 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -213,14 +213,14 @@ dependencies = [ [[package]] name = "console" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "clicolors-control 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -256,7 +256,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "curl-sys 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", "schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -270,7 +270,7 @@ version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -283,7 +283,7 @@ name = "dialoguer" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "console 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "console 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -293,7 +293,7 @@ name = "dirs" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "redox_users 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -338,7 +338,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.25 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -348,7 +348,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -358,7 +358,7 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -437,7 +437,7 @@ name = "indicatif" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "console 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "console 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -469,7 +469,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.46" +version = "0.2.47" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -488,7 +488,7 @@ version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -516,7 +516,7 @@ version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -526,7 +526,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -544,7 +544,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -562,7 +562,7 @@ dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -585,7 +585,7 @@ version = "0.9.40" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-src 111.1.0+1.1.1a (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -630,7 +630,7 @@ name = "parking_lot_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -642,7 +642,7 @@ name = "parking_lot_core" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -686,7 +686,7 @@ version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -696,7 +696,7 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -709,7 +709,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -720,7 +720,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -776,7 +776,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -950,7 +950,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.25 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -963,7 +963,7 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.34" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -990,7 +990,7 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1027,12 +1027,12 @@ dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.25 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "syn" -version = "0.15.24" +version = "0.15.25" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1047,7 +1047,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.25 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1057,7 +1057,7 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1077,7 +1077,7 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1089,7 +1089,7 @@ version = "3.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1117,7 +1117,7 @@ name = "termion" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1127,7 +1127,7 @@ name = "termios" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1151,7 +1151,7 @@ name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1238,7 +1238,7 @@ dependencies = [ [[package]] name = "wasm-pack" -version = "0.5.1" +version = "0.6.0" dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "binary-install 0.0.1", @@ -1259,7 +1259,7 @@ dependencies = [ "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1275,7 +1275,7 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1337,7 +1337,7 @@ name = "xattr" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1376,7 +1376,7 @@ dependencies = [ "checksum clicolors-control 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "73abfd4c73d003a674ce5d2933fca6ce6c42480ea84a5ffe0a2dc39ed56300f9" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum console 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd48adf136733979b49e15bc3b4c43cc0d3c85ece7bd08e6daa414c6fcb13e6" -"checksum console 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4ceeb6d030ed175896450ad583a39e67a77b8b2ab8802c2aae594112adc783a2" +"checksum console 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ecc3753530b959618f617b0cd6494526008d98687f1af5d8f9fa83fa9cdbb594" "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" "checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" "checksum crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e91d5240c6975ef33aeb5f148f35275c25eda8e8a5f95abe421978b05b8bf192" @@ -1405,7 +1405,7 @@ dependencies = [ "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" -"checksum libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)" = "023a4cd09b2ff695f9734c1934145a315594b7986398496841c7031a5a1bbdbd" +"checksum libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "48450664a984b25d5b479554c29cc04e3150c97aa4c01da5604a2d4ed9151476" "checksum libflate 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)" = "bff3ac7d6f23730d3b533c35ed75eef638167634476a499feef16c428d74b57b" "checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" @@ -1463,7 +1463,7 @@ dependencies = [ "checksum serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)" = "0e732ed5a5592c17d961555e3b552985baf98d50ce418b7b655f31f6ba7eb1b7" "checksum serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d6115a3ca25c224e409185325afc16a0d5aaaabc15c42b09587d6f1ba39a5b" "checksum serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "190e9765dcedb56be63b6e0993a006c7e3b071a016a304736e4a315dc01fb142" -"checksum serde_json 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)" = "bdf540260cfee6da923831f4776ddc495ada940c30117977c70f1313a6130545" +"checksum serde_json 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)" = "dfb1277d4d0563e4593e0b8b5d23d744d277b55d2bc0bf1c38d0d8a6589d38aa" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" "checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db" "checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7" @@ -1472,7 +1472,7 @@ dependencies = [ "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "670ad348dc73012fcf78c71f06f9d942232cdd4c859d4b6975e27836c3efc0c3" "checksum structopt-derive 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "ef98172b1a00b0bec738508d3726540edcbd186d50dfd326f2b1febbb3559f04" -"checksum syn 0.15.24 (registry+https://github.com/rust-lang/crates.io-index)" = "734ecc29cd36e8123850d9bf21dfd62ef8300aaa8f879aabaa899721808be37c" +"checksum syn 0.15.25 (registry+https://github.com/rust-lang/crates.io-index)" = "71b7693d9626935a362a3d1d4e59380800a919ebfa478d77a4f49e2a6d2c3ad5" "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" "checksum tar 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "a303ba60a099fcd2aaa646b14d2724591a96a75283e4b7ed3d1a1658909d9ae2" "checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" diff --git a/Cargo.toml b/Cargo.toml index e2daa4d..14bdf5b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "wasm-pack" -description = "pack up the wasm and publish it to npm!" -version = "0.5.1" +description = "📦✨ your favorite rust -> wasm workflow tool!" +version = "0.6.0" authors = ["Ashley Williams "] repository = "https://github.com/ashleygwilliams/wasm-pack.git" license = "MIT/Apache-2.0" From 90a9ed96491d6bbd03007874a0816b53d45d87ab Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Tue, 15 Jan 2019 18:30:41 -0500 Subject: [PATCH 077/106] feat(site): update version and date --- docs/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/index.html b/docs/index.html index 2590699..f66ca95 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,9 +42,9 @@

📦✨ your favorite rust -> wasm workflow tool!

- ✨ Install wasm-pack 0.5.1 ✨ -

9 Oct 2018 | - + ✨ Install wasm-pack 0.6.0 ✨ +

15 Jan 2018 | + Release Notes

From f57afa7814b16f07bcabda41bf10088043d7437f Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Wed, 16 Jan 2019 09:43:08 -0500 Subject: [PATCH 078/106] feat(ignore): remove wasm-pack.log --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6ecdd21..4d85744 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ target/ **/*.rs.bk tests/.crates.toml tests/bin -wasm-pack.log /build-installer docs/book docs/installer From 7f944f9c4ff872a637fe4af0edcbad46263d3d2c Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Wed, 16 Jan 2019 09:43:58 -0500 Subject: [PATCH 079/106] feat(changelog): s/Carol/Cargo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cf822a..b560937 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,7 +32,7 @@ Currently, you can only configure things related to the above-mentioned build profiles. To learn more, [check out the documentation][profile-config-docs]. It leverages the `package.metadata.wasm-pack` key in your - `Carol.toml`, and looks like this: + `Cargo.toml`, and looks like this: ```toml # Cargo.toml From 99ea57e5b028bede90bc4042f572202c25ea106d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Wed, 16 Jan 2019 21:15:09 +0100 Subject: [PATCH 080/106] doc: Update to 2019 --- docs/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.html b/docs/index.html index f66ca95..2566c10 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@
✨ Install wasm-pack 0.6.0 ✨ -

15 Jan 2018 | +

15 Jan 2019 | Release Notes From 8325d9ada4ca6ed8d2299cddb9ef5eb78cee9e82 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Wed, 16 Jan 2019 14:00:02 -0800 Subject: [PATCH 081/106] binary-install: don't make getting a binary from a download infallible Instead of panicking on unexpected states, check for them and return an error. Also add more debug logging for when we `cargo install` wasm-bindgen. --- Cargo.lock | 10 ++++++++++ binary-install/Cargo.toml | 1 + binary-install/src/lib.rs | 16 +++++++++++++--- src/bindgen.rs | 19 +++++++++++++++++-- src/command/test.rs | 2 +- src/test/webdriver.rs | 4 ++-- tests/all/bindgen.rs | 4 ++-- tests/all/utils/fixture.rs | 2 +- 8 files changed, 47 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 001ef1e..4ef603c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -82,6 +82,7 @@ dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "is_executable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "tar 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", "zip 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -443,6 +444,14 @@ dependencies = [ "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "is_executable" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "itoa" version = "0.4.3" @@ -1401,6 +1410,7 @@ dependencies = [ "checksum human-panic 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "21638c5955a6daf3ecc42cae702335fc37a72a4abcc6959ce457b31a7d43bbdd" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" "checksum indicatif 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a29b2fa6f00010c268bface64c18bb0310aaa70d46a195d5382d288c477fb016" +"checksum is_executable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "302d553b8abc8187beb7d663e34c065ac4570b273bc9511a50e940e99409c577" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" diff --git a/binary-install/Cargo.toml b/binary-install/Cargo.toml index a14b484..b735cea 100644 --- a/binary-install/Cargo.toml +++ b/binary-install/Cargo.toml @@ -14,6 +14,7 @@ dirs = "1.0.4" failure = "0.1.2" flate2 = "1.0.2" hex = "0.3" +is_executable = "0.1.2" siphasher = "0.2.3" tar = "0.4.16" zip = "0.5.0" diff --git a/binary-install/src/lib.rs b/binary-install/src/lib.rs index c2dcf2c..eac1c98 100644 --- a/binary-install/src/lib.rs +++ b/binary-install/src/lib.rs @@ -6,6 +6,7 @@ extern crate failure; extern crate dirs; extern crate flate2; extern crate hex; +extern crate is_executable; extern crate siphasher; extern crate tar; extern crate zip; @@ -223,13 +224,22 @@ impl Download { } /// Returns the path to the binary `name` within this download - pub fn binary(&self, name: &str) -> PathBuf { + pub fn binary(&self, name: &str) -> Result { + use is_executable::IsExecutable; + let ret = self .root .join(name) .with_extension(env::consts::EXE_EXTENSION); - assert!(ret.exists(), "binary {} doesn't exist", ret.display()); - return ret; + + if !ret.is_file() { + bail!("{} binary does not exist", ret.display()); + } + if !ret.is_executable() { + bail!("{} is not executable", ret.display()); + } + + Ok(ret) } } diff --git a/src/bindgen.rs b/src/bindgen.rs index 5263a75..e6dee72 100644 --- a/src/bindgen.rs +++ b/src/bindgen.rs @@ -101,9 +101,19 @@ pub fn cargo_install_wasm_bindgen( version: &str, install_permitted: bool, ) -> Result { + debug!( + "Attempting to use a `cargo install`ed version of `wasm-bindgen={}`", + version + ); + let dirname = format!("wasm-bindgen-cargo-install-{}", version); let destination = cache.join(dirname.as_ref()); if destination.exists() { + debug!( + "`cargo install`ed `wasm-bindgen={}` already exists at {}", + version, + destination.display() + ); return Ok(Download::at(&destination)); } @@ -115,7 +125,12 @@ pub fn cargo_install_wasm_bindgen( // and ensure we don't accidentally use stale files in the future let tmp = cache.join(format!(".{}", dirname).as_ref()); drop(fs::remove_dir_all(&tmp)); - fs::create_dir_all(&tmp)?; + debug!( + "cargo installing wasm-bindgen to tempdir: {}", + tmp.display() + ); + fs::create_dir_all(&tmp) + .context("failed to create temp dir for `cargo install wasm-bindgen`")?; let mut cmd = Command::new("cargo"); cmd.arg("install") @@ -170,7 +185,7 @@ pub fn wasm_bindgen_build( "no-modules" => "--no-modules", _ => "--browser", }; - let bindgen_path = bindgen.binary("wasm-bindgen"); + let bindgen_path = bindgen.binary("wasm-bindgen")?; let mut cmd = Command::new(bindgen_path); cmd.arg(&wasm_path) .arg("--out-dir") diff --git a/src/command/test.rs b/src/command/test.rs index 71f3f21..e0837b1 100644 --- a/src/command/test.rs +++ b/src/command/test.rs @@ -288,7 +288,7 @@ impl Test { let dl = bindgen::install_wasm_bindgen(&self.cache, &bindgen_version, install_permitted, step)?; - self.test_runner_path = Some(dl.binary("wasm-bindgen-test-runner")); + self.test_runner_path = Some(dl.binary("wasm-bindgen-test-runner")?); info!("Getting wasm-bindgen-cli was successful."); Ok(()) diff --git a/src/test/webdriver.rs b/src/test/webdriver.rs index 9fc3c56..54e2968 100644 --- a/src/test/webdriver.rs +++ b/src/test/webdriver.rs @@ -47,7 +47,7 @@ pub fn install_chromedriver( &["chromedriver"], &url, )? { - Some(dl) => Ok(dl.binary("chromedriver")), + Some(dl) => Ok(dl.binary("chromedriver")?), None => bail!( "No cached `chromedriver` binary found, and could not find a global \ `chromedriver` on the `$PATH`. Not installing `chromedriver` because of noinstall \ @@ -97,7 +97,7 @@ pub fn install_geckodriver( ext, ); match cache.download(installation_allowed, "geckodriver", &["geckodriver"], &url)? { - Some(dl) => Ok(dl.binary("geckodriver")), + Some(dl) => Ok(dl.binary("geckodriver")?), None => bail!( "No cached `geckodriver` binary found, and could not find a global `geckodriver` \ on the `$PATH`. Not installing `geckodriver` because of noinstall mode." diff --git a/tests/all/bindgen.rs b/tests/all/bindgen.rs index e935b8a..3f04450 100644 --- a/tests/all/bindgen.rs +++ b/tests/all/bindgen.rs @@ -12,8 +12,8 @@ fn can_download_prebuilt_wasm_bindgen() { let dir = tempfile::TempDir::new().unwrap(); let cache = Cache::at(dir.path()); let dl = bindgen::download_prebuilt_wasm_bindgen(&cache, "0.2.21", true).unwrap(); - assert!(dl.binary("wasm-bindgen").is_file()); - assert!(dl.binary("wasm-bindgen-test-runner").is_file()) + assert!(dl.binary("wasm-bindgen").unwrap().is_file()); + assert!(dl.binary("wasm-bindgen-test-runner").unwrap().is_file()) } #[test] diff --git a/tests/all/utils/fixture.rs b/tests/all/utils/fixture.rs index f98b2e2..def8e8c 100644 --- a/tests/all/utils/fixture.rs +++ b/tests/all/utils/fixture.rs @@ -185,7 +185,7 @@ impl Fixture { INSTALL_WASM_BINDGEN.call_once(|| { download().unwrap(); }); - download().unwrap().binary("wasm-bindgen") + download().unwrap().binary("wasm-bindgen").unwrap() } /// Download `geckodriver` and return its path. From 1d639fb621ff1b978ed6ac046e2ba38af81d6178 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Wed, 16 Jan 2019 16:10:37 -0800 Subject: [PATCH 082/106] Fix directory layout of cached `cargo install`ed wasm-bindgens Fix #503 Fix #497 --- src/bindgen.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/bindgen.rs b/src/bindgen.rs index e6dee72..3bc2946 100644 --- a/src/bindgen.rs +++ b/src/bindgen.rs @@ -9,6 +9,7 @@ use log::debug; use log::{info, warn}; use manifest::CrateData; use progressbar::Step; +use std::env; use std::fs; use std::path::{Path, PathBuf}; use std::process::Command; @@ -143,7 +144,28 @@ pub fn cargo_install_wasm_bindgen( child::run(cmd, "cargo install").context("Installing wasm-bindgen with cargo")?; + // `cargo install` will put the installed binaries in `$root/bin/*`, but we + // just want them in `$root/*` directly (which matches how the tarballs are + // laid out, and where the rest of our code expects them to be). So we do a + // little renaming here. + for f in ["wasm-bindgen", "wasm-bindgen-test-runner"].iter().cloned() { + let from = tmp + .join("bin") + .join(f) + .with_extension(env::consts::EXE_EXTENSION); + let to = tmp.join(from.file_name().unwrap()); + fs::rename(&from, &to).with_context(|_| { + format!( + "failed to move {} to {} for `cargo install`ed `wasm-bindgen`", + from.display(), + to.display() + ) + })?; + } + + // Finally, move the `tmp` directory into our binary cache. fs::rename(&tmp, &destination)?; + Ok(Download::at(&destination)) } From 6fc3f9b3493178330635f4f76ae31ad02ee45010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Sat, 19 Jan 2019 13:31:02 +0100 Subject: [PATCH 083/106] doc: Fix links and Rust highlightning --- docs/src/prerequisites/index.md | 4 ++-- docs/src/tutorial/index.md | 4 ++-- docs/src/tutorial/template-deep-dive/src-utils-rs.md | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/src/prerequisites/index.md b/docs/src/prerequisites/index.md index 6454a69..bc91b02 100644 --- a/docs/src/prerequisites/index.md +++ b/docs/src/prerequisites/index.md @@ -2,8 +2,8 @@ To run `wasm-pack` you'll need to have both Rust and npm installed and configured. -- [Rust](./rust.html) -- [npm](./npm.html) +- [Rust](./prerequisites/rust.html) +- [npm](./prerequisites/npm.html) In the future, we intend to rewrite the npm registry client bits so that the need for a Node runtime is eliminated. If you're excited about that work- you should diff --git a/docs/src/tutorial/index.md b/docs/src/tutorial/index.md index 21df55c..75637ee 100644 --- a/docs/src/tutorial/index.md +++ b/docs/src/tutorial/index.md @@ -10,8 +10,8 @@ Be sure to have done the following before starting: 1. [Install `wasm-pack`](../../installer) 1. Read and install the [Prerequisites](../prerequisites/index.html). - - You'll need [Rust], version 1.30 or higher. (Currently either `beta` or `nightly` channels). [Learn more](../project-setup/rust.html). - - You'll need [Node.js] and [npm] installed. You'll also need an npm Account. [Learn more](../project-setup/npm.html). + - You'll need [Rust], version 1.30 or higher. (Currently either `beta` or `nightly` channels). [Learn more](../prerequisites/rust.html). + - You'll need [Node.js] and [npm] installed. You'll also need an npm Account. [Learn more](../prerequisites/npm.html). ⚠️ We strongly recommend that you install [Node.js] using a version manager. You can learn more [here](https://npmjs.com/get-npm). diff --git a/docs/src/tutorial/template-deep-dive/src-utils-rs.md b/docs/src/tutorial/template-deep-dive/src-utils-rs.md index 3ea5cb2..0ee271b 100644 --- a/docs/src/tutorial/template-deep-dive/src-utils-rs.md +++ b/docs/src/tutorial/template-deep-dive/src-utils-rs.md @@ -13,13 +13,13 @@ We will discuss: ## 1. Defining `set_panic_hook` -``` +```rust use cfg_if::cfg_if; ``` This allows us to write `cfg_if!` instead of `cfg_if::cfg_if!`, identically to the line in `src/lib.rs`. -``` +```rust cfg_if! { if #[cfg(feature = "console_error_panic_hook")] { extern crate console_error_panic_hook; @@ -35,14 +35,14 @@ As described in the preceding section, the macro `cfg_if!` evaluates the `if` st The entire macro block will either be replaced with the statements in the `if` block or with those in the `else` block. These two cases are now described in turn: -``` +```rust extern crate console_error_panic_hook; pub use self::console_error_panic_hook::set_once as set_panic_hook; ``` Due to the `use` statement, the function `self::console_error_panic_hook::set_once` can now be accessed more conveniently as `set_panic_hook`. Due to `pub`, this function will be publicly accessible outside of the `utils` module as `utils::set_panic_hook`. -``` +```rust #[inline] pub fn set_panic_hook() {} ``` @@ -63,4 +63,4 @@ To do this, a panic hook for WebAssembly is provided that logs panics to the dev Note that although the template sets up the function, your error messages will not automatically be enhanced. To enable the enhanced errors, call the function `utils::set_panic_hook()` in `lib.rs` when your code first runs. The function may be called multiple times if needed. -For more details, see the [`console_error_panic_hook` repository](https://github.com/rustwasm/console_error_panic_hook). \ No newline at end of file +For more details, see the [`console_error_panic_hook` repository](https://github.com/rustwasm/console_error_panic_hook). From ac746ef226794ac58629bb91b633c962e864eb81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Sat, 19 Jan 2019 16:10:03 +0100 Subject: [PATCH 084/106] doc: Use absolute url in prerequisites index --- docs/src/prerequisites/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/prerequisites/index.md b/docs/src/prerequisites/index.md index bc91b02..b56901a 100644 --- a/docs/src/prerequisites/index.md +++ b/docs/src/prerequisites/index.md @@ -2,8 +2,8 @@ To run `wasm-pack` you'll need to have both Rust and npm installed and configured. -- [Rust](./prerequisites/rust.html) -- [npm](./prerequisites/npm.html) +- [Rust](/wasm-pack/book/prerequisites/rust.html) +- [npm](/wasm-pack/book/prerequisites/npm.html) In the future, we intend to rewrite the npm registry client bits so that the need for a Node runtime is eliminated. If you're excited about that work- you should From f5f9d40c9172399d0289c1eb76721a791fa83f89 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Wed, 23 Jan 2019 14:58:07 -0800 Subject: [PATCH 085/106] Only print `cargo test` output the once Also introduces testing of our CLI's output via `assert_cmd`. Expect some follow ups to get more of our testing infrastructure using this incredible crate! Fixes #511 --- Cargo.lock | 89 ++++++++++++++++++++++++++++++++++++++ Cargo.toml | 2 + src/cache.rs | 14 ++++++ src/command/build.rs | 3 +- src/command/test.rs | 3 +- src/lib.rs | 1 + src/progressbar.rs | 7 +++ src/test/mod.rs | 24 ++++------ tests/all/main.rs | 2 + tests/all/test.rs | 42 ++++++++++++++++++ tests/all/utils/fixture.rs | 19 +++++++- 11 files changed, 187 insertions(+), 19 deletions(-) create mode 100644 src/cache.rs diff --git a/Cargo.lock b/Cargo.lock index 4ef603c..23f52ca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -36,6 +36,17 @@ dependencies = [ "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "assert_cmd" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "escargot 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "predicates 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "predicates-tree 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "atty" version = "0.2.11" @@ -289,6 +300,11 @@ dependencies = [ "tempfile 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "difference" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "dirs" version = "1.0.4" @@ -323,6 +339,15 @@ dependencies = [ "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "escargot" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "failure" version = "0.1.5" @@ -364,6 +389,14 @@ dependencies = [ "miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "float-cmp" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "foreign-types" version = "0.3.2" @@ -562,6 +595,16 @@ name = "nodrop" version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "normalize-line-endings" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "num-traits" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "openssl" version = "0.10.16" @@ -668,6 +711,32 @@ name = "podio" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "predicates" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "float-cmp 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "normalize-line-endings 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "predicates-core" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "predicates-tree" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "treeline 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "proc-macro2" version = "0.4.24" @@ -951,6 +1020,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "serde" version = "1.0.84" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "serde_derive" @@ -1173,6 +1245,11 @@ dependencies = [ "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "treeline" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "ucd-util" version = "0.1.3" @@ -1249,6 +1326,7 @@ dependencies = [ name = "wasm-pack" version = "0.6.0" dependencies = [ + "assert_cmd 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "binary-install 0.0.1", "cargo_metadata 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1265,6 +1343,7 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "predicates 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1367,6 +1446,7 @@ dependencies = [ "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392" "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" +"checksum assert_cmd 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b7ac5c260f75e4e4ba87b7342be6edcecbcb3eb6741a0507fda7ad115845cc65" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" "checksum autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4e5f34df7a019573fb8bdc7e24a2bfebe51a2a1d6bfdbaeccedb3c41fc574727" "checksum backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b5b493b66e03090ebc4343eb02f94ff944e0cbc9ac6571491d170ba026741eb5" @@ -1392,14 +1472,17 @@ dependencies = [ "checksum curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "c7c9d851c825e0c033979d4516c9173bc19a78a96eb4d6ae51d4045440eafa16" "checksum curl-sys 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ca79238a79fb294be6173b4057c95b22a718c94c4e38475d5faa82b8383f3502" "checksum dialoguer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1ad1c29a0368928e78c551354dbff79f103a962ad820519724ef0d74f1c62fa9" +"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" "checksum dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "88972de891f6118092b643d85a0b28e0678e0f948d7f879aa32f2d5aafe97d2a" "checksum encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "90b2c9496c001e8cb61827acdefad780795c42264c137744cae6f7d9e3450abd" "checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38" "checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" +"checksum escargot 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "19db1f7e74438642a5018cdf263bb1325b2e792f02dd0a3ca6d6c0f0d7b1d5a5" "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" "checksum filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a2df5c1a8c4be27e7707789dc42ae65976e60b394afd293d1419ab915833e646" "checksum flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2291c165c8e703ee54ef3055ad6188e3d51108e2ded18e9f2476e774fc5ad3d4" +"checksum float-cmp 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "134a8fa843d80a51a5b77d36d42bc2def9edcb0262c914861d08129fd1926600" "checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" "checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" @@ -1425,6 +1508,8 @@ dependencies = [ "checksum miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad30a47319c16cde58d0314f5d98202a80c9083b5f61178457403dfb14e509c" "checksum miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28edaef377517fd9fe3e085c37d892ce7acd1fbeab9239c5a36eec352d8a8b7e" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" +"checksum normalize-line-endings 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2e0a1a39eab95caf4f5556da9289b9e68f0aafac901b2ce80daaf020d3b733a8" +"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ec7bd7ca4cce6dbdc77e7c1230682740d307d1218a87fb0349a571272be749f9" "checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" "checksum openssl-src 111.1.0+1.1.1a (registry+https://github.com/rust-lang/crates.io-index)" = "26bb632127731bf4ac49bf86a5dde12d2ca0918c2234fc39d79d4da2ccbc6da7" @@ -1437,6 +1522,9 @@ dependencies = [ "checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" "checksum podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "780fb4b6698bbf9cf2444ea5d22411cef2953f0824b98f33cf454ec5615645bd" +"checksum predicates 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa984b7cd021a0bf5315bcce4c4ae61d2a535db2a8d288fc7578638690a7b7c3" +"checksum predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "06075c3a3e92559ff8929e7a280684489ea27fe44805174c3ebd9328dcb37178" +"checksum predicates-tree 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8e63c4859013b38a76eca2414c64911fba30def9e3202ac461a2d22831220124" "checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" @@ -1496,6 +1584,7 @@ dependencies = [ "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" +"checksum treeline 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41" "checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" "checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" diff --git a/Cargo.toml b/Cargo.toml index 14bdf5b..a031588 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,6 +38,8 @@ binary-install = { version = "0.0.1", path = "./binary-install" } walkdir = "2" [dev-dependencies] +assert_cmd = "0.10.2" +predicates = "1.0.0" tempfile = "3" [features] diff --git a/src/cache.rs b/src/cache.rs new file mode 100644 index 0000000..4e3c2d0 --- /dev/null +++ b/src/cache.rs @@ -0,0 +1,14 @@ +//! Getting and configuring wasm-pack's binary cache. + +use binary_install::Cache; +use std::env; +use std::path::Path; + +/// Get wasm-pack's binary cache. +pub fn get_wasm_pack_cache() -> Result { + if let Ok(path) = env::var("WASM_PACK_CACHE") { + Ok(Cache::at(Path::new(&path))) + } else { + Cache::new("wasm-pack") + } +} diff --git a/src/command/build.rs b/src/command/build.rs index c6bad24..ee59a75 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -3,6 +3,7 @@ use binary_install::{Cache, Download}; use bindgen; use build; +use cache; use command::utils::{create_pkg_dir, set_crate_path}; use emoji; use failure::Error; @@ -180,7 +181,7 @@ impl Build { mode: build_opts.mode, out_dir, bindgen: None, - cache: Cache::new("wasm_pack")?, + cache: cache::get_wasm_pack_cache()?, extra_options: build_opts.extra_options, }) } diff --git a/src/command/test.rs b/src/command/test.rs index e0837b1..ff2f348 100644 --- a/src/command/test.rs +++ b/src/command/test.rs @@ -4,6 +4,7 @@ use super::build::BuildMode; use binary_install::Cache; use bindgen; use build; +use cache; use command::utils::set_crate_path; use console::style; use emoji; @@ -132,7 +133,7 @@ impl Test { } Ok(Test { - cache: Cache::new("wasm_pack")?, + cache: cache::get_wasm_pack_cache()?, crate_path, crate_data, node, diff --git a/src/lib.rs b/src/lib.rs index 164988e..97b136f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -28,6 +28,7 @@ extern crate walkdir; pub mod bindgen; pub mod build; +pub mod cache; pub mod child; pub mod command; pub mod emoji; diff --git a/src/progressbar.rs b/src/progressbar.rs index 24a8947..f0c0e6a 100644 --- a/src/progressbar.rs +++ b/src/progressbar.rs @@ -43,6 +43,13 @@ impl ProgressOutput { let mut spinner = self.spinner.write(); *spinner = Self::progressbar(message); + + if !atty::is(atty::Stream::Stderr) { + // `indicatif` won't print any output if `stderr` is not a tty, so + // to ensure that our output is still emitted, we print it manually + // here. + eprintln!("{}", message) + } } fn add_message(&self, msg: &str) { diff --git a/src/test/mod.rs b/src/test/mod.rs index 0ec11e9..77eff43 100644 --- a/src/test/mod.rs +++ b/src/test/mod.rs @@ -4,7 +4,6 @@ pub mod webdriver; use child; use failure::{self, ResultExt}; -use log::info; use std::ffi::OsStr; use std::path::Path; use std::process::Command; @@ -17,20 +16,15 @@ where K: AsRef, V: AsRef, { - let output = { - let mut cmd = Command::new("cargo"); - cmd.envs(envs); - cmd.current_dir(path).arg("test"); - if release { - cmd.arg("--release"); - } - cmd.arg("--target").arg("wasm32-unknown-unknown"); - child::run(cmd, "cargo test").context("Running Wasm tests with wasm-bindgen-test failed")? - }; - - for line in output.lines() { - info!("test output: {}", line); - println!("{}", line); + let mut cmd = Command::new("cargo"); + cmd.envs(envs); + cmd.current_dir(path).arg("test"); + if release { + cmd.arg("--release"); } + cmd.arg("--target").arg("wasm32-unknown-unknown"); + child::run(cmd, "cargo test").context("Running Wasm tests with wasm-bindgen-test failed")?; + + // NB: `child::run` took care of ensuring that test output gets printed. Ok(()) } diff --git a/tests/all/main.rs b/tests/all/main.rs index 06806cd..a01018b 100644 --- a/tests/all/main.rs +++ b/tests/all/main.rs @@ -1,4 +1,6 @@ +extern crate assert_cmd; extern crate failure; +extern crate predicates; #[macro_use] extern crate lazy_static; #[macro_use] diff --git a/tests/all/test.rs b/tests/all/test.rs index 278959a..b438fcd 100644 --- a/tests/all/test.rs +++ b/tests/all/test.rs @@ -1,4 +1,6 @@ +use assert_cmd::prelude::*; use failure::Error; +use predicates::prelude::*; use std::env; use utils::fixture; use wasm_pack::command::{build, test, Command}; @@ -334,3 +336,43 @@ fn cdylib_not_required() { }); fixture.run(cmd).unwrap(); } + +#[test] +fn test_output_is_printed_once() { + let fixture = fixture::Fixture::new(); + fixture + .readme() + .cargo_toml("wbg-test-node") + .hello_world_src_lib() + .file( + "tests/node.rs", + r#" + extern crate wasm_bindgen; + extern crate wasm_bindgen_test; + use wasm_bindgen::prelude::*; + use wasm_bindgen_test::*; + + #[wasm_bindgen] + extern { + #[wasm_bindgen(js_namespace = console)] + fn log(s: &str); + } + + #[wasm_bindgen_test] + fn pass() { + log("YABBA DABBA DOO"); + assert_eq!(1, 2); + } + "#, + ); + + fixture + .wasm_pack() + .arg("test") + .arg("--node") + .assert() + .stderr(predicate::function(|err: &str| { + err.matches("YABBA DABBA DOO").count() == 1 + })) + .failure(); +} diff --git a/tests/all/utils/fixture.rs b/tests/all/utils/fixture.rs index def8e8c..3eee609 100644 --- a/tests/all/utils/fixture.rs +++ b/tests/all/utils/fixture.rs @@ -218,9 +218,14 @@ impl Fixture { wasm_pack::test::webdriver::install_chromedriver(&cache, true).unwrap() } + pub fn cache_dir(&self) -> PathBuf { + Path::new(env!("CARGO_MANIFEST_DIR")) + .join("target") + .join("test_cache") + } + pub fn cache(&self) -> Cache { - let target_dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("target"); - Cache::at(&target_dir.join("test_cache")) + Cache::at(&self.cache_dir()) } /// The `step_install_wasm_bindgen` and `step_run_wasm_bindgen` steps only @@ -257,6 +262,16 @@ impl Fixture { } } + /// Get a `wasm-pack` command configured to run in this fixure's temp + /// directory and using the test cache. + pub fn wasm_pack(&self) -> Command { + use assert_cmd::prelude::*; + let mut cmd = Command::main_binary().unwrap(); + cmd.current_dir(&self.path); + cmd.env("WASM_PACK_CACHE", self.cache_dir()); + cmd + } + pub fn lock(&self) -> MutexGuard<'static, ()> { use std::sync::Mutex; lazy_static! { From fee93bc9651ed6b9d266d928144b97049ec5c599 Mon Sep 17 00:00:00 2001 From: rhysd Date: Sun, 27 Jan 2019 03:15:36 +0900 Subject: [PATCH 086/106] use license-file field for license field of package.json when no license field in Cargo.toml In 'license' field of package.json, it's ok to say 'license is written in some file' as follows: ``` { "license" : "SEE LICENSE IN " } ``` This notation is useful when 'license' field is missing in `Cargo.toml` but `license-file` field is provided. Ref: https://docs.npmjs.com/files/package.json#license --- src/manifest/mod.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/manifest/mod.rs b/src/manifest/mod.rs index 92f03cd..4bc7f7c 100644 --- a/src/manifest/mod.rs +++ b/src/manifest/mod.rs @@ -40,6 +40,7 @@ struct CargoPackage { name: String, description: Option, license: Option, + license_file: Option, repository: Option, #[serde(default)] @@ -425,6 +426,15 @@ impl CrateData { } } + fn license(&self) -> Option { + self.manifest.package.license.clone().or_else(|| { + self.manifest.package.license_file.clone().map(|file| { + // When license is written in file: https://docs.npmjs.com/files/package.json#license + format!("SEE LICENSE IN {}", file) + }) + }) + } + fn to_commonjs(&self, scope: &Option, disable_dts: bool) -> NpmPackage { let data = self.npm_data(scope, true, disable_dts); let pkg = &self.data.packages[self.current_idx]; @@ -436,7 +446,7 @@ impl CrateData { collaborators: pkg.authors.clone(), description: self.manifest.package.description.clone(), version: pkg.version.clone(), - license: self.manifest.package.license.clone(), + license: self.license(), repository: self .manifest .package @@ -463,7 +473,7 @@ impl CrateData { collaborators: pkg.authors.clone(), description: self.manifest.package.description.clone(), version: pkg.version.clone(), - license: self.manifest.package.license.clone(), + license: self.license(), repository: self .manifest .package @@ -491,7 +501,7 @@ impl CrateData { collaborators: pkg.authors.clone(), description: self.manifest.package.description.clone(), version: pkg.version.clone(), - license: self.manifest.package.license.clone(), + license: self.license(), repository: self .manifest .package From 9fa5139caf1783ecda8159037e18f7e2abb08d3d Mon Sep 17 00:00:00 2001 From: rhysd Date: Sun, 27 Jan 2019 03:46:19 +0900 Subject: [PATCH 087/106] be aware of license-file field as source of license 'license-file' field is provided in Cargo.toml for providing path of license file. https://doc.rust-lang.org/cargo/reference/manifest.html --- src/license.rs | 13 ++++++++++--- src/manifest/mod.rs | 5 +++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/license.rs b/src/license.rs index 2099c64..ee5f20b 100644 --- a/src/license.rs +++ b/src/license.rs @@ -57,8 +57,8 @@ pub fn copy_from_crate( "crate's pkg directory should exist" ); - match crate_data.crate_license() { - Some(_) => { + match (crate_data.crate_license(), crate_data.crate_license_file()) { + (Some(_), _) => { let msg = format!("{}Copying over your LICENSE...", emoji::DANCERS); PBAR.step(step, &msg); let license_files = glob_license_files(path); @@ -80,7 +80,14 @@ pub fn copy_from_crate( Err(_) => PBAR.info("origin crate has no LICENSE"), } } - None => { + (None, Some(license_file)) => { + let crate_license_path = path.join(&license_file); + let new_license_path = out_dir.join(&license_file); + if fs::copy(&crate_license_path, &new_license_path).is_err() { + PBAR.info("origin crate has no LICENSE"); + } + } + (None, None) => { PBAR.step(step, "No LICENSE found in Cargo.toml, skipping..."); } }; diff --git a/src/manifest/mod.rs b/src/manifest/mod.rs index 4bc7f7c..7d76ba8 100644 --- a/src/manifest/mod.rs +++ b/src/manifest/mod.rs @@ -350,6 +350,11 @@ impl CrateData { &self.manifest.package.license } + /// Get the license file path for the crate at the given path. + pub fn crate_license_file(&self) -> &Option { + &self.manifest.package.license_file + } + /// Returns the path to this project's target directory where artifacts are /// located after a cargo build. pub fn target_directory(&self) -> &Path { From 5f515dcf68ec26eb7755f4f6f1e3b79c372b2cb6 Mon Sep 17 00:00:00 2001 From: rhysd Date: Sun, 27 Jan 2019 04:29:59 +0900 Subject: [PATCH 088/106] add a test case for non-standard license file field --- src/manifest/mod.rs | 1 + tests/all/license.rs | 29 ++++++++++++++++++++++++- tests/all/utils/fixture.rs | 43 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 1 deletion(-) diff --git a/src/manifest/mod.rs b/src/manifest/mod.rs index 7d76ba8..7b07986 100644 --- a/src/manifest/mod.rs +++ b/src/manifest/mod.rs @@ -40,6 +40,7 @@ struct CargoPackage { name: String, description: Option, license: Option, + #[serde(rename = "license-file")] license_file: Option, repository: Option, diff --git a/tests/all/license.rs b/tests/all/license.rs index ac7d377..5b7cd28 100644 --- a/tests/all/license.rs +++ b/tests/all/license.rs @@ -34,7 +34,7 @@ fn it_copies_a_license_default_path() { } #[test] -fn it_copies_a_license_provied_path() { +fn it_copies_a_license_provided_path() { let fixture = fixture::single_license(); let out_dir = fixture.path.join("pkg"); fs::create_dir(&out_dir).expect("should create pkg directory OK"); @@ -128,3 +128,30 @@ fn it_copies_all_licenses_provided_path() { let pkg_license_2 = utils::file::read_file(&pkg_license_path_2).unwrap(); assert_eq!(crate_license_2, pkg_license_2); } + +#[test] +fn it_copies_a_non_standard_license_provided_path() { + let license_file = "NON-STANDARD-LICENSE"; + let fixture = fixture::non_standard_license(license_file); + let out_dir = fixture.path.join("pkg"); + fs::create_dir(&out_dir).expect("should create pkg directory OK"); + let crate_data = CrateData::new(&fixture.path); + + let step = wasm_pack::progressbar::Step::new(1); + assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir, &step).is_ok()); + + let crate_license_path = fixture.path.join(license_file); + let pkg_license_path = out_dir.join(license_file); + println!( + "wasm-pack: should have copied LICENSE from '{}' to '{}'", + crate_license_path.display(), + pkg_license_path.display() + ); + assert!(fs::metadata(&crate_license_path).is_ok()); + + assert!(fs::metadata(&pkg_license_path).is_ok()); + + let crate_license = utils::file::read_file(&crate_license_path).unwrap(); + let pkg_license = utils::file::read_file(&pkg_license_path).unwrap(); + assert_eq!(crate_license, pkg_license); +} diff --git a/tests/all/utils/fixture.rs b/tests/all/utils/fixture.rs index 3eee609..f157b9b 100644 --- a/tests/all/utils/fixture.rs +++ b/tests/all/utils/fixture.rs @@ -137,6 +137,39 @@ impl Fixture { ) } + /// Add a `Cargo.toml` with a correctly configured `wasm-bindgen` + /// dependency, `wasm-bindgen-test` dev-dependency, and `crate-type = + /// ["cdylib"]`. + /// + /// `name` is the crate's name. + /// `license_file` is license file path + pub fn cargo_toml_with_license_file(&self, name: &str, license_file: &str) -> &Self { + self.file( + "Cargo.toml", + &format!( + r#" + [package] + authors = ["The wasm-pack developers"] + description = "so awesome rust+wasm package" + name = "{}" + license-file = "{}" + repository = "https://github.com/rustwasm/wasm-pack.git" + version = "0.1.0" + + [lib] + crate-type = ["cdylib"] + + [dependencies] + wasm-bindgen = "=0.2.21" + + [dev-dependencies] + wasm-bindgen-test = "=0.2.21" + "#, + name, license_file + ), + ) + } + /// Add a `src/lib.rs` file that contains a "hello world" program. pub fn hello_world_src_lib(&self) -> &Self { self.file( @@ -661,3 +694,13 @@ pub fn dual_license() -> Fixture { .hello_world_src_lib(); fixture } + +pub fn non_standard_license(license_file: &str) -> Fixture { + let fixture = Fixture::new(); + fixture + .readme() + .cargo_toml_with_license_file("dual_license", license_file) + .file(license_file, "license file for test") + .hello_world_src_lib(); + fixture +} From 6dbcba22e8cfb30cccb1920829014db6d86c2e6d Mon Sep 17 00:00:00 2001 From: rhysd Date: Sun, 27 Jan 2019 14:25:03 +0900 Subject: [PATCH 089/106] include README.md and license files in 'files' field of package.json --- src/command/build.rs | 10 +++++----- src/manifest/mod.rs | 46 +++++++++++++++++++++++++++++++++++--------- 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/src/command/build.rs b/src/command/build.rs index ee59a75..76d0a61 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -239,29 +239,29 @@ impl Build { step_add_wasm_target, step_build_wasm, step_create_dir, - step_create_json, step_copy_readme, step_copy_license, step_install_wasm_bindgen, step_run_wasm_bindgen, + step_create_json, ], BuildMode::Noinstall => steps![ step_check_rustc_version, step_check_crate_config, step_build_wasm, step_create_dir, - step_create_json, step_copy_readme, step_copy_license, - step_run_wasm_bindgen + step_run_wasm_bindgen, + step_create_json, ], BuildMode::Force => steps![ step_build_wasm, step_create_dir, - step_create_json, step_copy_readme, step_copy_license, - step_run_wasm_bindgen + step_run_wasm_bindgen, + step_create_json, ], } } diff --git a/src/manifest/mod.rs b/src/manifest/mod.rs index 92f03cd..9b0762e 100644 --- a/src/manifest/mod.rs +++ b/src/manifest/mod.rs @@ -374,11 +374,11 @@ impl CrateData { PBAR.step(step, &msg); let pkg_file_path = out_dir.join("package.json"); let npm_data = if target == "nodejs" { - self.to_commonjs(scope, disable_dts) + self.to_commonjs(scope, disable_dts, out_dir) } else if target == "no-modules" { - self.to_nomodules(scope, disable_dts) + self.to_nomodules(scope, disable_dts, out_dir) } else { - self.to_esmodules(scope, disable_dts) + self.to_esmodules(scope, disable_dts, out_dir) }; let npm_json = serde_json::to_string_pretty(&npm_data)?; @@ -392,6 +392,7 @@ impl CrateData { scope: &Option, include_commonjs_shim: bool, disable_dts: bool, + out_dir: &Path, ) -> NpmData { let crate_name = self.crate_name(); let wasm_file = format!("{}_bg.wasm", crate_name); @@ -417,6 +418,23 @@ impl CrateData { } else { None }; + + let readme_file = out_dir.join("README.md"); + if readme_file.is_file() { + files.push("README.md".to_string()); + } + + if let Ok(entries) = fs::read_dir(out_dir) { + let file_names = entries + .filter_map(|e| e.ok()) + .filter(|e| e.metadata().map(|m| m.is_file()).unwrap_or(false)) + .filter_map(|e| e.file_name().into_string().ok()) + .filter(|f| f.starts_with("LICENSE")); + for file_name in file_names { + files.push(file_name); + } + } + NpmData { name: npm_name, dts_file, @@ -425,8 +443,8 @@ impl CrateData { } } - fn to_commonjs(&self, scope: &Option, disable_dts: bool) -> NpmPackage { - let data = self.npm_data(scope, true, disable_dts); + fn to_commonjs(&self, scope: &Option, disable_dts: bool, out_dir: &Path) -> NpmPackage { + let data = self.npm_data(scope, true, disable_dts, out_dir); let pkg = &self.data.packages[self.current_idx]; self.check_optional_fields(); @@ -452,8 +470,13 @@ impl CrateData { }) } - fn to_esmodules(&self, scope: &Option, disable_dts: bool) -> NpmPackage { - let data = self.npm_data(scope, false, disable_dts); + fn to_esmodules( + &self, + scope: &Option, + disable_dts: bool, + out_dir: &Path, + ) -> NpmPackage { + let data = self.npm_data(scope, false, disable_dts, out_dir); let pkg = &self.data.packages[self.current_idx]; self.check_optional_fields(); @@ -480,8 +503,13 @@ impl CrateData { }) } - fn to_nomodules(&self, scope: &Option, disable_dts: bool) -> NpmPackage { - let data = self.npm_data(scope, false, disable_dts); + fn to_nomodules( + &self, + scope: &Option, + disable_dts: bool, + out_dir: &Path, + ) -> NpmPackage { + let data = self.npm_data(scope, false, disable_dts, out_dir); let pkg = &self.data.packages[self.current_idx]; self.check_optional_fields(); From e724b0136563d46eed8e5d7dfa52c91ae8d72eac Mon Sep 17 00:00:00 2001 From: rhysd Date: Sun, 27 Jan 2019 15:14:54 +0900 Subject: [PATCH 090/106] add tests to check README and licenses are in 'files' field --- tests/all/manifest.rs | 63 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/tests/all/manifest.rs b/tests/all/manifest.rs index 1d631c8..8373113 100644 --- a/tests/all/manifest.rs +++ b/tests/all/manifest.rs @@ -5,7 +5,7 @@ use std::path::PathBuf; use structopt::StructOpt; use utils::{self, fixture}; -use wasm_pack::{self, manifest, Cli}; +use wasm_pack::{self, license, manifest, readme, Cli}; #[test] fn it_gets_the_crate_name_default_path() { @@ -368,3 +368,64 @@ fn parse_crate_data_returns_unused_keys_in_cargo_toml() { assert!(unused_keys.contains("package.metadata.wasm-pack.profile.production")); } + +#[test] +fn it_lists_license_files_in_files_field_of_package_json() { + let fixture = fixture::dual_license(); + let out_dir = fixture.path.join("pkg"); + + let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); + + let step = wasm_pack::progressbar::Step::new(3); + wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); + license::copy_from_crate(&crate_data, &fixture.path, &out_dir, &step).unwrap(); + crate_data + .write_package_json(&out_dir, &None, false, "", &step) + .unwrap(); + + let package_json_path = &fixture.path.join("pkg").join("package.json"); + fs::metadata(package_json_path).unwrap(); + let pkg = utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); + + assert!( + pkg.files.contains(&"LICENSE-WTFPL".to_string()), + "LICENSE-WTFPL is not in files: {:?}", + pkg.files, + ); + + assert!( + pkg.files.contains(&"LICENSE-MIT".to_string()), + "LICENSE-MIT is not in files: {:?}", + pkg.files, + ); +} + +#[test] +fn it_lists_readme_in_files_field_of_package_json() { + let fixture = utils::fixture::Fixture::new(); + fixture + .readme() + .hello_world_src_lib() + .cargo_toml("readme-test-for-package-json"); + + let out_dir = fixture.path.join("pkg"); + + let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); + + let step = wasm_pack::progressbar::Step::new(3); + wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); + readme::copy_from_crate(&fixture.path, &out_dir, &step).unwrap(); + crate_data + .write_package_json(&out_dir, &None, false, "", &step) + .unwrap(); + + let package_json_path = &fixture.path.join("pkg").join("package.json"); + fs::metadata(package_json_path).unwrap(); + let pkg = utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); + + assert!( + pkg.files.contains(&"README.md".to_string()), + "README.md is not in files: {:?}", + pkg.files, + ); +} From b72051d385fe178cbb95865942bc42b983665a63 Mon Sep 17 00:00:00 2001 From: Chinedu Francis Nwafili Date: Sun, 27 Jan 2019 10:08:56 -0500 Subject: [PATCH 091/106] Pass arguments through to cargo test --- docs/src/commands/build.md | 2 +- docs/src/commands/test.md | 54 ++++++++++++++++++++++++++++++++++++++ src/build.rs | 12 --------- src/command/build.rs | 2 +- src/command/test.rs | 27 ++++++++----------- src/test/mod.rs | 8 +++++- 6 files changed, 74 insertions(+), 31 deletions(-) create mode 100644 docs/src/commands/test.md diff --git a/docs/src/commands/build.md b/docs/src/commands/build.md index 96371fc..49b4540 100644 --- a/docs/src/commands/build.md +++ b/docs/src/commands/build.md @@ -59,7 +59,7 @@ wasm-pack build --target nodejs | Option | Description | |-----------|-----------------------------------------------------------------------------------------------------------------| | `nodejs` | Outputs JS that uses CommonJS modules, for use with a `require` statement. `main` key in `package.json`. | -| `nomodules` | Outputs JS that use no modules. `browser` key in `package.json`. | +| `no-modules` | Outputs JS that use no modules. `browser` key in `package.json`. | | `browser` | Outputs JS that uses ES6 modules, primarily for use with `import` statements and/or bundlers such as `webpack`. `module` key in `package.json`. `sideEffects: false` by default. | ## Scope diff --git a/docs/src/commands/test.md b/docs/src/commands/test.md new file mode 100644 index 0000000..5f679ce --- /dev/null +++ b/docs/src/commands/test.md @@ -0,0 +1,54 @@ +# wasm-pack test + +The `wasm-pack test` command wraps the [wasm-bindgen-test-runner](https://rustwasm.github.io/wasm-bindgen/wasm-bindgen-test/index.html) +CLI allowing you to run wasm tests in different browsers without needing to install the different +webdrivers yourself. + +``` +wasm-pack test --help +``` + +## Path + +The `wasm-pack test` command can be given an optional path argument. + +This path should point to a directory that contains a `Cargo.toml` file. If no +path is given, the `test` command will run in the current directory. + +``` +# Run tests for the current directory's crate +wasm-pack test + +# Run tests for a specified crate +wasm-pack test crates/crate-in-my-workspace +``` + +## Profile + +The `test` command accepts an optional profile argument: `--release`. + +If none is supplied, then a debug test build will be used. + +## Test environment + +Choose where to run your tests by passing in any combination of testing environment flags. + +`--headless` is useful for running browser tests in a headless browser as part of a CI process. + +``` +wasm-pack test --node --firefox --chrome --safari --headless +``` + +## Extra options + +The `test` command can pass extra options straight to `cargo test` even if they are not +supported in wasm-pack. + +To use them you should add standalone `--` argument at the very +end of your command, and all the arguments you want to pass to cargo should go after. + +Here's an example of running only tests that contain the world "apple". + +``` +wasm-pack test --firefox --headless -- --manifest-path=crates/my-workspace-crate/Cargo.toml apple +``` diff --git a/src/build.rs b/src/build.rs index 9e29c6d..e0fb1ca 100644 --- a/src/build.rs +++ b/src/build.rs @@ -93,15 +93,3 @@ pub fn cargo_build_wasm( child::run(cmd, "cargo build").context("Compiling your crate to WebAssembly failed")?; Ok(()) } - -/// Run `cargo build --tests` targetting `wasm32-unknown-unknown`. -pub fn cargo_build_wasm_tests(path: &Path, debug: bool) -> Result<(), Error> { - let mut cmd = Command::new("cargo"); - cmd.current_dir(path).arg("build").arg("--tests"); - if !debug { - cmd.arg("--release"); - } - cmd.arg("--target").arg("wasm32-unknown-unknown"); - child::run(cmd, "cargo build").context("Compilation of your program failed")?; - Ok(()) -} diff --git a/src/command/build.rs b/src/command/build.rs index ee59a75..4dd5d79 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -19,7 +19,7 @@ use std::str::FromStr; use std::time::Instant; use PBAR; -/// Everything required to configure and run the `wasm-pack init` command. +/// Everything required to configure and run the `wasm-pack build` command. #[allow(missing_docs)] pub struct Build { pub crate_path: PathBuf, diff --git a/src/command/test.rs b/src/command/test.rs index ff2f348..7c492b4 100644 --- a/src/command/test.rs +++ b/src/command/test.rs @@ -78,6 +78,10 @@ pub struct TestOptions { #[structopt(long = "release", short = "r")] /// Build with the release profile. pub release: bool, + + #[structopt(last = true)] + /// List of extra options to pass to `cargo test` + pub extra_options: Vec, } /// A configured `wasm-pack test` command. @@ -96,6 +100,7 @@ pub struct Test { headless: bool, release: bool, test_runner_path: Option, + extra_options: Vec } type TestStep = fn(&mut Test, &Step) -> Result<(), Error>; @@ -115,6 +120,7 @@ impl Test { geckodriver, safari, safaridriver, + extra_options, } = test_opts; let crate_path = set_crate_path(path)?; @@ -147,6 +153,7 @@ impl Test { headless, release, test_runner_path: None, + extra_options, }) } @@ -213,7 +220,6 @@ impl Test { step_test_safari if self.safari, ], BuildMode::Noinstall => steps![ - step_build_tests, step_install_wasm_bindgen, step_test_node if self.node, step_get_chromedriver if self.chrome && self.chromedriver.is_none(), @@ -240,18 +246,6 @@ impl Test { Ok(()) } - fn step_build_tests(&mut self, step: &Step) -> Result<(), Error> { - info!("Compiling tests to wasm..."); - - let msg = format!("{}Compiling tests to WASM...", emoji::CYCLONE); - PBAR.step(step, &msg); - - build::cargo_build_wasm_tests(&self.crate_path, !self.release)?; - - info!("Finished compiling tests to wasm."); - Ok(()) - } - fn step_install_wasm_bindgen(&mut self, step: &Step) -> Result<(), Error> { info!("Identifying wasm-bindgen dependency..."); let lockfile = Lockfile::new(&self.crate_data)?; @@ -306,6 +300,7 @@ impl Test { "CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER", &self.test_runner_path.as_ref().unwrap(), )), + &self.extra_options )?; info!("Finished running tests in node."); Ok(()) @@ -349,7 +344,7 @@ impl Test { envs.push(("NO_HEADLESS", "1")); } - test::cargo_test_wasm(&self.crate_path, self.release, envs)?; + test::cargo_test_wasm(&self.crate_path, self.release, envs, &self.extra_options)?; Ok(()) } @@ -391,7 +386,7 @@ impl Test { envs.push(("NO_HEADLESS", "1")); } - test::cargo_test_wasm(&self.crate_path, self.release, envs)?; + test::cargo_test_wasm(&self.crate_path, self.release, envs, &self.extra_options)?; Ok(()) } @@ -430,7 +425,7 @@ impl Test { envs.push(("NO_HEADLESS", "1")); } - test::cargo_test_wasm(&self.crate_path, self.release, envs)?; + test::cargo_test_wasm(&self.crate_path, self.release, envs, &self.extra_options)?; Ok(()) } } diff --git a/src/test/mod.rs b/src/test/mod.rs index 77eff43..7448567 100644 --- a/src/test/mod.rs +++ b/src/test/mod.rs @@ -10,7 +10,12 @@ use std::process::Command; /// Run `cargo test` with the `nightly` toolchain and targeting /// `wasm32-unknown-unknown`. -pub fn cargo_test_wasm(path: &Path, release: bool, envs: I) -> Result<(), failure::Error> +pub fn cargo_test_wasm( + path: &Path, + release: bool, + envs: I, + extra_options: &Vec, +) -> Result<(), failure::Error> where I: IntoIterator, K: AsRef, @@ -23,6 +28,7 @@ where cmd.arg("--release"); } cmd.arg("--target").arg("wasm32-unknown-unknown"); + cmd.args(extra_options); child::run(cmd, "cargo test").context("Running Wasm tests with wasm-bindgen-test failed")?; // NB: `child::run` took care of ensuring that test output gets printed. From 42413acb493d8d939143d0db14e6ddc4d6197ea4 Mon Sep 17 00:00:00 2001 From: Chinedu Francis Nwafili Date: Sun, 27 Jan 2019 10:29:48 -0500 Subject: [PATCH 092/106] cargo fmt --- src/command/test.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/command/test.rs b/src/command/test.rs index 7c492b4..829f3d3 100644 --- a/src/command/test.rs +++ b/src/command/test.rs @@ -100,7 +100,7 @@ pub struct Test { headless: bool, release: bool, test_runner_path: Option, - extra_options: Vec + extra_options: Vec, } type TestStep = fn(&mut Test, &Step) -> Result<(), Error>; @@ -197,7 +197,6 @@ impl Test { BuildMode::Normal => steps![ step_check_rustc_version, step_add_wasm_target, - step_build_tests, step_install_wasm_bindgen, step_test_node if self.node, step_get_chromedriver if self.chrome && self.chromedriver.is_none(), @@ -209,7 +208,6 @@ impl Test { ], BuildMode::Force => steps![ step_add_wasm_target, - step_build_tests, step_install_wasm_bindgen, step_test_node if self.node, step_get_chromedriver if self.chrome && self.chromedriver.is_none(), @@ -300,7 +298,7 @@ impl Test { "CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER", &self.test_runner_path.as_ref().unwrap(), )), - &self.extra_options + &self.extra_options, )?; info!("Finished running tests in node."); Ok(()) From f7ad0e7c5a133fbd154864a0de1855ee3b8af6f0 Mon Sep 17 00:00:00 2001 From: Chinedu Francis Nwafili Date: Sun, 27 Jan 2019 10:31:15 -0500 Subject: [PATCH 093/106] Add instructions for options --- docs/src/commands/test.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/src/commands/test.md b/docs/src/commands/test.md index 5f679ce..ec8663f 100644 --- a/docs/src/commands/test.md +++ b/docs/src/commands/test.md @@ -52,3 +52,5 @@ Here's an example of running only tests that contain the world "apple". ``` wasm-pack test --firefox --headless -- --manifest-path=crates/my-workspace-crate/Cargo.toml apple ``` + +`cargo test -h` for a list of all options that you can pass through. From 879e3aa7a68a793d6c871967380137b42c1fddfc Mon Sep 17 00:00:00 2001 From: Chinedu Francis Nwafili Date: Sun, 27 Jan 2019 11:44:01 -0500 Subject: [PATCH 094/106] Add back building tests --- src/build.rs | 17 ++++++++++++++++- src/command/test.rs | 15 +++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/build.rs b/src/build.rs index e0fb1ca..e706b6a 100644 --- a/src/build.rs +++ b/src/build.rs @@ -25,7 +25,7 @@ pub fn check_rustc_version(step: &Step) -> Result { } else { Ok(mv.to_string()) } - }, + } None => bail!("We can't figure out what your Rust version is- which means you might not have Rust installed. Please install Rust version 1.30.0 or higher."), } } @@ -93,3 +93,18 @@ pub fn cargo_build_wasm( child::run(cmd, "cargo build").context("Compiling your crate to WebAssembly failed")?; Ok(()) } + +/// Run `cargo build --tests` targetting `wasm32-unknown-unknown`. +/// +/// This generates the `Cargo.lock` file that we use in order to know which version of +/// wasm-bindgen-cli to use when running tests. +pub fn cargo_build_wasm_tests(path: &Path, debug: bool) -> Result<(), Error> { + let mut cmd = Command::new("cargo"); + cmd.current_dir(path).arg("build").arg("--tests"); + if !debug { + cmd.arg("--release"); + } + cmd.arg("--target").arg("wasm32-unknown-unknown"); + child::run(cmd, "cargo build").context("Compilation of your program failed")?; + Ok(()) +} diff --git a/src/command/test.rs b/src/command/test.rs index 829f3d3..45950fc 100644 --- a/src/command/test.rs +++ b/src/command/test.rs @@ -197,6 +197,7 @@ impl Test { BuildMode::Normal => steps![ step_check_rustc_version, step_add_wasm_target, + step_build_tests, step_install_wasm_bindgen, step_test_node if self.node, step_get_chromedriver if self.chrome && self.chromedriver.is_none(), @@ -208,6 +209,7 @@ impl Test { ], BuildMode::Force => steps![ step_add_wasm_target, + step_build_tests, step_install_wasm_bindgen, step_test_node if self.node, step_get_chromedriver if self.chrome && self.chromedriver.is_none(), @@ -218,6 +220,7 @@ impl Test { step_test_safari if self.safari, ], BuildMode::Noinstall => steps![ + step_build_tests, step_install_wasm_bindgen, step_test_node if self.node, step_get_chromedriver if self.chrome && self.chromedriver.is_none(), @@ -244,6 +247,18 @@ impl Test { Ok(()) } + fn step_build_tests(&mut self, step: &Step) -> Result<(), Error> { + info!("Compiling tests to wasm..."); + + let msg = format!("{}Compiling tests to WASM...", emoji::CYCLONE); + PBAR.step(step, &msg); + + build::cargo_build_wasm_tests(&self.crate_path, !self.release)?; + + info!("Finished compiling tests to wasm."); + Ok(()) + } + fn step_install_wasm_bindgen(&mut self, step: &Step) -> Result<(), Error> { info!("Identifying wasm-bindgen dependency..."); let lockfile = Lockfile::new(&self.crate_data)?; From 3f06d2d959d7e51dabd7410cababd629cff3217e Mon Sep 17 00:00:00 2001 From: Chinedu Francis Nwafili Date: Sun, 27 Jan 2019 11:44:59 -0500 Subject: [PATCH 095/106] Fix formatting --- src/command/test.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/command/test.rs b/src/command/test.rs index 45950fc..f07d4a9 100644 --- a/src/command/test.rs +++ b/src/command/test.rs @@ -197,7 +197,7 @@ impl Test { BuildMode::Normal => steps![ step_check_rustc_version, step_add_wasm_target, - step_build_tests, + step_build_tests, step_install_wasm_bindgen, step_test_node if self.node, step_get_chromedriver if self.chrome && self.chromedriver.is_none(), @@ -220,7 +220,7 @@ impl Test { step_test_safari if self.safari, ], BuildMode::Noinstall => steps![ - step_build_tests, + step_build_tests, step_install_wasm_bindgen, step_test_node if self.node, step_get_chromedriver if self.chrome && self.chromedriver.is_none(), From bae98ef92a893522fa4e69b965a3f70e3b8a676d Mon Sep 17 00:00:00 2001 From: rhysd Date: Mon, 28 Jan 2019 03:39:22 +0900 Subject: [PATCH 096/106] copy 'homepage' field from Cargo.toml to package.json - Cargo.toml - https://doc.rust-lang.org/cargo/reference/manifest.html - package.json - https://docs.npmjs.com/files/package.json#homepage --- src/manifest/mod.rs | 6 ++++++ src/manifest/npm/commonjs.rs | 2 ++ src/manifest/npm/esmodules.rs | 2 ++ src/manifest/npm/nomodules.rs | 2 ++ 4 files changed, 12 insertions(+) diff --git a/src/manifest/mod.rs b/src/manifest/mod.rs index 92f03cd..2f7b964 100644 --- a/src/manifest/mod.rs +++ b/src/manifest/mod.rs @@ -41,6 +41,7 @@ struct CargoPackage { description: Option, license: Option, repository: Option, + homepage: Option, #[serde(default)] metadata: CargoMetadata, @@ -199,6 +200,7 @@ struct NpmData { files: Vec, dts_file: Option, main: String, + homepage: Option, // https://docs.npmjs.com/files/package.json#homepage } #[doc(hidden)] @@ -422,6 +424,7 @@ impl CrateData { dts_file, files, main: js_file, + homepage: self.manifest.package.homepage.clone(), } } @@ -448,6 +451,7 @@ impl CrateData { }), files: data.files, main: data.main, + homepage: data.homepage, types: data.dts_file, }) } @@ -475,6 +479,7 @@ impl CrateData { }), files: data.files, module: data.main, + homepage: data.homepage, types: data.dts_file, side_effects: "false".to_string(), }) @@ -503,6 +508,7 @@ impl CrateData { }), files: data.files, browser: data.main, + homepage: data.homepage, types: data.dts_file, }) } diff --git a/src/manifest/npm/commonjs.rs b/src/manifest/npm/commonjs.rs index ed8b8f9..8d8ce8b 100644 --- a/src/manifest/npm/commonjs.rs +++ b/src/manifest/npm/commonjs.rs @@ -16,5 +16,7 @@ pub struct CommonJSPackage { pub files: Vec, pub main: String, #[serde(skip_serializing_if = "Option::is_none")] + pub homepage: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub types: Option, } diff --git a/src/manifest/npm/esmodules.rs b/src/manifest/npm/esmodules.rs index df73964..cd715ca 100644 --- a/src/manifest/npm/esmodules.rs +++ b/src/manifest/npm/esmodules.rs @@ -16,6 +16,8 @@ pub struct ESModulesPackage { pub files: Vec, pub module: String, #[serde(skip_serializing_if = "Option::is_none")] + pub homepage: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub types: Option, #[serde(rename = "sideEffects")] pub side_effects: String, diff --git a/src/manifest/npm/nomodules.rs b/src/manifest/npm/nomodules.rs index 696a74b..913e97e 100644 --- a/src/manifest/npm/nomodules.rs +++ b/src/manifest/npm/nomodules.rs @@ -16,5 +16,7 @@ pub struct NoModulesPackage { pub files: Vec, pub browser: String, #[serde(skip_serializing_if = "Option::is_none")] + pub homepage: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub types: Option, } From 835ce11023843859cd7439686bd8d7e535e5bf90 Mon Sep 17 00:00:00 2001 From: rhysd Date: Mon, 28 Jan 2019 03:53:50 +0900 Subject: [PATCH 097/106] add test case for copying 'homepage' field from Cargo.toml to package.json --- tests/all/manifest.rs | 57 +++++++++++++++++++++++++++++++++++++ tests/all/utils/manifest.rs | 1 + 2 files changed, 58 insertions(+) diff --git a/tests/all/manifest.rs b/tests/all/manifest.rs index 1d631c8..b47174b 100644 --- a/tests/all/manifest.rs +++ b/tests/all/manifest.rs @@ -279,6 +279,63 @@ fn it_errors_when_wasm_bindgen_is_not_declared() { assert!(crate_data.check_crate_config(&step).is_err()); } +#[test] +fn it_sets_homepage_field_if_available_in_cargo_toml() { + // When 'homepage' is available + let fixture = utils::fixture::Fixture::new(); + fixture.hello_world_src_lib().file( + "Cargo.toml", + r#" + [package] + authors = ["The wasm-pack developers"] + description = "so awesome rust+wasm package" + license = "WTFPL" + name = "homepage-field-test" + repository = "https://github.com/rustwasm/wasm-pack.git" + version = "0.1.0" + homepage = "https://rustwasm.github.io/wasm-pack/" + + [lib] + crate-type = ["cdylib"] + + [dependencies] + wasm-bindgen = "=0.2" + + [dev-dependencies] + wasm-bindgen-test = "=0.2" + "#, + ); + + let out_dir = fixture.path.join("pkg"); + let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); + + let step = wasm_pack::progressbar::Step::new(2); + wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); + crate_data + .write_package_json(&out_dir, &None, true, "", &step) + .unwrap(); + + let pkg = utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); + assert_eq!( + pkg.homepage, + Some("https://rustwasm.github.io/wasm-pack/".to_string()), + ); + + // When 'homepage' is unavailable + let fixture = fixture::js_hello_world(); + let out_dir = fixture.path.join("pkg"); + let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); + + let step = wasm_pack::progressbar::Step::new(2); + wasm_pack::command::utils::create_pkg_dir(&out_dir, &step).unwrap(); + crate_data + .write_package_json(&out_dir, &None, true, "", &step) + .unwrap(); + + let pkg = utils::manifest::read_package_json(&fixture.path, &out_dir).unwrap(); + assert_eq!(pkg.homepage, None); +} + #[test] fn it_does_not_error_when_wasm_bindgen_is_declared() { let fixture = fixture::js_hello_world(); diff --git a/tests/all/utils/manifest.rs b/tests/all/utils/manifest.rs index 2f811ec..2fce9d5 100644 --- a/tests/all/utils/manifest.rs +++ b/tests/all/utils/manifest.rs @@ -23,6 +23,7 @@ pub struct NpmPackage { pub types: String, #[serde(default = "default_none", rename = "sideEffects")] pub side_effects: String, + pub homepage: Option, } fn default_none() -> String { From 1e4ae144fd68a441aca304e091da1adae172639e Mon Sep 17 00:00:00 2001 From: csmoe Date: Mon, 28 Jan 2019 08:22:22 -0500 Subject: [PATCH 098/106] Apply suggestions from code review Thanks! Co-Authored-By: chinedufn --- src/test/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/mod.rs b/src/test/mod.rs index 7448567..8edecf0 100644 --- a/src/test/mod.rs +++ b/src/test/mod.rs @@ -14,7 +14,7 @@ pub fn cargo_test_wasm( path: &Path, release: bool, envs: I, - extra_options: &Vec, + extra_options: &[String], ) -> Result<(), failure::Error> where I: IntoIterator, From f54de0a06750cfeeb58438cf6a91821d1691030c Mon Sep 17 00:00:00 2001 From: Chinedu Francis Nwafili Date: Tue, 29 Jan 2019 07:26:40 -0500 Subject: [PATCH 099/106] Improve test docs --- docs/src/commands/test.md | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/docs/src/commands/test.md b/docs/src/commands/test.md index ec8663f..56b21fd 100644 --- a/docs/src/commands/test.md +++ b/docs/src/commands/test.md @@ -47,10 +47,39 @@ supported in wasm-pack. To use them you should add standalone `--` argument at the very end of your command, and all the arguments you want to pass to cargo should go after. -Here's an example of running only tests that contain the world "apple". +`cargo test -h` for a list of all options that you can pass through. + +## Running only some tests + +Are your test suite grows it may become unrealistic to need to run all of your tests in a browser when you're +really only debugging one or a few of them. + +Here are a few examples of how to run a subset of your tests. ``` -wasm-pack test --firefox --headless -- --manifest-path=crates/my-workspace-crate/Cargo.toml apple +# Example directory structure +$ tree crates/foo +├── Cargo.toml +├── README.md +├── src +│   ├── diff +│   │   ├── diff_test_case.rs +│   │   └── mod.rs +│   ├── lib.rs +└── tests + ├── diff_patch.rs ``` -`cargo test -h` for a list of all options that you can pass through. +``` +# Run all tests in tests/diff_patch.rs +wasm-pack test crates/foo --firefox --headless -- --tests diff_patch + +# Run all tests in tests/diff_patch.rs that contain the word "replace" +wasm-pack test crates/foo --firefox --headless -- --tests diff_patch replace + +# Run all tests inside of a `tests` module inside of src/lib/diff.rs +wasm-pack test crates/foo --firefox --headless -- --lib diff::tests + +# Same as the above, but only if they contain the word replace +wasm-pack test crates/foo --firefox --headless -- --lib diff::tests::replace +``` From 5757744ffa60b3e9cf9e79881bc8185dab5b4c7e Mon Sep 17 00:00:00 2001 From: Chinedu Francis Nwafili Date: Tue, 29 Jan 2019 09:49:02 -0500 Subject: [PATCH 100/106] Clean up subset of test docs --- docs/src/commands/test.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/src/commands/test.md b/docs/src/commands/test.md index 56b21fd..52913c0 100644 --- a/docs/src/commands/test.md +++ b/docs/src/commands/test.md @@ -51,10 +51,9 @@ end of your command, and all the arguments you want to pass to cargo should go a ## Running only some tests -Are your test suite grows it may become unrealistic to need to run all of your tests in a browser when you're -really only debugging one or a few of them. +When debugging a specific issue, you may find yourself wanting to run a subset of tests, instead of your entire suite of tests. -Here are a few examples of how to run a subset of your tests. +Here are a few examples of how to run a subset of your tests: ``` # Example directory structure From 5637b0757776ae85b8e51b9e23ca0143c95a2544 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Wed, 23 Jan 2019 16:19:45 -0800 Subject: [PATCH 101/106] tests: Port all of our tests to use `assert_cmd` --- src/manifest/mod.rs | 2 +- tests/all/build.rs | 123 +++++++------------ tests/all/manifest.rs | 51 ++++---- tests/all/test.rs | 238 +++++++++++++++---------------------- tests/all/utils/fixture.rs | 17 --- 5 files changed, 166 insertions(+), 265 deletions(-) diff --git a/src/manifest/mod.rs b/src/manifest/mod.rs index ab5ba74..a06b4ec 100644 --- a/src/manifest/mod.rs +++ b/src/manifest/mod.rs @@ -294,7 +294,7 @@ impl CrateData { pub fn warn_for_unused_keys(manifest_and_keys: &ManifestAndUnsedKeys) { manifest_and_keys.unused_keys.iter().for_each(|path| { PBAR.warn(&format!( - "\"{}\" is a unknown key and will be ignored. Please check your Cargo.toml.", + "\"{}\" is an unknown key and will be ignored. Please check your Cargo.toml.", path )); }); diff --git a/tests/all/build.rs b/tests/all/build.rs index d4f4deb..be6e191 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -1,40 +1,24 @@ +use assert_cmd::prelude::*; use std::fs; use std::path::Path; -use structopt::StructOpt; use utils; -use wasm_pack::Cli; #[test] fn build_in_non_crate_directory_doesnt_panic() { let fixture = utils::fixture::not_a_crate(); - let cli = Cli::from_iter_safe(vec![ - "wasm-pack", - "build", - &fixture.path.display().to_string(), - ]) - .unwrap(); - let result = fixture.run(cli.cmd); - assert!( - result.is_err(), - "running wasm-pack in a non-crate directory should fail, but it should not panic" - ); - let err = result.unwrap_err(); - assert!(err - .iter_chain() - .any(|e| e.to_string().contains("missing a `Cargo.toml`"))); + fixture + .wasm_pack() + .arg("build") + .assert() + .failure() + .stderr(predicates::str::contains("missing a `Cargo.toml`")); } #[test] fn it_should_build_js_hello_world_example() { let fixture = utils::fixture::js_hello_world(); fixture.install_local_wasm_bindgen(); - let cli = Cli::from_iter_safe(vec![ - "wasm-pack", - "build", - &fixture.path.display().to_string(), - ]) - .unwrap(); - fixture.run(cli.cmd).unwrap(); + fixture.wasm_pack().arg("build").assert().success(); } #[test] @@ -75,15 +59,14 @@ fn it_should_build_crates_in_a_workspace() { #[wasm_bindgen] pub fn hello() -> u32 { 42 } "#, - ); - fixture.install_local_wasm_bindgen(); - let cli = Cli::from_iter_safe(vec![ - "wasm-pack", - "build", - &fixture.path.join("blah").display().to_string(), - ]) - .unwrap(); - fixture.run(cli.cmd).unwrap(); + ) + .install_local_wasm_bindgen(); + fixture + .wasm_pack() + .current_dir(&fixture.path.join("blah")) + .arg("build") + .assert() + .success(); } #[test] @@ -116,28 +99,21 @@ fn renamed_crate_name_works() { #[wasm_bindgen] pub fn one() -> u32 { 1 } "#, - ); - fixture.install_local_wasm_bindgen(); - let cli = Cli::from_iter_safe(vec![ - "wasm-pack", - "build", - &fixture.path.display().to_string(), - ]) - .unwrap(); - fixture.run(cli.cmd).unwrap(); + ) + .install_local_wasm_bindgen(); + fixture.wasm_pack().arg("build").assert().success(); } #[test] fn it_should_build_nested_project_with_transitive_dependencies() { let fixture = utils::fixture::transitive_dependencies(); fixture.install_local_wasm_bindgen(); - let cli = Cli::from_iter_safe(vec![ - "wasm-pack", - "build", - &fixture.path.join("main").display().to_string(), - ]) - .unwrap(); - fixture.run(cli.cmd).unwrap(); + fixture + .wasm_pack() + .current_dir(fixture.path.join("main")) + .arg("build") + .assert() + .success(); } #[test] @@ -149,14 +125,12 @@ fn build_different_profiles() { .iter() .cloned() { - let cli = Cli::from_iter_safe(vec![ - "wasm-pack", - "build", - profile, - &fixture.path.display().to_string(), - ]) - .unwrap(); - fixture.run(cli.cmd).unwrap(); + fixture + .wasm_pack() + .arg("build") + .arg(profile) + .assert() + .success(); } } @@ -208,17 +182,15 @@ fn build_with_and_without_wasm_bindgen_debug() { pub fn take(self) {} } "#, - ); - - let cli = Cli::from_iter_safe(vec![ - "wasm-pack", - "build", - "--dev", - &fixture.path.display().to_string(), - ]) - .unwrap(); + ) + .install_local_wasm_bindgen(); - fixture.run(cli.cmd).unwrap(); + fixture + .wasm_pack() + .arg("build") + .arg("--dev") + .assert() + .success(); let contents = fs::read_to_string(fixture.path.join("pkg/whatever.js")).unwrap(); assert_eq!( @@ -233,14 +205,11 @@ fn build_with_and_without_wasm_bindgen_debug() { fn build_with_arbitrary_cargo_options() { let fixture = utils::fixture::js_hello_world(); fixture.install_local_wasm_bindgen(); - - let cli = Cli::from_iter_safe(vec![ - "wasm-pack", - "build", - &fixture.path.display().to_string(), - "--", - "--no-default-features", - ]) - .unwrap(); - fixture.run(cli.cmd).unwrap(); + fixture + .wasm_pack() + .arg("build") + .arg("--") + .arg("--no-default-features") + .assert() + .success(); } diff --git a/tests/all/manifest.rs b/tests/all/manifest.rs index 7105794..30e2547 100644 --- a/tests/all/manifest.rs +++ b/tests/all/manifest.rs @@ -1,11 +1,9 @@ +use assert_cmd::prelude::*; use std::collections::HashSet; use std::fs; use std::path::PathBuf; - -use structopt::StructOpt; - use utils::{self, fixture}; -use wasm_pack::{self, license, manifest, readme, Cli}; +use wasm_pack::{self, license, manifest, readme}; #[test] fn it_gets_the_crate_name_default_path() { @@ -370,22 +368,15 @@ fn configure_wasm_bindgen_debug_incorrectly_is_error() { debug-js-glue = "not a boolean" "#, ); - - let cli = Cli::from_iter_safe(vec![ - "wasm-pack", - "build", - "--dev", - &fixture.path.display().to_string(), - ]) - .unwrap(); - - let result = fixture.run(cli.cmd); - assert!(result.is_err()); - - let err = result.unwrap_err(); - assert!(err.iter_chain().any(|c| c - .to_string() - .contains("package.metadata.wasm-pack.profile.dev.wasm-bindgen.debug"))); + fixture + .wasm_pack() + .arg("build") + .arg("--dev") + .assert() + .failure() + .stderr(predicates::str::contains( + "package.metadata.wasm-pack.profile.dev.wasm-bindgen.debug", + )); } #[test] @@ -415,15 +406,17 @@ fn parse_crate_data_returns_unused_keys_in_cargo_toml() { debug-js-glue = true "#, ) - .hello_world_src_lib(); - - let result = manifest::CrateData::parse_crate_data(&fixture.path.join("Cargo.toml")); - - assert!(result.is_ok()); - - let manifest::ManifestAndUnsedKeys { unused_keys, .. } = result.unwrap(); - - assert!(unused_keys.contains("package.metadata.wasm-pack.profile.production")); + .hello_world_src_lib() + .install_local_wasm_bindgen(); + fixture + .wasm_pack() + .arg("build") + .assert() + .success() + .stdout(predicates::str::contains( + "[WARN]: \"package.metadata.wasm-pack.profile.production\" is an unknown key and will \ + be ignored. Please check your Cargo.toml." + )); } #[test] diff --git a/tests/all/test.rs b/tests/all/test.rs index b438fcd..dbe9532 100644 --- a/tests/all/test.rs +++ b/tests/all/test.rs @@ -1,43 +1,32 @@ use assert_cmd::prelude::*; -use failure::Error; use predicates::prelude::*; use std::env; use utils::fixture; -use wasm_pack::command::{build, test, Command}; - -fn assert_err(result: Result, msg: &str) -> Error { - let error = result.err().expect("should have failed"); - for e in error.iter_chain() { - println!("err: {}", e); - } - assert!(error.iter_chain().any(|e| e.to_string().contains(msg))); - error -} #[test] fn it_can_run_node_tests() { let fixture = fixture::wbg_test_node(); fixture.install_local_wasm_bindgen(); - let cmd = Command::Test(test::TestOptions { - path: Some(fixture.path.clone()), - node: true, - mode: build::BuildMode::Noinstall, - ..Default::default() - }); - fixture.run(cmd).unwrap(); + let _lock = fixture.lock(); + fixture + .wasm_pack() + .arg("test") + .arg("--node") + .assert() + .success(); } #[test] fn it_can_run_tests_with_different_wbg_test_and_wbg_versions() { let fixture = fixture::wbg_test_diff_versions(); fixture.install_local_wasm_bindgen(); - let cmd = Command::Test(test::TestOptions { - path: Some(fixture.path.clone()), - node: true, - mode: build::BuildMode::Noinstall, - ..Default::default() - }); - fixture.run(cmd).unwrap(); + let _lock = fixture.lock(); + fixture + .wasm_pack() + .arg("test") + .arg("--node") + .assert() + .success(); } #[test] @@ -77,33 +66,37 @@ fn it_can_run_browser_tests() { return; } - let cmd = Command::Test(test::TestOptions { - path: Some(fixture.path.clone()), - firefox, - chrome, - safari, - headless: true, - mode: build::BuildMode::Noinstall, - ..Default::default() - }); - - fixture.run(cmd).unwrap(); + let mut cmd = fixture.wasm_pack(); + cmd.arg("test").arg("--headless"); + + if firefox { + cmd.arg("--firefox"); + } + if chrome { + cmd.arg("--chrome"); + } + if safari { + cmd.arg("--safari"); + } + + let _lock = fixture.lock(); + cmd.assert().success(); } #[test] fn it_can_run_failing_tests() { let fixture = fixture::wbg_test_fail(); fixture.install_local_wasm_bindgen(); - let cmd = Command::Test(test::TestOptions { - path: Some(fixture.path.clone()), - node: true, - mode: build::BuildMode::Noinstall, - ..Default::default() - }); - assert_err( - fixture.run(cmd), - "Running Wasm tests with wasm-bindgen-test failed", - ); + let _lock = fixture.lock(); + fixture + .wasm_pack() + .arg("test") + .arg("--node") + .assert() + .failure() + .stderr(predicates::str::contains( + "Running Wasm tests with wasm-bindgen-test failed", + )); } #[test] @@ -115,8 +108,6 @@ fn it_can_run_failing_tests() { all(target_os = "windows", target_arch = "x86_64") ))] fn it_can_find_a_webdriver_on_path() { - use std::process::Command; - let fixture = fixture::wbg_test_browser(); let local_geckodriver = fixture.install_local_geckodriver(); let local_wasm_bindgen = fixture.install_local_wasm_bindgen(); @@ -127,54 +118,44 @@ fn it_can_find_a_webdriver_on_path() { let path = env::join_paths(paths).unwrap(); let _lock = fixture.lock(); - - let mut me = env::current_exe().unwrap(); - me.pop(); - me.pop(); - me.push("wasm-pack"); - let output = Command::new(&me) + fixture + .wasm_pack() + .env("PATH", &path) .arg("test") .arg("--firefox") .arg("--headless") .arg("--mode") .arg("no-install") - .env("PATH", &path) - .arg(&fixture.path) - .output() - .unwrap(); - println!("stdout: {}", String::from_utf8_lossy(&output.stdout)); - println!("stderr: {}", String::from_utf8_lossy(&output.stderr)); - println!("status: {}", output.status); - assert!(output.status.success()); + .assert() + .success(); } #[test] fn it_requires_node_or_a_browser() { let fixture = fixture::wbg_test_node(); fixture.install_local_wasm_bindgen(); - - let cmd = Command::Test(test::TestOptions { - path: Some(fixture.path.clone()), - mode: build::BuildMode::Noinstall, - // Note: not setting node or any browser to true here. - ..Default::default() - }); - assert_err(fixture.run(cmd), "Must specify at least one of"); + let _lock = fixture.lock(); + fixture + .wasm_pack() + .arg("test") + .assert() + .failure() + .stderr(predicates::str::contains("Must specify at least one of")); } #[test] fn the_headless_flag_requires_a_browser() { let fixture = fixture::wbg_test_node(); fixture.install_local_wasm_bindgen(); - - let cmd = Command::Test(test::TestOptions { - path: Some(fixture.path.clone()), - node: true, - mode: build::BuildMode::Noinstall, - headless: true, - ..Default::default() - }); - assert_err(fixture.run(cmd), "only applies to browser tests"); + let _lock = fixture.lock(); + fixture + .wasm_pack() + .arg("test") + .arg("--node") + .arg("--headless") + .assert() + .failure() + .stderr(predicates::str::contains("only applies to browser tests")); } #[test] @@ -205,44 +186,18 @@ fn complains_about_missing_wasm_bindgen_test_dependency() { ) .hello_world_src_lib() .install_local_wasm_bindgen(); - - let cmd = Command::Test(test::TestOptions { - path: Some(fixture.path.clone()), - node: true, - mode: build::BuildMode::Noinstall, - ..Default::default() - }); - let error = assert_err(fixture.run(cmd), "Ensure that you have"); - - // Test that the error message has two occurrences of "wasm-bindgen-test" in - // it. I am surprised to learn there is no `str` method to count - // occurrences, so we find the first and the last and assert that they - // aren't the same occurrence. - // - // This should protect against regresstions where we said: - // - // Ensure that you have "wasm-bindgen" as a dependency in your Cargo.toml file: - // [dev-dependencies] - // wasm-bindgen-test = "0.2" - // - // instead of - // - // Ensure that you have "wasm-bindgen-test" as a dependency in your Cargo.toml file: - // [dev-dependencies] - // wasm-bindgen-test = "0.2" - // - // Note that the whole reason we are doing this string manipulation instead - // of just doing `assert_eq!` is because the first occurrence of the - // dependency name is bolded with terminal escape codes and if I try to pipe - // the output to a text file, then the escape codes go away, so I can't - // figure out which exact escape codes are even used here. - - let err_msg = error.to_string(); - let first = err_msg.find("wasm-bindgen-test"); - assert!(first.is_some()); - let second = err_msg.rfind("wasm-bindgen-test"); - assert!(second.is_some()); - assert_ne!(first, second, "should have found two occurrences"); + let _lock = fixture.lock(); + fixture + .wasm_pack() + .arg("test") + .arg("--node") + .assert() + .failure() + .stderr(predicates::str::contains( + "Ensure that you have \"wasm-bindgen-test\" as a dependency in your Cargo.toml file", + )) + .stderr(predicates::str::contains("[dev-dependencies]")) + .stderr(predicates::str::contains("wasm-bindgen-test = \"0.2\"")); } #[test] @@ -278,15 +233,15 @@ fn renamed_crate_name_works() { #[wasm_bindgen] pub fn one() -> u32 { 1 } "#, - ); - fixture.install_local_wasm_bindgen(); - let cmd = Command::Test(test::TestOptions { - path: Some(fixture.path.clone()), - node: true, - mode: build::BuildMode::Noinstall, - ..Default::default() - }); - fixture.run(cmd).unwrap(); + ) + .install_local_wasm_bindgen(); + let _lock = fixture.lock(); + fixture + .wasm_pack() + .arg("test") + .arg("--node") + .assert() + .success(); } #[test] @@ -326,15 +281,15 @@ fn cdylib_not_required() { foo::foo(); } "#, - ); - fixture.install_local_wasm_bindgen(); - let cmd = Command::Test(test::TestOptions { - path: Some(fixture.path.clone()), - node: true, - mode: build::BuildMode::Noinstall, - ..Default::default() - }); - fixture.run(cmd).unwrap(); + ) + .install_local_wasm_bindgen(); + let _lock = fixture.lock(); + fixture + .wasm_pack() + .arg("test") + .arg("--node") + .assert() + .success(); } #[test] @@ -342,7 +297,7 @@ fn test_output_is_printed_once() { let fixture = fixture::Fixture::new(); fixture .readme() - .cargo_toml("wbg-test-node") + .cargo_toml("test-output-printed-once") .hello_world_src_lib() .file( "tests/node.rs", @@ -359,20 +314,21 @@ fn test_output_is_printed_once() { } #[wasm_bindgen_test] - fn pass() { + fn yabba() { log("YABBA DABBA DOO"); assert_eq!(1, 2); } "#, - ); - + ) + .install_local_wasm_bindgen(); + let _lock = fixture.lock(); fixture .wasm_pack() .arg("test") .arg("--node") .assert() + .failure() .stderr(predicate::function(|err: &str| { err.matches("YABBA DABBA DOO").count() == 1 - })) - .failure(); + })); } diff --git a/tests/all/utils/fixture.rs b/tests/all/utils/fixture.rs index f157b9b..856fd21 100644 --- a/tests/all/utils/fixture.rs +++ b/tests/all/utils/fixture.rs @@ -278,23 +278,6 @@ impl Fixture { self } - pub fn run(&self, cmd: wasm_pack::command::Command) -> Result<(), failure::Error> { - match cmd { - wasm_pack::command::Command::Test(cmd) => { - let _lock = self.lock(); - let mut test = wasm_pack::command::test::Test::try_from_opts(cmd)?; - test.set_cache(self.cache()); - test.run() - } - wasm_pack::command::Command::Build(cmd) => { - let mut build = wasm_pack::command::build::Build::try_from_opts(cmd)?; - build.set_cache(self.cache()); - build.run() - } - _ => unreachable!(), - } - } - /// Get a `wasm-pack` command configured to run in this fixure's temp /// directory and using the test cache. pub fn wasm_pack(&self) -> Command { From b0f47b960e7a168d7ec9a921cdbd28a86099ab43 Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Tue, 29 Jan 2019 10:28:22 -0500 Subject: [PATCH 102/106] fix(style): appease cargo fmt --- tests/all/manifest.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/all/manifest.rs b/tests/all/manifest.rs index 30e2547..7638f7a 100644 --- a/tests/all/manifest.rs +++ b/tests/all/manifest.rs @@ -415,7 +415,7 @@ fn parse_crate_data_returns_unused_keys_in_cargo_toml() { .success() .stdout(predicates::str::contains( "[WARN]: \"package.metadata.wasm-pack.profile.production\" is an unknown key and will \ - be ignored. Please check your Cargo.toml." + be ignored. Please check your Cargo.toml.", )); } From cd8ee977d517dd1b3edcf350682a212763333579 Mon Sep 17 00:00:00 2001 From: Jonas Scheffner Date: Mon, 4 Feb 2019 15:31:04 +0100 Subject: [PATCH 103/106] Use win32 chromedriver binaries for win64 systems, update chromedriver version to 2.45 and fix error message --- src/test/webdriver.rs | 6 +++--- tests/all/webdriver.rs | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/test/webdriver.rs b/src/test/webdriver.rs index 54e2968..e15ae80 100644 --- a/src/test/webdriver.rs +++ b/src/test/webdriver.rs @@ -31,14 +31,14 @@ pub fn install_chromedriver( "linux64" } else if target::MACOS && target::x86_64 { "mac64" - } else if target::WINDOWS && target::x86 { + } else if target::WINDOWS { "win32" } else { - bail!("geckodriver binaries are unavailable for this target") + bail!("chromedriver binaries are unavailable for this target") }; let url = format!( - "https://chromedriver.storage.googleapis.com/2.41/chromedriver_{}.zip", + "https://chromedriver.storage.googleapis.com/2.45/chromedriver_{}.zip", target ); match cache.download( diff --git a/tests/all/webdriver.rs b/tests/all/webdriver.rs index d5e8cf6..6223290 100644 --- a/tests/all/webdriver.rs +++ b/tests/all/webdriver.rs @@ -6,7 +6,8 @@ use wasm_pack::test::webdriver; #[cfg(any( all(target_os = "linux", target_arch = "x86_64"), all(target_os = "macos", target_arch = "x86_64"), - all(target_os = "windows", target_arch = "x86") + all(target_os = "windows", target_arch = "x86"), + all(target_os = "windows", target_arch = "x86_64") ))] fn can_install_chromedriver() { let fixture = fixture::js_hello_world(); From d80406173b20ad768bd39630fee9bd9477b71d15 Mon Sep 17 00:00:00 2001 From: Jonas Scheffner Date: Mon, 4 Feb 2019 17:33:06 +0100 Subject: [PATCH 104/106] Update chromedriver to v0.46 and geckodriver to v0.24.0 --- src/test/webdriver.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/webdriver.rs b/src/test/webdriver.rs index e15ae80..1dfe1a1 100644 --- a/src/test/webdriver.rs +++ b/src/test/webdriver.rs @@ -38,7 +38,7 @@ pub fn install_chromedriver( }; let url = format!( - "https://chromedriver.storage.googleapis.com/2.45/chromedriver_{}.zip", + "https://chromedriver.storage.googleapis.com/2.46/chromedriver_{}.zip", target ); match cache.download( @@ -92,7 +92,7 @@ pub fn install_geckodriver( }; let url = format!( - "https://github.com/mozilla/geckodriver/releases/download/v0.21.0/geckodriver-v0.21.0-{}.{}", + "https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-{}.{}", target, ext, ); From bec91efbeaa32b2040f9406b4f06c4e585d1e1dd Mon Sep 17 00:00:00 2001 From: Pascal Hertleif Date: Tue, 5 Feb 2019 14:57:21 +0100 Subject: [PATCH 105/106] Clarify what kind of account `login` adds --- src/command/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/command/mod.rs b/src/command/mod.rs index 86a8235..5a56e93 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -50,7 +50,7 @@ pub enum Command { }, #[structopt(name = "login", alias = "adduser", alias = "add-user")] - /// 👤 Add a registry user account! (aliases: adduser, add-user) + /// 👤 Add a npm registry user account! (aliases: adduser, add-user) Login { #[structopt(long = "registry", short = "r")] /// Default: 'https://registry.npmjs.org/'. From 73ed2b83f7b750499b1d0c4ad5fd3fbe27e88aaa Mon Sep 17 00:00:00 2001 From: ashley williams Date: Tue, 5 Feb 2019 15:29:07 +0100 Subject: [PATCH 106/106] Update mod.rs --- src/command/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/command/mod.rs b/src/command/mod.rs index 5a56e93..c239b09 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -50,7 +50,7 @@ pub enum Command { }, #[structopt(name = "login", alias = "adduser", alias = "add-user")] - /// 👤 Add a npm registry user account! (aliases: adduser, add-user) + /// 👤 Add an npm registry user account! (aliases: adduser, add-user) Login { #[structopt(long = "registry", short = "r")] /// Default: 'https://registry.npmjs.org/'.