Skip to content

Commit

Permalink
fix: fails to build universal fat binary if main bin is renamed to an…
Browse files Browse the repository at this point in the history
…other name (#10550)

* fix: fails to build universal fat binary if main bin is renamed to another name

* lint

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
  • Loading branch information
anatawa12 and lucasfernog authored Aug 11, 2024
1 parent bba1a44 commit 4bfe488
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .changes/universal-bin-build-fails.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"tauri-cli": patch:bug
"@tauri-apps/cli": patch:bug
---

fails to build universal fat binary if main bin is renamed to another name in `Cargo.toml`
2 changes: 1 addition & 1 deletion tooling/cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions tooling/cli/src/interface/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,12 @@ impl AppSettings for RustAppSettings {
}

fn app_binary_path(&self, options: &Options) -> crate::Result<PathBuf> {
let bin_name = self.cargo_package_settings().name.clone();
let binaries = self.get_binaries(&self.target_triple)?;
let bin_name = binaries
.iter()
.find(|x| x.main())
.expect("failed to find main binary")
.name();

let out_dir = self
.out_dir(options)
Expand Down Expand Up @@ -1082,10 +1087,6 @@ impl RustAppSettings {
})
}

pub fn cargo_package_settings(&self) -> &CargoPackageSettings {
&self.cargo_package_settings
}

fn target<'a>(&'a self, options: &'a Options) -> Option<&'a str> {
options
.target
Expand Down
1 change: 1 addition & 0 deletions tooling/cli/src/mobile/ios/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const TEMPLATE_DIR: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/templates/mobile

// unprefixed app_root seems pretty dangerous!!
// TODO: figure out what cargo-mobile meant by that
#[allow(clippy::too_many_arguments)]
pub fn gen(
tauri_config: &TauriConfig,
config: &Config,
Expand Down

0 comments on commit 4bfe488

Please sign in to comment.