Skip to content

Commit 82406c6

Browse files
authored
feat(cli): improve iOS simulator usage and check SDK installation (#13231)
applies tauri-apps/cargo-mobile2#453
1 parent 07953fb commit 82406c6

File tree

5 files changed

+25
-13
lines changed

5 files changed

+25
-13
lines changed

.changes/improve-ios-sim.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"tauri-cli": patch:enhance
3+
"@tauri-apps/cli": patch:enhance
4+
---
5+
6+
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`).

Cargo.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/tauri-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ name = "cargo-tauri"
3636
path = "src/main.rs"
3737

3838
[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]
39-
cargo-mobile2 = { version = "0.19", default-features = false }
39+
cargo-mobile2 = { version = "0.20", default-features = false }
4040

4141
[dependencies]
4242
jsonrpsee = { version = "0.24", features = ["server"] }

crates/tauri-cli/src/mobile/ios/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ fn run_build(
327327
.skip_codesign();
328328
}
329329

330-
target.build(config, env, noise_level, profile, build_config)?;
330+
target.build(None, config, env, noise_level, profile, build_config)?;
331331

332332
let mut archive_config = ArchiveConfig::new();
333333
if skip_signing {

crates/tauri-cli/src/mobile/ios/dev.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ use anyhow::Context;
2525
use cargo_mobile2::{
2626
apple::{
2727
config::Config as AppleConfig,
28-
device::{Device, DeviceKind},
28+
device::{Device, DeviceKind, RunError},
29+
target::BuildError,
2930
},
3031
env::Env,
3132
opts::{NoiseLevel, Profile},
@@ -283,24 +284,29 @@ fn run_dev(
283284
cli_options,
284285
)?;
285286

286-
if open {
287+
let open_xcode = || {
287288
if !set_host {
288289
log::warn!("{PHYSICAL_IPHONE_DEV_WARNING}");
289290
}
290291
open_and_wait(config, &env)
292+
};
293+
294+
if open {
295+
open_xcode()
291296
} else if let Some(device) = &device {
292297
match run(device, options, config, noise_level, &env) {
293298
Ok(c) => Ok(Box::new(c) as Box<dyn DevProcess + Send>),
299+
Err(RunError::BuildFailed(BuildError::Sdk(sdk_err))) => {
300+
log::warn!("{sdk_err}");
301+
open_xcode()
302+
}
294303
Err(e) => {
295304
crate::dev::kill_before_dev_process();
296-
Err(e)
305+
Err(e.into())
297306
}
298307
}
299308
} else {
300-
if !set_host {
301-
log::warn!("{PHYSICAL_IPHONE_DEV_WARNING}");
302-
}
303-
open_and_wait(config, &env)
309+
open_xcode()
304310
}
305311
},
306312
)
@@ -312,7 +318,7 @@ fn run(
312318
config: &AppleConfig,
313319
noise_level: NoiseLevel,
314320
env: &Env,
315-
) -> crate::Result<DevChild> {
321+
) -> std::result::Result<DevChild, RunError> {
316322
let profile = if options.debug {
317323
Profile::Debug
318324
} else {
@@ -328,5 +334,4 @@ fn run(
328334
profile,
329335
)
330336
.map(DevChild::new)
331-
.map_err(Into::into)
332337
}

0 commit comments

Comments
 (0)