Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type BuildFlags = {
extraParams?: string[];
forcePods?: boolean;
onlyPods?: boolean;
device?: string | true;
};

export const getBuildOptions = ({platformName}: BuilderCommand) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,22 @@ export function buildProject(
return;
}

const isDevice = args.device;
let destination = '';
if (udid) {
destination = `id=${udid}`;
} else if (isDevice) {
destination = 'generic/platform=iOS';
} else if (mode === 'Debug') {
Comment on lines +55 to +61
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you move this logic further down so it's not tied to the simulatorDest logic below?

Copy link
Contributor Author

@jenskuhrjorgensen jenskuhrjorgensen Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to mess too much around with the previous logic, so my if-else is more or less a more verbose version of the previous ternary condition with the addition of an isDevice check.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previous logic would execute this branch regardless of the mode. I'd like to keep that behavior

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If not please provide a code suggestion and I would be happy to apply it :)

destination = `generic/platform=${simulatorDest}`;
} else {
destination = `generic/platform=${platform}`;
}

if (args.destination) {
destination += `,${args.destination}`;
}

const xcodebuildArgs = [
xcodeProject.isWorkspace ? '-workspace' : '-project',
xcodeProject.name,
Expand All @@ -62,12 +78,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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import openApp from './openApp';

export interface FlagsT extends BuildFlags {
simulator?: string;
device?: string | true;
udid?: string;
binaryPath?: string;
listDevices?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,13 @@

// Find all 'app' targets in the build settings
const applicationTargets = settings
.filter(
(setting: any) =>
setting.buildSettings.WRAPPER_EXTENSION ===
'app',
)
.filter((setting: any) => setting.buildSettings.WRAPPER_EXTENSION === 'app')
.map(({target: settingsTarget}: any) => settingsTarget);

if (applicationTargets.length === 0) return null
if (applicationTargets.length === 0) return null;

Check warning on line 44 in packages/cli-platform-apple/src/commands/runCommand/getBuildSettings.ts

View workflow job for this annotation

GitHub Actions / Lint

Expected { after 'if' condition

let selectedTarget = applicationTargets[0];

if (target) {
if (!applicationTargets.includes(target)) {
logger.info(
Expand All @@ -60,7 +56,7 @@
selectedTarget = target;
}
}

const targetIndex = applicationTargets.indexOf(selectedTarget);
return settings[targetIndex].buildSettings;
}
Expand Down
Loading