pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
  let package_base_name = format!(
    "{}_{}_{}",
    settings.main_binary_name(),
    settings.version_string(),
    match settings.binary_arch() {
      "x86_64" => "x64",
      other => other,
    }
  );
  let app_bundle_name = format!("{}.app", package_base_name);
  common::print_bundling(&app_bundle_name)?;
  let app_bundle_path = settings
    .project_out_directory()
    .join("bundle/osx")
    .join(&app_bundle_name);
  if app_bundle_path.exists() {
    fs::remove_dir_all(&app_bundle_path)
      .with_context(|| format!("Failed to remove old {}", app_bundle_name))?;
  }
  let bundle_directory = app_bundle_path.join("Contents");
  fs::create_dir_all(&bundle_directory).with_context(|| {
    format!(
      "Failed to create bundle directory at {:?}",
      bundle_directory
    )
  })?;

  let resources_dir = bundle_directory.join("Resources");
  let bin_dir = bundle_directory.join("MacOS");

  let bundle_icon_file: Option<PathBuf> =
    { create_icns_file(&resources_dir, settings).with_context(|| "Failed to create app icon")? };

  create_info_plist(&bundle_directory, bundle_icon_file, settings)
    .with_context(|| "Failed to create Info.plist")?;

  copy_frameworks_to_bundle(&bundle_directory, settings)
    .with_context(|| "Failed to bundle frameworks")?;

  settings.copy_resources(&resources_dir)?;

  settings
    .copy_binaries(&bin_dir)
    .with_context(|| "Failed to copy external binaries")?;

  copy_binaries_to_bundle(&bundle_directory, settings)?;

  let use_bootstrapper = settings.osx_use_bootstrapper();
  if use_bootstrapper {
    create_bootstrapper(&bundle_directory, settings)
      .with_context(|| "Failed to create OSX bootstrapper")?;
  }
  Ok(vec![app_bundle_path])
}
/// Bundles the project.
/// Returns a vector of PathBuf that shows where the .app was created.
Bundles the project.
Returns a vector of PathBuf that shows where the .app was created.
Bundles the project . Returns a vector of PathBuf that shows where the . app was created .
pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
  let package_base_name = format!(
    "{}_{}_{}",
    settings.main_binary_name(),
    settings.version_string(),
    match settings.binary_arch() {
      "x86_64" => "x64",
      other => other,
    }
  );
  let app_bundle_name = format!("{}.app", package_base_name);
  common::print_bundling(&app_bundle_name)?;
  let app_bundle_path = settings
    .project_out_directory()
    .join("bundle/osx")
    .join(&app_bundle_name);
  if app_bundle_path.exists() {
    fs::remove_dir_all(&app_bundle_path)
      .with_context(|| format!("Failed to remove old {}", app_bundle_name))?;
  }
  let bundle_directory = app_bundle_path.join("Contents");
  fs::create_dir_all(&bundle_directory).with_context(|| {
    format!(
      "Failed to create bundle directory at {:?}",
      bundle_directory
    )
  })?;
  let resources_dir = bundle_directory.join("Resources");
  let bin_dir = bundle_directory.join("MacOS");
  let bundle_icon_file: Option<PathBuf> =
    { create_icns_file(&resources_dir, settings).with_context(|| "Failed to create app icon")? };
  create_info_plist(&bundle_directory, bundle_icon_file, settings)
    .with_context(|| "Failed to create Info.plist")?;
  copy_frameworks_to_bundle(&bundle_directory, settings)
    .with_context(|| "Failed to bundle frameworks")?;
  settings.copy_resources(&resources_dir)?;
  settings
    .copy_binaries(&bin_dir)
    .with_context(|| "Failed to copy external binaries")?;
  copy_binaries_to_bundle(&bundle_directory, settings)?;
  let use_bootstrapper = settings.osx_use_bootstrapper();
  if use_bootstrapper {
    create_bootstrapper(&bundle_directory, settings)
      .with_context(|| "Failed to create OSX bootstrapper")?;
  }
  Ok(vec![app_bundle_path])
}
pub fn bundle_project ( settings : & Settings ) -> crate :: Result < Vec < PathBuf > > { let package_base_name = format ! ( " " settings main_binary_name ( ) settings version_string ( ) match settings binary_arch ( ) { " " " " other other } ) ; let app_bundle_name = format ! ( " " package_base_name ) ; common :: print_bundling ( & app_bundle_name ) ? ; let app_bundle_path = settings . project_out_directory ( ) . join ( " " ) . join ( & app_bundle_name ) ; if app_bundle_path . exists ( ) { fs :: remove_dir_all ( & app_bundle_path ) . with_context ( | | format ! ( " " app_bundle_name ) ) ? ; } let bundle_directory = app_bundle_path . join ( " " ) ; fs :: create_dir_all ( & bundle_directory ) . with_context ( | | { format ! ( " " bundle_directory ) } ) ? ; let resources_dir = bundle_directory . join ( " " ) ; let bin_dir = bundle_directory . join ( " " ) ; let bundle_icon_file : Option < PathBuf > = { create_icns_file ( & resources_dir , settings ) . with_context ( | | " " ) ? } ; create_info_plist ( & bundle_directory , bundle_icon_file , settings ) . with_context ( | | " " ) ? ; copy_frameworks_to_bundle ( & bundle_directory , settings ) . with_context ( | | " " ) ? ; settings . copy_resources ( & resources_dir ) ? ; settings . copy_binaries ( & bin_dir ) . with_context ( | | " " ) ? ; copy_binaries_to_bundle ( & bundle_directory , settings ) ? ; let use_bootstrapper = settings . osx_use_bootstrapper ( ) ; if use_bootstrapper { create_bootstrapper ( & bundle_directory , settings ) . with_context ( | | " " ) ? ; } Ok ( vec ! [ app_bundle_path ] ) }
Bundles the project.
Bundles the project .
settings
&Settings
settings
&Settings