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

This commit is contained in:
Lucas Fernandes Nogueira 2024-09-02 13:13:22 -03:00 committed by GitHub
parent 79de4332b6
commit b42683592d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 29 additions and 6 deletions

View File

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

View File

@ -330,14 +330,31 @@ 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(())
@ -345,7 +362,7 @@ fn run_build(
)
.map_err(|e: TargetInvalid| anyhow::anyhow!(e.to_string()))??;
log_finished(out_files, "IPA");
log_finished(out_files, "iOS Bundle");
Ok(handle)
}