@@ -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 ) ;
@@ -340,7 +345,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
340
345
return exportFile ;
341
346
}
342
347
343
- private xcbuildProjectArgs ( projectRoot : string , projectData : IProjectData , product ?: "scheme" | "target" ) : string [ ] {
348
+ private xcbuildProjectArgs ( projectRoot : string , projectData : IProjectData , product ?: ProductArgs ) : string [ ] {
344
349
const xcworkspacePath = path . join ( projectRoot , projectData . projectName + ".xcworkspace" ) ;
345
350
if ( this . $fs . exists ( xcworkspacePath ) ) {
346
351
return [ "-workspace" , xcworkspacePath , product ? "-" + product : "-scheme" , projectData . projectName ] ;
@@ -414,6 +419,12 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
414
419
415
420
args = args . concat ( ( buildConfig && buildConfig . architectures ) || this . getBuildArchitectures ( projectData , buildConfig , [ "armv7" , "arm64" ] ) ) ;
416
421
422
+ if ( ! this . hasWatchApp ( projectData ) ) {
423
+ args = args . concat ( [
424
+ "-sdk" , DevicePlatformSdkName
425
+ ] ) ;
426
+ }
427
+
417
428
args = args . concat ( [
418
429
"BUILD_DIR=" + path . join ( projectRoot , constants . BUILD_DIR )
419
430
] ) ;
@@ -580,6 +591,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
580
591
581
592
private async buildForSimulator ( projectRoot : string , args : string [ ] , projectData : IProjectData , buildConfig ?: IBuildConfig ) : Promise < void > {
582
593
const architectures = this . getBuildArchitectures ( projectData , buildConfig , [ "i386" , "x86_64" ] ) ;
594
+ let product = ProductArgs . target ;
583
595
584
596
args = args
585
597
. concat ( architectures )
@@ -588,11 +600,16 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
588
600
"-configuration" , getConfigurationName ( buildConfig . release ) ,
589
601
"ONLY_ACTIVE_ARCH=NO" ,
590
602
"BUILD_DIR=" + path . join ( projectRoot , constants . BUILD_DIR ) ,
591
- "CODE_SIGNING_ALLOWED=NO" ,
592
- "-destination" ,
593
- "generic/platform=iOS Simulator"
594
- ] )
595
- . concat ( this . xcbuildProjectArgs ( projectRoot , projectData , "scheme" ) ) ;
603
+ ] ) ;
604
+
605
+ if ( this . hasWatchApp ( projectData ) ) {
606
+ product = ProductArgs . scheme ;
607
+ args = args . concat ( [ "-destination" , "generic/platform=iOS Simulator" , "CODE_SIGNING_ALLOWED=NO" ] ) ;
608
+ } else {
609
+ args = args . concat ( [ "-sdk" , SimulatorPlatformSdkName , "CODE_SIGN_IDENTITY=" ] ) ;
610
+ }
611
+
612
+ args = args . concat ( this . xcbuildProjectArgs ( projectRoot , projectData , product ) ) ;
596
613
597
614
await this . xcodebuild ( args , projectRoot , buildConfig . buildOutputStdio ) ;
598
615
}
@@ -790,7 +807,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
790
807
const resourcesDirectoryPath = projectData . getAppResourcesDirectoryPath ( ) ;
791
808
const pbxProjPath = this . getPbxProjPath ( projectData ) ;
792
809
const resourcesNativeCodePath = path . join (
793
- projectData . getAppResourcesDirectoryPath ( ) ,
810
+ resourcesDirectoryPath ,
794
811
platformData . normalizedPlatformName ,
795
812
constants . NATIVE_SOURCE_FOLDER
796
813
) ;
@@ -1398,6 +1415,17 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
1398
1415
"Enterprise" : "enterprise"
1399
1416
} [ provision . Type ] ;
1400
1417
}
1418
+
1419
+ private hasWatchApp ( projectData : IProjectData ) {
1420
+ const platformData = this . getPlatformData ( projectData ) ;
1421
+ const watchAppPath = path . join (
1422
+ projectData . getAppResourcesDirectoryPath ( ) ,
1423
+ platformData . normalizedPlatformName ,
1424
+ constants . IOS_WATCHAPP_FOLDER
1425
+ ) ;
1426
+
1427
+ return this . $fs . exists ( watchAppPath ) ;
1428
+ }
1401
1429
}
1402
1430
1403
1431
$injector . register ( "iOSProjectService" , IOSProjectService ) ;
0 commit comments