From 56e087471a347f6bee7422221a956925c60b17e3 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Mon, 23 Sep 2024 18:31:29 -0300 Subject: [PATCH] fix(cli): `ios xcode-script` arg parsing when using bun, closes #10742 (#11100) --- .changes/fix-bun-ios-usage.md | 6 ++++ .../tauri-cli/src/mobile/ios/xcode_script.rs | 28 ++++++++++--------- 2 files changed, 21 insertions(+), 13 deletions(-) create mode 100644 .changes/fix-bun-ios-usage.md diff --git a/.changes/fix-bun-ios-usage.md b/.changes/fix-bun-ios-usage.md new file mode 100644 index 000000000..0845898f7 --- /dev/null +++ b/.changes/fix-bun-ios-usage.md @@ -0,0 +1,6 @@ +--- +'tauri-cli': 'patch:bug' +'@tauri-apps/cli': 'patch:bug' +--- + +Fix iOS xcode-script usage with `bun`. diff --git a/crates/tauri-cli/src/mobile/ios/xcode_script.rs b/crates/tauri-cli/src/mobile/ios/xcode_script.rs index beadbf045..cc34d81da 100644 --- a/crates/tauri-cli/src/mobile/ios/xcode_script.rs +++ b/crates/tauri-cli/src/mobile/ios/xcode_script.rs @@ -12,7 +12,7 @@ use crate::{ use anyhow::Context; use cargo_mobile2::{apple::target::Target, opts::Profile}; -use clap::Parser; +use clap::{ArgAction, Parser}; use object::{Object, ObjectSymbol}; use std::{ @@ -33,14 +33,14 @@ pub struct Options { #[clap(long)] sdk_root: PathBuf, /// Value of `FRAMEWORK_SEARCH_PATHS` env var - #[clap(long)] - framework_search_paths: String, + #[clap(long, action = ArgAction::Append, num_args(0..))] + framework_search_paths: Vec, /// Value of `GCC_PREPROCESSOR_DEFINITIONS` env var - #[clap(long)] - gcc_preprocessor_definitions: String, + #[clap(long, action = ArgAction::Append, num_args(0..))] + gcc_preprocessor_definitions: Vec, /// Value of `HEADER_SEARCH_PATHS` env var - #[clap(long)] - header_search_paths: String, + #[clap(long, action = ArgAction::Append, num_args(0..))] + header_search_paths: Vec, /// Value of `CONFIGURATION` env var #[clap(long)] configuration: String, @@ -149,15 +149,17 @@ pub fn command(options: Options) -> Result<()> { include_dir.as_os_str(), ); - host_env.insert( - "FRAMEWORK_SEARCH_PATHS", - options.framework_search_paths.as_ref(), - ); + let framework_search_paths = options.framework_search_paths.join(" "); + host_env.insert("FRAMEWORK_SEARCH_PATHS", framework_search_paths.as_ref()); + + let gcc_preprocessor_definitions = options.gcc_preprocessor_definitions.join(" "); host_env.insert( "GCC_PREPROCESSOR_DEFINITIONS", - options.gcc_preprocessor_definitions.as_ref(), + gcc_preprocessor_definitions.as_ref(), ); - host_env.insert("HEADER_SEARCH_PATHS", options.header_search_paths.as_ref()); + + let header_search_paths = options.header_search_paths.join(" "); + host_env.insert("HEADER_SEARCH_PATHS", header_search_paths.as_ref()); let macos_target = Target::macos();