Merge pull request #396 from fitzgen/pull-project-testing-out-into-its-own-crate

tests: Pull the `project()` builder out into its own crate
This commit is contained in:
Nick Fitzgerald 2018-07-05 15:01:21 -07:00 committed by GitHub
commit bc2eab1434
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 11 deletions

View File

@ -33,8 +33,7 @@ serde = { version = "1.0", optional = true }
serde_json = { version = "1.0", optional = true }
[dev-dependencies]
lazy_static = "1"
wasm-bindgen-cli-support = { path = "crates/cli-support", version = '=0.2.11' }
wasm-bindgen-test-project-builder = { path = "crates/test-project-builder", version = '=0.2.11' }
[workspace]
members = [

View File

@ -0,0 +1,8 @@
[package]
name = "wasm-bindgen-test-project-builder"
version = "0.2.11"
authors = ["Nick Fitzgerald <fitzgen@gmail.com>"]
[dependencies]
lazy_static = "1"
wasm-bindgen-cli-support = { path = "../cli-support", version = '=0.2.11' }

View File

@ -1,4 +1,6 @@
use wasm_bindgen_cli_support as cli;
#[macro_use]
extern crate lazy_static;
extern crate wasm_bindgen_cli_support as cli;
use std::env;
use std::fs::{self, File};
@ -29,7 +31,7 @@ pub struct Project {
}
pub fn project() -> Project {
let dir = Path::new(env!("CARGO_MANIFEST_DIR"));
let dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("../..");
let mut lockfile = String::new();
fs::File::open(&dir.join("Cargo.lock"))
.unwrap()
@ -217,7 +219,7 @@ impl Project {
manifest.push_str("[build-dependencies]\n");
manifest.push_str("wasm-bindgen-webidl = { path = '");
manifest.push_str(env!("CARGO_MANIFEST_DIR"));
manifest.push_str("/crates/webidl' }\n");
manifest.push_str("/../webidl' }\n");
manifest.push_str("[dependencies]\n");
for dep in self.deps.iter() {
@ -226,7 +228,7 @@ impl Project {
}
manifest.push_str("wasm-bindgen = { path = '");
manifest.push_str(env!("CARGO_MANIFEST_DIR"));
manifest.push_str("'");
manifest.push_str("/../..'");
if self.no_std {
manifest.push_str(", default-features = false");
}
@ -826,4 +828,3 @@ fn run_in_background(cmd: &mut Command, name: String) -> BackgroundChild {
stdin: Some(stdin),
}
}

View File

@ -1,8 +1,5 @@
#[macro_use]
extern crate lazy_static;
extern crate wasm_bindgen_cli_support;
extern crate wasm_bindgen_test_project_builder as project_builder;
mod project_builder;
use project_builder::{project, run};
mod api;