diff --git a/.changes/devicectl.md b/.changes/devicectl.md new file mode 100644 index 000000000000..2d8302f081cf --- /dev/null +++ b/.changes/devicectl.md @@ -0,0 +1,6 @@ +--- +"tauri-cli": patch:feat +"@tauri-apps/cli": patch:feat +--- + +Use `devicectl` to connect to iOS 17+ devices on macOS 14+. diff --git a/.github/workflows/test-core.yml b/.github/workflows/test-core.yml index 6c0b57eaa592..2ec2093b3f1f 100644 --- a/.github/workflows/test-core.yml +++ b/.github/workflows/test-core.yml @@ -105,6 +105,7 @@ jobs: cargo update -p toml@0.7.8 --precise 0.7.6 cargo update -p toml_edit@0.19.15 --precise 0.19.14 cargo update -p cfg-expr@0.15.5 --precise 0.15.4 + cargo update -p system-deps --precise 6.1.1 - name: test uses: actions-rs/cargo@v1 diff --git a/core/tauri-runtime/src/window.rs b/core/tauri-runtime/src/window.rs index 95c69e894fab..2e15a2c22981 100644 --- a/core/tauri-runtime/src/window.rs +++ b/core/tauri-runtime/src/window.rs @@ -319,10 +319,9 @@ impl> PendingWindow { protocol: H, ) { let uri_scheme = uri_scheme.into(); - self.uri_scheme_protocols.insert( - uri_scheme, - Box::new(move |data, responder| (protocol)(data, responder)), - ); + self + .uri_scheme_protocols + .insert(uri_scheme, Box::new(protocol)); } #[cfg(target_os = "android")] diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index 105133870a0f..bd5320191840 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -203,7 +203,7 @@ fn replace_csp_nonce( .into_iter() .map(|n| format!("'nonce-{n}'")) .collect::>(); - let sources = csp.entry(directive.into()).or_insert_with(Default::default); + let sources = csp.entry(directive.into()).or_default(); let self_source = "'self'".to_string(); if !sources.contains(&self_source) { sources.push(self_source); diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 791344ad5d62..e0c35bcb9ad2 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -2247,7 +2247,7 @@ impl Window { window_label, event, }) - .or_insert_with(Default::default) + .or_default() .insert(event_id); Ok(event_id) diff --git a/tooling/bundler/src/bundle/common.rs b/tooling/bundler/src/bundle/common.rs index 9af5b06445f1..3370c717a17b 100644 --- a/tooling/bundler/src/bundle/common.rs +++ b/tooling/bundler/src/bundle/common.rs @@ -164,9 +164,8 @@ impl CommandExt for Command { let mut lines = stdout_lines_.lock().unwrap(); loop { buf.clear(); - match tauri_utils::io::read_line(&mut stdout, &mut buf) { - Ok(s) if s == 0 => break, - _ => (), + if let Ok(0) = tauri_utils::io::read_line(&mut stdout, &mut buf) { + break; } debug!(action = "stdout"; "{}", String::from_utf8_lossy(&buf)); lines.extend(buf.clone()); @@ -182,9 +181,8 @@ impl CommandExt for Command { let mut lines = stderr_lines_.lock().unwrap(); loop { buf.clear(); - match tauri_utils::io::read_line(&mut stderr, &mut buf) { - Ok(s) if s == 0 => break, - _ => (), + if let Ok(0) = tauri_utils::io::read_line(&mut stderr, &mut buf) { + break; } debug!(action = "stderr"; "{}", String::from_utf8_lossy(&buf)); lines.extend(buf.clone()); diff --git a/tooling/cli/Cargo.lock b/tooling/cli/Cargo.lock index 0c7e29524a7a..cb1cab5ccc0b 100644 --- a/tooling/cli/Cargo.lock +++ b/tooling/cli/Cargo.lock @@ -155,12 +155,6 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d67af77d68a931ecd5cbd8a3b5987d63a1d1d1278f7f6a60ae33db485cdebb69" -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - [[package]] name = "arrayvec" version = "0.7.4" @@ -401,13 +395,13 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cargo-mobile2" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbb5ab43a707d5fd500ab073439d5fa10ade6806c5eb192801fae24e396a546" +checksum = "a1b56286cbb6fa6c603c849c79b7e38e062d532b227a24ad6ff9d535965f95c5" dependencies = [ "cocoa", "colored 1.9.4", - "core-foundation 0.7.0", + "core-foundation 0.9.3", "deunicode", "duct", "dunce", @@ -427,6 +421,7 @@ dependencies = [ "objc_id", "once-cell-regex", "openssl", + "os_info", "os_pipe", "path_abs", "serde", @@ -1947,7 +1942,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b5dde66c53d6dcdc8caea1874a45632ec0fcf5b437789f1e45766a1512ce803" dependencies = [ "anyhow", - "arrayvec 0.7.4", + "arrayvec", "async-lock", "async-trait", "beef", @@ -2092,14 +2087,65 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" [[package]] name = "lexical-core" -version = "0.7.6" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" +checksum = "2cde5de06e8d4c2faabc400238f9ae1c74d5412d03a7bd067645ccbc47070e46" dependencies = [ - "arrayvec 0.5.2", - "bitflags 1.3.2", - "cfg-if", - "ryu", + "lexical-parse-float", + "lexical-parse-integer", + "lexical-util", + "lexical-write-float", + "lexical-write-integer", +] + +[[package]] +name = "lexical-parse-float" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683b3a5ebd0130b8fb52ba0bdc718cc56815b6a097e28ae5a6997d0ad17dc05f" +dependencies = [ + "lexical-parse-integer", + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-parse-integer" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d0994485ed0c312f6d965766754ea177d07f9c00c9b82a5ee62ed5b47945ee9" +dependencies = [ + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-util" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5255b9ff16ff898710eb9eb63cb39248ea8a5bb036bea8085b1a767ff6c4e3fc" +dependencies = [ + "static_assertions", +] + +[[package]] +name = "lexical-write-float" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accabaa1c4581f05a3923d1b4cfd124c329352288b7b9da09e766b0668116862" +dependencies = [ + "lexical-util", + "lexical-write-integer", + "static_assertions", +] + +[[package]] +name = "lexical-write-integer" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1b6f3d1f4422866b68192d62f77bc5c700bee84f3069f2469d7bc8c77852446" +dependencies = [ + "lexical-util", "static_assertions", ] diff --git a/tooling/cli/Cargo.toml b/tooling/cli/Cargo.toml index d2a6d31a2397..71594e4e56b0 100644 --- a/tooling/cli/Cargo.toml +++ b/tooling/cli/Cargo.toml @@ -39,7 +39,7 @@ name = "cargo-tauri" path = "src/main.rs" [dependencies] -cargo-mobile2 = { version = "0.6", default-features = false } +cargo-mobile2 = { version = "0.7", default-features = false } textwrap = { version = "0.11.0", features = [ "term_size" ] } jsonrpsee = { version = "0.16", features = [ "server" ] } jsonrpsee-core = "0.16" diff --git a/tooling/cli/src/interface/rust/desktop.rs b/tooling/cli/src/interface/rust/desktop.rs index 49a0ea9ee6dc..ba78136b852f 100644 --- a/tooling/cli/src/interface/rust/desktop.rs +++ b/tooling/cli/src/interface/rust/desktop.rs @@ -247,9 +247,8 @@ fn build_dev_app, ExitReason) + Send + 'static>( let mut io_stderr = std::io::stderr(); loop { buf.clear(); - match tauri_utils::io::read_line(&mut stderr, &mut buf) { - Ok(s) if s == 0 => break, - _ => (), + if let Ok(0) = tauri_utils::io::read_line(&mut stderr, &mut buf) { + break; } let _ = io_stderr.write_all(&buf); if !buf.ends_with(&[b'\r']) { diff --git a/tooling/cli/src/lib.rs b/tooling/cli/src/lib.rs index bceb874c40d0..f60ed8067706 100644 --- a/tooling/cli/src/lib.rs +++ b/tooling/cli/src/lib.rs @@ -277,9 +277,8 @@ impl CommandExt for Command { let mut lines = stdout_lines_.lock().unwrap(); loop { buf.clear(); - match tauri_utils::io::read_line(&mut stdout, &mut buf) { - Ok(s) if s == 0 => break, - _ => (), + if let Ok(0) = tauri_utils::io::read_line(&mut stdout, &mut buf) { + break; } debug!(action = "stdout"; "{}", String::from_utf8_lossy(&buf)); lines.extend(buf.clone()); @@ -295,9 +294,8 @@ impl CommandExt for Command { let mut lines = stderr_lines_.lock().unwrap(); loop { buf.clear(); - match tauri_utils::io::read_line(&mut stderr, &mut buf) { - Ok(s) if s == 0 => break, - _ => (), + if let Ok(0) = tauri_utils::io::read_line(&mut stderr, &mut buf) { + break; } debug!(action = "stderr"; "{}", String::from_utf8_lossy(&buf)); lines.extend(buf.clone()); diff --git a/tooling/cli/src/mobile/ios.rs b/tooling/cli/src/mobile/ios.rs index 15e8399e7cf6..d8ee730748a1 100644 --- a/tooling/cli/src/mobile/ios.rs +++ b/tooling/cli/src/mobile/ios.rs @@ -8,8 +8,7 @@ use cargo_mobile2::{ Config as AppleConfig, Metadata as AppleMetadata, Platform as ApplePlatform, Raw as RawAppleConfig, }, - device::Device, - ios_deploy, simctl, + device::{self, Device}, target::Target, teams::find_development_teams, }, @@ -146,8 +145,8 @@ pub fn get_config( (config, metadata) } -fn ios_deploy_device_prompt<'a>(env: &'_ Env, target: Option<&str>) -> Result> { - let device_list = ios_deploy::device_list(env) +fn connected_device_prompt<'a>(env: &'_ Env, target: Option<&str>) -> Result> { + let device_list = device::list_devices(env) .map_err(|cause| anyhow::anyhow!("Failed to detect connected iOS devices: {cause}"))?; if !device_list.is_empty() { let device = if let Some(t) = target { @@ -192,8 +191,8 @@ fn ios_deploy_device_prompt<'a>(env: &'_ Env, target: Option<&str>) -> Result) -> Result { - let simulator_list = simctl::device_list(env).map_err(|cause| { +fn simulator_prompt(env: &'_ Env, target: Option<&str>) -> Result { + let simulator_list = device::list_simulators(env).map_err(|cause| { anyhow::anyhow!("Failed to detect connected iOS Simulator devices: {cause}") })?; if !simulator_list.is_empty() { @@ -233,7 +232,7 @@ fn simulator_prompt(env: &'_ Env, target: Option<&str>) -> Result(env: &'_ Env, target: Option<&str>) -> Result> { - if let Ok(device) = ios_deploy_device_prompt(env, target) { + if let Ok(device) = connected_device_prompt(env, target) { Ok(device) } else { let simulator = simulator_prompt(env, target)?;