(&self)
| 7457 | } |
| 7458 | |
| 7459 | fn write_manifest(&self) -> Result<()> { |
| 7460 | let manifest = BuildOutputManifestOut { |
| 7461 | format_version: 1, |
| 7462 | build_profile: fs::read_to_string(self.build_dir.join(".pglite-oxide-build-profile")) |
| 7463 | .context("read WASIX build profile signature")?, |
| 7464 | modules: self |
| 7465 | .modules |
| 7466 | .iter() |
| 7467 | .map(|module| { |
| 7468 | Ok(BuildModuleManifestOut { |
| 7469 | name: module.name.clone(), |
| 7470 | kind: module.kind.clone(), |
| 7471 | path: module.path.to_string_lossy().into_owned(), |
| 7472 | sha256: sha256_file(&module.path)?, |
| 7473 | link: read_wasm_link_metadata(&module.path)?, |
| 7474 | }) |
| 7475 | }) |
| 7476 | .collect::<Result<Vec<_>>>()?, |
| 7477 | }; |
| 7478 | for module in &manifest.modules { |
| 7479 | validate_module_link_metadata(module)?; |
| 7480 | } |
| 7481 | let text = serde_json::to_string_pretty(&manifest) |
| 7482 | .context("serialize WASIX build output manifest")?; |
| 7483 | let path = Path::new(WASIX_BUILD_MANIFEST_PATH); |
| 7484 | if let Some(parent) = path.parent() { |
| 7485 | fs::create_dir_all(parent).with_context(|| format!("create {}", parent.display()))?; |
| 7486 | } |
| 7487 | fs::write(path, format!("{text}\n")).with_context(|| format!("write {}", path.display())) |
| 7488 | } |
| 7489 | } |
| 7490 | |
| 7491 | fn write_bytes_file(path: &Path, bytes: &[u8]) -> Result<()> { |
no test coverage detected