Skip to content

Commit

Permalink
Merge pull request #598 from alexcrichton/fix-no-install
Browse files Browse the repository at this point in the history
Fix panics in `build --mode no-install`
  • Loading branch information
ashleygwilliams authored Mar 22, 2019
2 parents ef745bf + f39acc1 commit b07ec95
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 30 deletions.
49 changes: 19 additions & 30 deletions src/command/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,38 +259,27 @@ impl Build {
};
($($name:ident,)*) => (steps![$($name),*])
}
let mut steps = Vec::new();
match &mode {
BuildMode::Normal => steps![
step_check_rustc_version,
step_check_crate_config,
step_check_for_wasm_target,
step_build_wasm,
step_create_dir,
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_copy_readme,
step_copy_license,
step_run_wasm_bindgen,
step_create_json,
],
BuildMode::Force => steps![
step_build_wasm,
step_create_dir,
step_copy_readme,
step_copy_license,
step_run_wasm_bindgen,
step_create_json,
],
BuildMode::Force => {}
_ => {
steps.extend(steps![
step_check_rustc_version,
step_check_crate_config,
step_check_for_wasm_target,
]);
}
}
steps.extend(steps![
step_build_wasm,
step_create_dir,
step_copy_readme,
step_copy_license,
step_install_wasm_bindgen,
step_run_wasm_bindgen,
step_create_json,
]);
steps
}

fn step_check_rustc_version(&mut self) -> Result<(), Error> {
Expand Down
26 changes: 26 additions & 0 deletions tests/all/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,29 @@ fn build_with_arbitrary_cargo_options() {
.assert()
.success();
}

#[test]
fn build_no_install() {
let fixture = utils::fixture::js_hello_world();
fixture.install_local_wasm_bindgen();
fixture
.wasm_pack()
.arg("build")
.arg("--mode")
.arg("no-install")
.assert()
.success();
}

#[test]
fn build_force() {
let fixture = utils::fixture::js_hello_world();
fixture.install_local_wasm_bindgen();
fixture
.wasm_pack()
.arg("build")
.arg("--mode")
.arg("force")
.assert()
.success();
}

0 comments on commit b07ec95

Please sign in to comment.