From 4bfe4880fbef42d1a115f840e712d4a2f59c8ab3 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Sun, 11 Aug 2024 18:56:53 +0900 Subject: [PATCH] fix: fails to build universal fat binary if main bin is renamed to another name (#10550) * fix: fails to build universal fat binary if main bin is renamed to another name * lint --------- Co-authored-by: Lucas Nogueira --- .changes/universal-bin-build-fails.md | 6 ++++++ tooling/cli/Cargo.lock | 2 +- tooling/cli/src/interface/rust.rs | 11 ++++++----- tooling/cli/src/mobile/ios/project.rs | 1 + 4 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 .changes/universal-bin-build-fails.md diff --git a/.changes/universal-bin-build-fails.md b/.changes/universal-bin-build-fails.md new file mode 100644 index 000000000..56421eb41 --- /dev/null +++ b/.changes/universal-bin-build-fails.md @@ -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` diff --git a/tooling/cli/Cargo.lock b/tooling/cli/Cargo.lock index 1a632ed71..7b07ee782 100644 --- a/tooling/cli/Cargo.lock +++ b/tooling/cli/Cargo.lock @@ -5340,7 +5340,7 @@ dependencies = [ "glob", "html5ever", "infer 0.15.0", - "json-patch 1.2.0", + "json-patch 2.0.0", "json5", "kuchikiki", "log", diff --git a/tooling/cli/src/interface/rust.rs b/tooling/cli/src/interface/rust.rs index cefc71103..86945b384 100644 --- a/tooling/cli/src/interface/rust.rs +++ b/tooling/cli/src/interface/rust.rs @@ -860,7 +860,12 @@ impl AppSettings for RustAppSettings { } fn app_binary_path(&self, options: &Options) -> crate::Result { - 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) @@ -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 diff --git a/tooling/cli/src/mobile/ios/project.rs b/tooling/cli/src/mobile/ios/project.rs index 4cb2789b3..fcf5af924 100644 --- a/tooling/cli/src/mobile/ios/project.rs +++ b/tooling/cli/src/mobile/ios/project.rs @@ -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,