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

Method from_packaged_assets

xtask/src/main.rs:7348–7436  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7346 }
7347
7348 fn from_packaged_assets() -> Result<Self> {
7349 let manifest = read_asset_manifest()?;
7350 let base = PathBuf::from("assets/wasix-build/build/aot-inputs");
7351 if base.exists() {
7352 fs::remove_dir_all(&base).with_context(|| format!("remove {}", base.display()))?;
7353 }
7354 fs::create_dir_all(&base).with_context(|| format!("create {}", base.display()))?;
7355
7356 let assets_base = Path::new(GENERATED_ASSETS_DIR);
7357 let runtime_archive = assets_base.join(&manifest.runtime.archive);
7358 let runtime_path = base.join("runtime/pglite");
7359 write_bytes_file(
7360 &runtime_path,
7361 &archive_entry_bytes(&runtime_archive, "pglite/bin/pglite")?,
7362 )?;
7363
7364 let mut modules = vec![BuildModuleOutput {
7365 name: "runtime:pglite".to_owned(),
7366 kind: "runtime".to_owned(),
7367 path: runtime_path,
7368 aot_file: "pglite-llvm-opta.bin.zst".to_owned(),
7369 }];
7370
7371 for support in &manifest.runtime_support {
7372 let path = base.join("runtime-support").join(&support.name);
7373 write_bytes_file(
7374 &path,
7375 &archive_entry_bytes(&runtime_archive, &format!("pglite/{}", support.path))?,
7376 )?;
7377 modules.push(BuildModuleOutput {
7378 name: format!("runtime-support:{}", support.name),
7379 kind: "runtime-support".to_owned(),
7380 path,
7381 aot_file: format!("{}-llvm-opta.bin.zst", support.name),
7382 });
7383 }
7384
7385 if let Some(pg_dump) = &manifest.pg_dump {
7386 let path = base.join("tools/pg_dump");
7387 copy_file(&assets_base.join(&pg_dump.path), &path)?;
7388 modules.push(BuildModuleOutput {
7389 name: "tool:pg_dump".to_owned(),
7390 kind: "tool".to_owned(),
7391 path,
7392 aot_file: "pg_dump-llvm-opta.bin.zst".to_owned(),
7393 });
7394 }
7395 if let Some(initdb) = &manifest.initdb {
7396 let path = base.join("tools/initdb");
7397 copy_file(&assets_base.join(&initdb.path), &path)?;
7398 modules.push(BuildModuleOutput {
7399 name: "tool:initdb".to_owned(),
7400 kind: "tool".to_owned(),
7401 path,
7402 aot_file: "initdb-llvm-opta.bin.zst".to_owned(),
7403 });
7404 }
7405

Callers

nothing calls this directly

Calls 6

read_asset_manifestFunction · 0.85
write_bytes_fileFunction · 0.85
archive_entry_bytesFunction · 0.85
copy_fileFunction · 0.85
pushMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected