MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / validate_build_output_link_closure

Function validate_build_output_link_closure

xtask/src/main.rs:7628–7674  ·  view source on GitHub ↗
(outputs: &BuildOutputs)

Source from the content-addressed store, hash-verified

7626}
7627
7628fn validate_build_output_link_closure(outputs: &BuildOutputs) -> Result<()> {
7629 let runtime = outputs
7630 .modules
7631 .iter()
7632 .find(|module| module.kind == "runtime")
7633 .ok_or_else(|| anyhow!("build outputs are missing runtime module"))?;
7634 let runtime_link = read_wasm_link_metadata(&runtime.path)?;
7635 let runtime_exports = runtime_link
7636 .exports
7637 .iter()
7638 .flat_map(|export| {
7639 let name = export.name.trim_start_matches('_').to_owned();
7640 [export.name.clone(), name]
7641 })
7642 .collect::<HashSet<_>>();
7643
7644 let mut failures = Vec::new();
7645 for module in outputs
7646 .modules
7647 .iter()
7648 .filter(|module| matches!(module.kind.as_str(), "runtime-support" | "extension"))
7649 {
7650 let link = read_wasm_link_metadata(&module.path)?;
7651 for import in &link.imports {
7652 if !import_should_resolve_from_runtime(import) {
7653 continue;
7654 }
7655 let normalized = import.name.trim_start_matches('_');
7656 if !runtime_exports.contains(import.name.as_str())
7657 && !runtime_exports.contains(normalized)
7658 {
7659 failures.push(format!(
7660 "{} imports {}.{}",
7661 module.name, import.module, import.name
7662 ));
7663 }
7664 }
7665 }
7666
7667 if !failures.is_empty() {
7668 bail!(
7669 "WASIX dynamic-link closure has unresolved side-module imports: {}",
7670 failures.join(", ")
7671 );
7672 }
7673 Ok(())
7674}
7675
7676fn generate_wasix_export_list(write: bool) -> Result<()> {
7677 let output = wasix_export_list_text()?;

Callers 3

build_asset_spineFunction · 0.85
release_build_assetsFunction · 0.85

Calls 4

read_wasm_link_metadataFunction · 0.85
iterMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected