Browse Source

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>
anatawa12 11 months ago
parent
commit
4bfe4880fb

+ 6 - 0
.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`

+ 1 - 1
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",

+ 6 - 5
tooling/cli/src/interface/rust.rs

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

+ 1 - 0
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,