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

Function package_assets_with_options

xtask/src/main.rs:8205–8285  ·  view source on GitHub ↗
(
    manifest: &SourcesManifest,
    target: &str,
    include_aot: bool,
)

Source from the content-addressed store, hash-verified

8203}
8204
8205fn package_assets_with_options(
8206 manifest: &SourcesManifest,
8207 target: &str,
8208 include_aot: bool,
8209) -> Result<()> {
8210 let outputs = BuildOutputs::discover()?;
8211 outputs.write_manifest()?;
8212 validate_build_output_link_closure(&outputs)?;
8213 let build = &outputs.build_dir;
8214 let source = &outputs.source_dir;
8215 let stage = &outputs.package_stage;
8216
8217 if stage.exists() {
8218 fs::remove_dir_all(stage).with_context(|| format!("remove {}", stage.display()))?;
8219 }
8220 fs::create_dir_all(stage).with_context(|| format!("create {}", stage.display()))?;
8221
8222 let runtime_stage = stage.join("runtime/pglite");
8223 stage_runtime_tree(build, source, &runtime_stage)?;
8224 let assets_dir = Path::new(GENERATED_ASSETS_DIR);
8225 if assets_dir.exists() {
8226 fs::remove_dir_all(assets_dir)
8227 .with_context(|| format!("remove {}", assets_dir.display()))?;
8228 }
8229 fs::create_dir_all(assets_dir).with_context(|| format!("create {}", assets_dir.display()))?;
8230
8231 let runtime_archive = assets_dir.join("pglite.wasix.tar.zst");
8232 deterministic_tar_zst(&runtime_stage, Path::new("pglite"), &runtime_archive)?;
8233
8234 let pg_dump = assets_dir.join("bin/pg_dump.wasix.wasm");
8235 copy_file(outputs.module_path("tool:pg_dump")?, &pg_dump)?;
8236 let initdb = assets_dir.join("bin/initdb.wasix.wasm");
8237 copy_file(outputs.module_path("tool:initdb")?, &initdb)?;
8238
8239 let extension_packages = package_promoted_extensions(source, build, stage, &outputs)?;
8240 let extension_package_refs = extension_packages
8241 .iter()
8242 .map(|extension| ExtensionPackage {
8243 name: extension.name.as_str(),
8244 sql_name: extension.sql_name.as_str(),
8245 archive: extension.archive.as_str(),
8246 path: extension.path.as_path(),
8247 module_path: extension.module_path.as_deref(),
8248 native_module: extension.native_module.as_deref(),
8249 stable: extension.stable,
8250 })
8251 .collect::<Vec<_>>();
8252
8253 if include_aot {
8254 package_aot_artifacts(target, &outputs, manifest)?;
8255 }
8256 generate_pgdata_template_from_runtime_stage(manifest, &outputs, &runtime_stage, assets_dir)?;
8257 write_asset_manifest(
8258 manifest,
8259 outputs.module_path("runtime:pglite")?,
8260 &runtime_archive,
8261 &pg_dump,
8262 &initdb,

Callers 2

release_build_assetsFunction · 0.85
package_assetsFunction · 0.85

Calls 12

stage_runtime_treeFunction · 0.85
deterministic_tar_zstFunction · 0.85
copy_fileFunction · 0.85
package_aot_artifactsFunction · 0.85
write_asset_manifestFunction · 0.85
write_manifestMethod · 0.80
iterMethod · 0.80
joinMethod · 0.45
module_pathMethod · 0.45

Tested by

no test coverage detected