(outputs: &BuildOutputs, profile: &str)
| 7537 | } |
| 7538 | |
| 7539 | fn validate_build_profile_outputs(outputs: &BuildOutputs, profile: &str) -> Result<()> { |
| 7540 | let signature_path = outputs.build_dir.join(".pglite-oxide-build-profile"); |
| 7541 | let signature = fs::read_to_string(&signature_path) |
| 7542 | .with_context(|| format!("read {}", signature_path.display()))?; |
| 7543 | let profile_line = format!("profile={profile}"); |
| 7544 | if !signature.lines().any(|line| line == profile_line) { |
| 7545 | bail!( |
| 7546 | "WASIX build profile signature does not match requested profile {profile}: {}", |
| 7547 | signature_path.display() |
| 7548 | ); |
| 7549 | } |
| 7550 | |
| 7551 | if profile.starts_with("release") { |
| 7552 | let cflags = signature |
| 7553 | .lines() |
| 7554 | .find_map(|line| line.strip_prefix("cflags=")) |
| 7555 | .unwrap_or_default(); |
| 7556 | let has_release_opt = ["-O2", "-O3", "-Os", "-Oz"] |
| 7557 | .iter() |
| 7558 | .any(|flag| cflags.split_whitespace().any(|part| part == *flag)); |
| 7559 | if !has_release_opt || !cflags.split_whitespace().any(|part| part == "-g0") { |
| 7560 | bail!( |
| 7561 | "release WASIX profile must include an optimizing -O flag and -g0; got cflags={cflags:?}" |
| 7562 | ); |
| 7563 | } |
| 7564 | |
| 7565 | let makefile = outputs.build_dir.join("src/Makefile.global"); |
| 7566 | let makefile_text = fs::read_to_string(&makefile) |
| 7567 | .with_context(|| format!("read {}", makefile.display()))?; |
| 7568 | if !["-O2", "-O3", "-Os", "-Oz"] |
| 7569 | .iter() |
| 7570 | .any(|flag| makefile_text.contains(flag)) |
| 7571 | { |
| 7572 | bail!( |
| 7573 | "release WASIX build did not propagate optimization flags into {}", |
| 7574 | makefile.display() |
| 7575 | ); |
| 7576 | } |
| 7577 | } |
| 7578 | |
| 7579 | Ok(()) |
| 7580 | } |
| 7581 | |
| 7582 | fn validate_module_link_metadata(module: &BuildModuleManifestOut) -> Result<()> { |
| 7583 | if module.link.exports.is_empty() { |
no test coverage detected