pub fn build(
        self,
        gendir: impl AsRef<Path>,
        metafar_path: impl AsRef<Path>,
    ) -> Result<PackageManifest> {
        let PackageBuilder {
            name,
            abi_revision,
            mut far_contents,
            blobs,
            manifest_path,
            published_name,
        } = self;

        far_contents.insert(
            META_PACKAGE_PATH.to_string(),
            create_meta_package_file(gendir.as_ref(), &name)
                .context(format!("Writing the {} file", META_PACKAGE_PATH))?,
        );

        let abi_revision =
            abi_revision.unwrap_or(ABIRevision::from(version_history::LATEST_VERSION));

        let abi_revision_file =
            Self::write_contents_to_file(gendir, ABI_REVISION_FILE_PATH, abi_revision.as_bytes())
                .context(format!("Writing the {} file", ABI_REVISION_FILE_PATH))?;

        far_contents.insert(
            ABI_REVISION_FILE_PATH.to_string(),
            abi_revision_file
                .path_to_string()
                .context(format!("Adding the {} file to the package", ABI_REVISION_FILE_PATH))?,
        );

        let creation_manifest =
            CreationManifest::from_external_and_far_contents(blobs, far_contents)?;

        let package_manifest = crate::build::build(
            &creation_manifest,
            metafar_path.as_ref(),
            published_name.as_ref().unwrap_or(&name),
        )?;

        if let Some(manifest_path) = manifest_path {
            // Write the package manifest to a file.
            let package_manifest_file = std::fs::File::create(&manifest_path).context(format!(
                "Failed to create package manifest: {}",
                manifest_path.display()
            ))?;
            serde_json::ser::to_writer(package_manifest_file, &package_manifest)?;
        }
        Ok(package_manifest)
    }
/// Build the package, using the specified dir, returning the
/// PackageManifest.
///
/// If a path for the manifest was specified, the PackageManifest will also
/// be written to there.
///
/// The `gendir` param is assumed to be a path to folder which is only used
/// by this package's creation, so this fn does not try to create paths
/// within it that are unique across different packages.
Build the package, using the specified dir, returning the
PackageManifest.

If a path for the manifest was specified, the PackageManifest will also
be written to there.

The `gendir` param is assumed to be a path to folder which is only used
by this package's creation, so this fn does not try to create paths
within it that are unique across different packages.
Build the package using the specified dir returning the PackageManifest . If a path for the manifest was specified the PackageManifest will also be written to there . The ` gendir ` param is assumed to be a path to folder which is only used by this package ' s creation so this fn does not try to create paths within it that are unique across different packages .
pub fn build(
        self,
        gendir: impl AsRef<Path>,
        metafar_path: impl AsRef<Path>,
    ) -> Result<PackageManifest> {
        let PackageBuilder {
            name,
            abi_revision,
            mut far_contents,
            blobs,
            manifest_path,
            published_name,
        } = self;
        far_contents.insert(
            META_PACKAGE_PATH.to_string(),
            create_meta_package_file(gendir.as_ref(), &name)
                .context(format!("Writing the {} file", META_PACKAGE_PATH))?,
        );
        let abi_revision =
            abi_revision.unwrap_or(ABIRevision::from(version_history::LATEST_VERSION));
        let abi_revision_file =
            Self::write_contents_to_file(gendir, ABI_REVISION_FILE_PATH, abi_revision.as_bytes())
                .context(format!("Writing the {} file", ABI_REVISION_FILE_PATH))?;
        far_contents.insert(
            ABI_REVISION_FILE_PATH.to_string(),
            abi_revision_file
                .path_to_string()
                .context(format!("Adding the {} file to the package", ABI_REVISION_FILE_PATH))?,
        );
        let creation_manifest =
            CreationManifest::from_external_and_far_contents(blobs, far_contents)?;
        let package_manifest = crate::build::build(
            &creation_manifest,
            metafar_path.as_ref(),
            published_name.as_ref().unwrap_or(&name),
        )?;
        if let Some(manifest_path) = manifest_path {
            // Write the package manifest to a file.
            let package_manifest_file = std::fs::File::create(&manifest_path).context(format!(
                "Failed to create package manifest: {}",
                manifest_path.display()
            ))?;
            serde_json::ser::to_writer(package_manifest_file, &package_manifest)?;
        }
        Ok(package_manifest)
    }
pub fn build ( self , gendir : impl AsRef < Path > , metafar_path : impl AsRef < Path > , ) -> Result < PackageManifest > { let PackageBuilder { name , abi_revision , mut far_contents , blobs , manifest_path , published_name , } = self ; far_contents . insert ( META_PACKAGE_PATH . to_string ( ) , create_meta_package_file ( gendir . as_ref ( ) , & name ) . context ( format ! ( " " META_PACKAGE_PATH ) ) ? , ) ; let abi_revision = abi_revision . unwrap_or ( ABIRevision :: from ( version_history :: LATEST_VERSION ) ) ; let abi_revision_file = Self :: write_contents_to_file ( gendir , ABI_REVISION_FILE_PATH , abi_revision . as_bytes ( ) ) . context ( format ! ( " " ABI_REVISION_FILE_PATH ) ) ? ; far_contents . insert ( ABI_REVISION_FILE_PATH . to_string ( ) , abi_revision_file . path_to_string ( ) . context ( format ! ( " " ABI_REVISION_FILE_PATH ) ) ? , ) ; let creation_manifest = CreationManifest :: from_external_and_far_contents ( blobs , far_contents ) ? ; let package_manifest = crate :: build :: build ( & creation_manifest , metafar_path . as_ref ( ) , published_name . as_ref ( ) . unwrap_or ( & name ) , ) ? ; if let Some ( manifest_path ) = manifest_path { // Write the package manifest to a file. let package_manifest_file = std :: fs :: File :: create ( & manifest_path ) . context ( format ! ( " " manifest_path display ( ) ) ) ? ; serde_json :: ser :: to_writer ( package_manifest_file , & package_manifest ) ? ; } Ok ( package_manifest ) }
Build the package, using the specified dir, returning the
PackageManifest.
Build the package using the specified dir returning the PackageManifest .
self
gendir
impl AsRef<Path>
metafar_path
impl AsRef<Path>
self
gendir
impl AsRef<Path>
metafar_path
impl AsRef<Path>