Skip to content

Commit

Permalink
fix(cli): iOS build targetting the simulator (#10847)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored Sep 2, 2024
1 parent 79de433 commit b426835
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .changes/fix-ios-build-simulator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"tauri-cli": patch:bug
"@tauri-apps/cli": patch:bug
---

Fixes `ios build --target [aarch64-sim | x86_64]` failing to generate the app bundle for the iOS simulator.
29 changes: 23 additions & 6 deletions crates/tauri-cli/src/mobile/ios/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,22 +330,39 @@ fn run_build(
export_config = export_config.authentication_credentials(credentials);
}

target.export(config, env, noise_level, export_config)?;
let out_dir = config.export_dir().join(target.arch);

if let Ok(ipa_path) = config.ipa_path() {
let out_dir = config.export_dir().join(target.arch);
if target.sdk == "iphonesimulator" {
fs::create_dir_all(&out_dir)?;
let path = out_dir.join(ipa_path.file_name().unwrap());
fs::rename(&ipa_path, &path)?;

let app_path = config
.archive_dir()
.join(format!("{}.xcarchive", config.scheme()))
.join("Products")
.join("Applications")
.join(config.app().stylized_name())
.with_extension("app");

let path = out_dir.join(app_path.file_name().unwrap());
fs::rename(&app_path, &path)?;
out_files.push(path);
} else {
target.export(config, env, noise_level, export_config)?;

if let Ok(ipa_path) = config.ipa_path() {
fs::create_dir_all(&out_dir)?;
let path = out_dir.join(ipa_path.file_name().unwrap());
fs::rename(&ipa_path, &path)?;
out_files.push(path);
}
}

Ok(())
},
)
.map_err(|e: TargetInvalid| anyhow::anyhow!(e.to_string()))??;

log_finished(out_files, "IPA");
log_finished(out_files, "iOS Bundle");

Ok(handle)
}
Expand Down

0 comments on commit b426835

Please sign in to comment.