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') {
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