@@ -21,6 +21,11 @@ interface INativeSourceCodeGroup {
21
21
files : string [ ] ;
22
22
}
23
23
24
+ enum ProductArgs {
25
+ target = "target" ,
26
+ scheme = "scheme"
27
+ }
28
+
24
29
const DevicePlatformSdkName = "iphoneos" ;
25
30
const SimulatorPlatformSdkName = "iphonesimulator" ;
26
31
@@ -215,7 +220,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
215
220
const archivePath = options && options . archivePath ? path . resolve ( options . archivePath ) : path . join ( platformData . getBuildOutputPath ( buildConfig ) , projectData . projectName + ".xcarchive" ) ;
216
221
let args = [ "archive" , "-archivePath" , archivePath , "-configuration" ,
217
222
getConfigurationName ( ! buildConfig || buildConfig . release ) ]
218
- . concat ( this . xcbuildProjectArgs ( projectRoot , projectData , " scheme" ) ) ;
223
+ . concat ( this . xcbuildProjectArgs ( projectRoot , projectData , ProductArgs . scheme ) ) ;
219
224
220
225
if ( options && options . additionalArgs ) {
221
226
args = args . concat ( options . additionalArgs ) ;
@@ -329,7 +334,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
329
334
return exportFile ;
330
335
}
331
336
332
- private xcbuildProjectArgs ( projectRoot : string , projectData : IProjectData , product ?: "scheme" | "target" ) : string [ ] {
337
+ private xcbuildProjectArgs ( projectRoot : string , projectData : IProjectData , product ?: ProductArgs ) : string [ ] {
333
338
const xcworkspacePath = path . join ( projectRoot , projectData . projectName + ".xcworkspace" ) ;
334
339
if ( this . $fs . exists ( xcworkspacePath ) ) {
335
340
return [ "-workspace" , xcworkspacePath , product ? "-" + product : "-scheme" , projectData . projectName ] ;
@@ -403,6 +408,12 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
403
408
404
409
args = args . concat ( ( buildConfig && buildConfig . architectures ) || this . getBuildArchitectures ( projectData , buildConfig , [ "armv7" , "arm64" ] ) ) ;
405
410
411
+ if ( ! this . hasWatchApp ( projectData ) ) {
412
+ args = args . concat ( [
413
+ "-sdk" , DevicePlatformSdkName
414
+ ] ) ;
415
+ }
416
+
406
417
args = args . concat ( [
407
418
"BUILD_DIR=" + path . join ( projectRoot , constants . BUILD_DIR )
408
419
] ) ;
@@ -569,6 +580,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
569
580
570
581
private async buildForSimulator ( projectRoot : string , args : string [ ] , projectData : IProjectData , buildConfig ?: IBuildConfig ) : Promise < void > {
571
582
const architectures = this . getBuildArchitectures ( projectData , buildConfig , [ "i386" , "x86_64" ] ) ;
583
+ let product = ProductArgs . target ;
572
584
573
585
args = args
574
586
. concat ( architectures )
@@ -577,11 +589,16 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
577
589
"-configuration" , getConfigurationName ( buildConfig . release ) ,
578
590
"ONLY_ACTIVE_ARCH=NO" ,
579
591
"BUILD_DIR=" + path . join ( projectRoot , constants . BUILD_DIR ) ,
580
- "CODE_SIGNING_ALLOWED=NO" ,
581
- "-destination" ,
582
- "generic/platform=iOS Simulator"
583
- ] )
584
- . concat ( this . xcbuildProjectArgs ( projectRoot , projectData , "scheme" ) ) ;
592
+ ] ) ;
593
+
594
+ if ( this . hasWatchApp ( projectData ) ) {
595
+ product = ProductArgs . scheme ;
596
+ args = args . concat ( [ "-destination" , "generic/platform=iOS Simulator" , "CODE_SIGNING_ALLOWED=NO" ] ) ;
597
+ } else {
598
+ args = args . concat ( [ "-sdk" , SimulatorPlatformSdkName , "CODE_SIGN_IDENTITY=" ] ) ;
599
+ }
600
+
601
+ args = args . concat ( this . xcbuildProjectArgs ( projectRoot , projectData , product ) ) ;
585
602
586
603
await this . xcodebuild ( args , projectRoot , buildConfig . buildOutputStdio ) ;
587
604
}
@@ -779,7 +796,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
779
796
const resourcesDirectoryPath = projectData . getAppResourcesDirectoryPath ( ) ;
780
797
const pbxProjPath = this . getPbxProjPath ( projectData ) ;
781
798
const resourcesNativeCodePath = path . join (
782
- projectData . getAppResourcesDirectoryPath ( ) ,
799
+ resourcesDirectoryPath ,
783
800
platformData . normalizedPlatformName ,
784
801
constants . NATIVE_SOURCE_FOLDER
785
802
) ;
@@ -1387,6 +1404,17 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
1387
1404
"Enterprise" : "enterprise"
1388
1405
} [ provision . Type ] ;
1389
1406
}
1407
+
1408
+ private hasWatchApp ( projectData : IProjectData ) {
1409
+ const platformData = this . getPlatformData ( projectData ) ;
1410
+ const watchAppPath = path . join (
1411
+ projectData . getAppResourcesDirectoryPath ( ) ,
1412
+ platformData . normalizedPlatformName ,
1413
+ constants . IOS_WATCHAPP_FOLDER
1414
+ ) ;
1415
+
1416
+ return this . $fs . exists ( watchAppPath ) ;
1417
+ }
1390
1418
}
1391
1419
1392
1420
$injector . register ( "iOSProjectService" , IOSProjectService ) ;
0 commit comments