diff --git a/src/command/build.rs b/src/command/build.rs index f46d2116..9e81c653 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -38,6 +38,8 @@ pub enum BuildMode { /// Don't install tools like `wasm-bindgen`, just use the global /// environment's existing versions to do builds. Noinstall, + /// Skip the rustc version check + Force, } impl Default for BuildMode { @@ -52,6 +54,7 @@ impl FromStr for BuildMode { match s { "no-install" => Ok(BuildMode::Noinstall), "normal" => Ok(BuildMode::Normal), + "force" => Ok(BuildMode::Force), _ => Error::crate_config(&format!("Unknown build mode: {}", s)).map(|_| unreachable!()), } } @@ -175,6 +178,13 @@ impl Build { step_copy_readme, step_run_wasm_bindgen ], + BuildMode::Force => steps![ + step_build_wasm, + step_create_dir, + step_create_json, + step_copy_readme, + step_run_wasm_bindgen + ], } } @@ -255,6 +265,7 @@ impl Build { info!(&log, "Installing wasm-bindgen-cli..."); let install_permitted = match self.mode { BuildMode::Normal => true, + BuildMode::Force => true, BuildMode::Noinstall => false, }; bindgen::install_wasm_bindgen( diff --git a/src/command/test.rs b/src/command/test.rs index ed803dc3..6ad3e7ae 100644 --- a/src/command/test.rs +++ b/src/command/test.rs @@ -185,6 +185,7 @@ impl Test { } match self.mode { BuildMode::Normal => steps![ + step_check_rustc_version, step_check_crate_config, step_add_wasm_target, step_build_tests, @@ -197,6 +198,18 @@ impl Test { step_get_safaridriver if self.safari && self.safaridriver.is_none(), step_test_safari if self.safari, ], + 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(), + step_test_chrome if self.chrome, + step_get_geckodriver if self.firefox && self.geckodriver.is_none(), + step_test_firefox if self.firefox, + step_get_safaridriver if self.safari && self.safaridriver.is_none(), + step_test_safari if self.safari, + ], BuildMode::Noinstall => steps![ step_check_crate_config, step_build_tests, @@ -212,6 +225,13 @@ impl Test { } } + fn step_check_rustc_version(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { + info!(log, "Checking rustc version..."); + let _ = build::check_rustc_version(step)?; + info!(log, "Rustc version is correct."); + Ok(()) + } + fn step_check_crate_config(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { info!(log, "Checking crate configuration..."); manifest::check_crate_config(&self.crate_path, step)?; @@ -263,6 +283,10 @@ impl Test { info!(&log, "Ensuring wasm-bindgen-cli is installed..."); true } + BuildMode::Force => { + info!(&log, "Ensuring wasm-bindgen-cli is installed..."); + true + } BuildMode::Noinstall => { info!(&log, "Searching for existing wasm-bindgen-cli install..."); false diff --git a/src/test/webdriver.rs b/src/test/webdriver.rs index f507775b..5668f6a4 100644 --- a/src/test/webdriver.rs +++ b/src/test/webdriver.rs @@ -19,6 +19,7 @@ pub fn get_or_install_chromedriver( match (mode, bin_path(log, crate_path, "chromedriver")) { (_, Some(path)) => Ok(path), (BuildMode::Normal, None) => install_chromedriver(crate_path), + (BuildMode::Force, None) => install_chromedriver(crate_path), (BuildMode::Noinstall, None) => Error::crate_config( "No crate-local `chromedriver` binary found, and could not find a global \ `chromedriver` on the `$PATH`. Not installing `chromedriver` because of noinstall \ @@ -69,6 +70,7 @@ pub fn get_or_install_geckodriver( match (mode, bin_path(log, crate_path, "geckodriver")) { (_, Some(path)) => Ok(path), (BuildMode::Normal, None) => install_geckodriver(crate_path), + (BuildMode::Force, None) => install_geckodriver(crate_path), (BuildMode::Noinstall, None) => Error::crate_config( "No crate-local `geckodriver` binary found, and could not find a global `geckodriver` \ on the `$PATH`. Not installing `geckodriver` because of noinstall mode.",