Skip to content

Commit

Permalink
wasm: Don’t generate the license compilation except in release.
Browse files Browse the repository at this point in the history
Fixes <#379>.
  • Loading branch information
kpreid committed Nov 8, 2024
1 parent 622285e commit 16e1f8e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 10 additions & 7 deletions tools/xtask/src/xtask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 } => {
Expand Down Expand Up @@ -859,19 +862,19 @@ SingleMainWindow=true
Ok(())
}

fn ensure_wasm_tools_installed(
config: &Config,
time_log: &mut Vec<Timing>,
) -> Result<(), ActionError> {
#[allow(clippy::unnecessary_wraps)]
fn ensure_wasm_tools_installed(config: &Config, _: &mut Vec<Timing>) -> 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<Timing>) -> 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],
Expand All @@ -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(),
Expand Down

0 comments on commit 16e1f8e

Please sign in to comment.