From 16e1f8e60372497e2df8deeb324fc01aa9e2fb73 Mon Sep 17 00:00:00 2001 From: Kevin Reid Date: Thu, 7 Nov 2024 18:23:46 -0800 Subject: [PATCH] =?UTF-8?q?wasm:=20Don=E2=80=99t=20generate=20the=20licens?= =?UTF-8?q?e=20compilation=20except=20in=20release.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes . --- .github/workflows/ci.yml | 4 ---- tools/xtask/src/xtask.rs | 17 ++++++++++------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7bde2e18b..1e2df4b11 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -316,10 +316,6 @@ jobs: - name: Compile xtask run: cargo build --package xtask - # Kludge: Avoid dependency on `cargo-about` by making the generated license info file look fresh. - - name: Skip license generation - run: touch all-is-cubes-wasm/static/third-party-licenses.html - - name: Lint run: cargo xtask --scope=only-normal lint --timings diff --git a/tools/xtask/src/xtask.rs b/tools/xtask/src/xtask.rs index 0a67affb6..d3a25eb97 100644 --- a/tools/xtask/src/xtask.rs +++ b/tools/xtask/src/xtask.rs @@ -316,6 +316,9 @@ fn main() -> Result<(), ActionError> { .run()?; } XtaskCommand::BuildWebRelease => { + // We only generate the license file in release builds, to save time. + generate_wasm_licenses_file(&mut time_log)?; + build_web(&config, &mut time_log, Profile::Release)?; } XtaskCommand::Update { to, dry_run } => { @@ -859,19 +862,19 @@ SingleMainWindow=true Ok(()) } -fn ensure_wasm_tools_installed( - config: &Config, - time_log: &mut Vec, -) -> Result<(), ActionError> { +#[allow(clippy::unnecessary_wraps)] +fn ensure_wasm_tools_installed(config: &Config, _: &mut Vec) -> Result<(), ActionError> { assert!(config.scope.includes_main_workspace()); // TODO: check that wasm-pack is installed - // Generate combined license file for the wasm build. + Ok(()) +} + +fn generate_wasm_licenses_file(time_log: &mut Vec) -> Result<(), ActionError> { let web_ws_path = PROJECT_DIR.join("all-is-cubes-wasm"); let license_html_path = PROJECT_DIR.join("all-is-cubes-wasm/static/third-party-licenses.html"); let license_template_path = PROJECT_DIR.join("tools/about.hbs"); - let config_path = PROJECT_DIR.join("tools/about.toml"); if newer_than( [&web_ws_path.join("Cargo.lock"), &license_template_path], [&license_html_path], @@ -884,7 +887,7 @@ fn ensure_wasm_tools_installed( "generate", "--fail", "--config", - config_path.to_str().unwrap(), + PROJECT_DIR.join("tools/about.toml").to_str().unwrap(), license_template_path.to_str().unwrap(), "-o", license_html_path.to_str().unwrap(),