Merge pull request #495 from rustwasm/binary-install

get binary install ready for publish
master
ashley williams 6 years ago committed by GitHub
commit 0acc7b79df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 30
      Cargo.lock
  2. 2
      Cargo.toml
  3. 10
      binary-install/Cargo.toml
  4. 2
      binary-install/README.md
  5. 10
      binary-install/src/lib.rs
  6. 2
      src/bindgen.rs
  7. 4
      src/command/build.rs
  8. 4
      src/command/test.rs
  9. 2
      src/lib.rs
  10. 2
      src/test/webdriver.rs
  11. 2
      tests/all/bindgen.rs
  12. 2
      tests/all/main.rs
  13. 2
      tests/all/utils/fixture.rs
  14. 2
      tests/all/webdriver.rs

30
Cargo.lock generated

@ -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"

@ -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]

@ -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"

@ -0,0 +1,2 @@
# `binary-install`
> install a binary from a path to a global cache

@ -36,13 +36,15 @@ impl Cache {
///
/// This function may return an error if a cache directory cannot be
/// determined.
pub fn new() -> Result<Cache, Error> {
pub fn new(name: &str) -> Result<Cache, Error> {
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))
}

@ -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;

@ -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.
@ -180,7 +180,7 @@ impl Build {
mode: build_opts.mode,
out_dir,
bindgen: None,
cache: Cache::new()?,
cache: Cache::new("wasm_pack")?,
extra_options: build_opts.extra_options,
})
}

@ -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,

@ -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;

@ -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.

@ -1,6 +1,6 @@
use binary_install::Cache;
use tempfile;
use wasm_pack::bindgen;
use wasm_pack_binary_install::Cache;
#[test]
#[cfg(any(

@ -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;

@ -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 {

@ -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(

Loading…
Cancel
Save