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 <lucas@tauri.app>
This commit is contained in:
anatawa12 2024-08-11 18:56:53 +09:00 committed by GitHub
parent bba1a44191
commit 4bfe4880fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 6 deletions

View File

@ -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`

View File

@ -5340,7 +5340,7 @@ dependencies = [
"glob",
"html5ever",
"infer 0.15.0",
"json-patch 1.2.0",
"json-patch 2.0.0",
"json5",
"kuchikiki",
"log",

View File

@ -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)
@ -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

View File

@ -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,