File tree Expand file tree Collapse file tree
packages/cli-platform-apple/src/commands/buildCommand Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,17 +39,35 @@ export function buildProject(
3939 args : BuildFlags ,
4040) : Promise < string > {
4141 return new Promise ( ( resolve , reject ) => {
42- const simulatorDest = simulatorDestinationMap ?. [ platform ] ;
43-
44- if ( ! simulatorDest ) {
45- reject (
46- new CLIError (
47- `Unknown platform: ${ platform } . Please, use one of: ${ Object . values (
48- supportedPlatforms ,
49- ) . join ( ', ' ) } .`,
50- ) ,
51- ) ;
52- return ;
42+ const isDevice = args . device ;
43+ let destination = '' ;
44+ if ( udid ) {
45+ destination = `id=${ udid } ` ;
46+ } else if ( isDevice ) {
47+ destination = 'generic/platform=iOS' ;
48+ } else if ( mode === 'Debug' ) {
49+ const simulatorDest =
50+ simulatorDestinationMap . simulatorDestinationMap === null ||
51+ simulatorDestinationMap . simulatorDestinationMap === void 0
52+ ? void 0
53+ : simulatorDestinationMap . simulatorDestinationMap [ platform ] ;
54+ if ( ! simulatorDest ) {
55+ reject (
56+ new CLIError (
57+ `Unknown platform: ${ platform } . Please, use one of: ${ Object . values (
58+ supportedPlatforms ,
59+ ) . join ( ', ' ) } .`,
60+ ) ,
61+ ) ;
62+ return ;
63+ }
64+ destination = `generic/platform=${ simulatorDest } ` ;
65+ } else {
66+ destination = `generic/platform=${ platform } ` ;
67+ }
68+
69+ if ( args . destination ) {
70+ destination += `,${ args . destination } ` ;
5371 }
5472
5573 const xcodebuildArgs = [
@@ -62,12 +80,7 @@ export function buildProject(
6280 '-scheme' ,
6381 scheme ,
6482 '-destination' ,
65- ( udid
66- ? `id=${ udid } `
67- : mode === 'Debug'
68- ? `generic/platform=${ simulatorDest } `
69- : `generic/platform=${ platform } ` ) +
70- ( args . destination ? ',' + args . destination : '' ) ,
83+ destination ,
7184 ] ;
7285
7386 if ( args . extraParams ) {
You can’t perform that action at this time.
0 commit comments