1
0
mirror of https://github.com/fluencelabs/wasm-bindgen synced 2025-03-31 17:31:06 +00:00

Merge pull request 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
Cargo.toml
crates/test-project-builder
tests/all

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

@ -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' }

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

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