feat(cli): improve iOS simulator usage and check SDK installation (#13231)

applies https://github.com/tauri-apps/cargo-mobile2/pull/453
This commit is contained in:
Lucas Fernandes Nogueira 2025-04-14 14:57:13 -03:00 committed by GitHub
parent 07953fb9c3
commit 82406c61e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 25 additions and 13 deletions

View File

@ -0,0 +1,6 @@
---
"tauri-cli": patch:enhance
"@tauri-apps/cli": patch:enhance
---
Improve iOS simulator usage, checking if Xcode iOS SDK is installed and allowing usage of Simulator for older iOS releases (previously only supported when running on Xcode via `ios dev --open`).

5
Cargo.lock generated
View File

@ -1062,9 +1062,9 @@ dependencies = [
[[package]]
name = "cargo-mobile2"
version = "0.19.0"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24b5acda005352ad50a3e58c8777781732d6ac1e8a82ab90d5ffd70b69c665f1"
checksum = "4957236e228c1014a3effe161d2320864c599e740414cdb3d1f98cf7427a1b08"
dependencies = [
"colored",
"core-foundation 0.10.0",
@ -1085,6 +1085,7 @@ dependencies = [
"os_info",
"os_pipe",
"path_abs",
"plist",
"serde",
"serde_json",
"textwrap",

View File

@ -36,7 +36,7 @@ name = "cargo-tauri"
path = "src/main.rs"
[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\", target_os = \"windows\", target_os = \"macos\"))".dependencies]
cargo-mobile2 = { version = "0.19", default-features = false }
cargo-mobile2 = { version = "0.20", default-features = false }
[dependencies]
jsonrpsee = { version = "0.24", features = ["server"] }

View File

@ -327,7 +327,7 @@ fn run_build(
.skip_codesign();
}
target.build(config, env, noise_level, profile, build_config)?;
target.build(None, config, env, noise_level, profile, build_config)?;
let mut archive_config = ArchiveConfig::new();
if skip_signing {

View File

@ -25,7 +25,8 @@ use anyhow::Context;
use cargo_mobile2::{
apple::{
config::Config as AppleConfig,
device::{Device, DeviceKind},
device::{Device, DeviceKind, RunError},
target::BuildError,
},
env::Env,
opts::{NoiseLevel, Profile},
@ -283,24 +284,29 @@ fn run_dev(
cli_options,
)?;
if open {
let open_xcode = || {
if !set_host {
log::warn!("{PHYSICAL_IPHONE_DEV_WARNING}");
}
open_and_wait(config, &env)
};
if open {
open_xcode()
} else if let Some(device) = &device {
match run(device, options, config, noise_level, &env) {
Ok(c) => Ok(Box::new(c) as Box<dyn DevProcess + Send>),
Err(RunError::BuildFailed(BuildError::Sdk(sdk_err))) => {
log::warn!("{sdk_err}");
open_xcode()
}
Err(e) => {
crate::dev::kill_before_dev_process();
Err(e)
Err(e.into())
}
}
} else {
if !set_host {
log::warn!("{PHYSICAL_IPHONE_DEV_WARNING}");
}
open_and_wait(config, &env)
open_xcode()
}
},
)
@ -312,7 +318,7 @@ fn run(
config: &AppleConfig,
noise_level: NoiseLevel,
env: &Env,
) -> crate::Result<DevChild> {
) -> std::result::Result<DevChild, RunError> {
let profile = if options.debug {
Profile::Debug
} else {
@ -328,5 +334,4 @@ fn run(
profile,
)
.map(DevChild::new)
.map_err(Into::into)
}