pub(crate) fn package_crate_buildpack(
    target_triple: impl AsRef<str>,
) -> Result<TempDir, PackageCrateBuildpackError> {
    let cargo_manifest_dir = std::env::var("CARGO_MANIFEST_DIR")
        .map(PathBuf::from)
        .map_err(PackageCrateBuildpackError::CannotDetermineCrateDirectory)?;

    let cargo_env = match cross_compile_assistance(target_triple.as_ref()) {
        CrossCompileAssistance::Configuration { cargo_env } => cargo_env,
        _ => vec![],
    };

    let buildpack_dir =
        tempdir().map_err(PackageCrateBuildpackError::CannotCreateBuildpackTempDirectory)?;

    let buildpack_binary_path = build_buildpack_binary(
        &cargo_manifest_dir,
        CargoProfile::Dev,
        target_triple.as_ref(),
        cargo_env,
    )
    .map_err(PackageCrateBuildpackError::BuildError)?;

    assemble_buildpack_directory(
        buildpack_dir.path(),
        &cargo_manifest_dir.join("buildpack.toml"),
        &buildpack_binary_path,
    )
    .map_err(PackageCrateBuildpackError::CannotAssembleBuildpackDirectory)?;

    Ok(buildpack_dir)
}
/// Packages the current crate as a buildpack into a temporary directory.
Packages the current crate as a buildpack into a temporary directory.
Packages the current crate as a buildpack into a temporary directory .
pub(crate) fn package_crate_buildpack(
    target_triple: impl AsRef<str>,
) -> Result<TempDir, PackageCrateBuildpackError> {
    let cargo_manifest_dir = std::env::var("CARGO_MANIFEST_DIR")
        .map(PathBuf::from)
        .map_err(PackageCrateBuildpackError::CannotDetermineCrateDirectory)?;
    let cargo_env = match cross_compile_assistance(target_triple.as_ref()) {
        CrossCompileAssistance::Configuration { cargo_env } => cargo_env,
        _ => vec![],
    };
    let buildpack_dir =
        tempdir().map_err(PackageCrateBuildpackError::CannotCreateBuildpackTempDirectory)?;
    let buildpack_binary_path = build_buildpack_binary(
        &cargo_manifest_dir,
        CargoProfile::Dev,
        target_triple.as_ref(),
        cargo_env,
    )
    .map_err(PackageCrateBuildpackError::BuildError)?;
    assemble_buildpack_directory(
        buildpack_dir.path(),
        &cargo_manifest_dir.join("buildpack.toml"),
        &buildpack_binary_path,
    )
    .map_err(PackageCrateBuildpackError::CannotAssembleBuildpackDirectory)?;
    Ok(buildpack_dir)
}
pub ( crate ) fn package_crate_buildpack ( target_triple : impl AsRef < str > , ) -> Result < TempDir , PackageCrateBuildpackError > { let cargo_manifest_dir = std :: env :: var ( " " ) . map ( PathBuf :: from ) . map_err ( PackageCrateBuildpackError :: CannotDetermineCrateDirectory ) ? ; let cargo_env = match cross_compile_assistance ( target_triple . as_ref ( ) ) { CrossCompileAssistance :: Configuration { cargo_env } => cargo_env , _ => vec ! [ ] , } ; let buildpack_dir = tempdir ( ) . map_err ( PackageCrateBuildpackError :: CannotCreateBuildpackTempDirectory ) ? ; let buildpack_binary_path = build_buildpack_binary ( & cargo_manifest_dir , CargoProfile :: Dev , target_triple . as_ref ( ) , cargo_env , ) . map_err ( PackageCrateBuildpackError :: BuildError ) ? ; assemble_buildpack_directory ( buildpack_dir . path ( ) , & cargo_manifest_dir . join ( " " ) , & buildpack_binary_path , ) . map_err ( PackageCrateBuildpackError :: CannotAssembleBuildpackDirectory ) ? ; Ok ( buildpack_dir ) }
Packages the current crate as a buildpack into a temporary directory.
Packages the current crate as a buildpack into a temporary directory .
target_triple
impl AsRef<str>
target_triple
impl AsRef<str>