Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): iOS build targetting the simulator #10847

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -307,22 +307,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