From d9c57c26f132a3e9f2dacf618f70ab83f3857741 Mon Sep 17 00:00:00 2001 From: Jens Kuhr Hansen Date: Wed, 27 Aug 2025 10:18:24 +0200 Subject: [PATCH 1/4] Fix destination in buildProject Fix: Fix destination in buildProject when running with device arg but no specific UDID or args.destination --- .../src/commands/buildCommand/buildProject.ts | 47 ++++++++++++------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/packages/cli-platform-apple/src/commands/buildCommand/buildProject.ts b/packages/cli-platform-apple/src/commands/buildCommand/buildProject.ts index 4f68b6215..e9ce204ef 100644 --- a/packages/cli-platform-apple/src/commands/buildCommand/buildProject.ts +++ b/packages/cli-platform-apple/src/commands/buildCommand/buildProject.ts @@ -39,17 +39,35 @@ export function buildProject( args: BuildFlags, ): Promise { return new Promise((resolve, reject) => { - const simulatorDest = simulatorDestinationMap?.[platform]; - - if (!simulatorDest) { - reject( - new CLIError( - `Unknown platform: ${platform}. Please, use one of: ${Object.values( - supportedPlatforms, - ).join(', ')}.`, - ), - ); - return; + const isDevice = args.device; + let destination = ''; + if (udid) { + destination = `id=${udid}`; + } else if (isDevice) { + destination = 'generic/platform=iOS'; + } else if (mode === 'Debug') { + const simulatorDest = + simulatorDestinationMap.simulatorDestinationMap === null || + simulatorDestinationMap.simulatorDestinationMap === void 0 + ? void 0 + : simulatorDestinationMap.simulatorDestinationMap[platform]; + if (!simulatorDest) { + reject( + new CLIError( + `Unknown platform: ${platform}. Please, use one of: ${Object.values( + supportedPlatforms, + ).join(', ')}.`, + ), + ); + return; + } + destination = `generic/platform=${simulatorDest}`; + } else { + destination = `generic/platform=${platform}`; + } + + if (args.destination) { + destination += `,${args.destination}`; } const xcodebuildArgs = [ @@ -62,12 +80,7 @@ export function buildProject( '-scheme', scheme, '-destination', - (udid - ? `id=${udid}` - : mode === 'Debug' - ? `generic/platform=${simulatorDest}` - : `generic/platform=${platform}`) + - (args.destination ? ',' + args.destination : ''), + destination, ]; if (args.extraParams) { From f89a4674e438966c521ea42beafbde66e38ec58b Mon Sep 17 00:00:00 2001 From: Jens Kuhr Hansen Date: Wed, 27 Aug 2025 10:25:00 +0200 Subject: [PATCH 2/4] Fix: Add missing device build flag --- .../cli-platform-apple/src/commands/buildCommand/buildOptions.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/cli-platform-apple/src/commands/buildCommand/buildOptions.ts b/packages/cli-platform-apple/src/commands/buildCommand/buildOptions.ts index c3cb54a42..303431e4e 100644 --- a/packages/cli-platform-apple/src/commands/buildCommand/buildOptions.ts +++ b/packages/cli-platform-apple/src/commands/buildCommand/buildOptions.ts @@ -13,6 +13,7 @@ export type BuildFlags = { extraParams?: string[]; forcePods?: boolean; onlyPods?: boolean; + device?: string | true; }; export const getBuildOptions = ({platformName}: BuilderCommand) => { From 4b551d3e693d3ff49cb3d6c10ed00e2b336e8780 Mon Sep 17 00:00:00 2001 From: Jens Kuhr Hansen Date: Wed, 27 Aug 2025 10:25:38 +0200 Subject: [PATCH 3/4] Fix: Remove migrated device build flag --- packages/cli-platform-apple/src/commands/runCommand/createRun.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/cli-platform-apple/src/commands/runCommand/createRun.ts b/packages/cli-platform-apple/src/commands/runCommand/createRun.ts index a8ab42f67..dd2c1dda8 100644 --- a/packages/cli-platform-apple/src/commands/runCommand/createRun.ts +++ b/packages/cli-platform-apple/src/commands/runCommand/createRun.ts @@ -39,7 +39,6 @@ import openApp from './openApp'; export interface FlagsT extends BuildFlags { simulator?: string; - device?: string | true; udid?: string; binaryPath?: string; listDevices?: boolean; From 8065745cdbbf8da21b7c46dfd100c30b6a00613f Mon Sep 17 00:00:00 2001 From: Jens Kuhr Hansen Date: Wed, 27 Aug 2025 10:39:28 +0200 Subject: [PATCH 4/4] Fix: JS copy-paste --- .../src/commands/buildCommand/buildProject.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/cli-platform-apple/src/commands/buildCommand/buildProject.ts b/packages/cli-platform-apple/src/commands/buildCommand/buildProject.ts index e9ce204ef..0dfda1b97 100644 --- a/packages/cli-platform-apple/src/commands/buildCommand/buildProject.ts +++ b/packages/cli-platform-apple/src/commands/buildCommand/buildProject.ts @@ -46,11 +46,7 @@ export function buildProject( } else if (isDevice) { destination = 'generic/platform=iOS'; } else if (mode === 'Debug') { - const simulatorDest = - simulatorDestinationMap.simulatorDestinationMap === null || - simulatorDestinationMap.simulatorDestinationMap === void 0 - ? void 0 - : simulatorDestinationMap.simulatorDestinationMap[platform]; + const simulatorDest = simulatorDestinationMap?.[platform]; if (!simulatorDest) { reject( new CLIError(