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 @@ -39,17 +39,31 @@ export function buildProject(
args: BuildFlags,
): Promise<string> {
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') {
Comment thread
thymikee marked this conversation as resolved.
const simulatorDest = 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 = [
Expand All @@ -62,12 +76,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