@@ -384,12 +384,6 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
384
384
}
385
385
386
386
private async buildForDevice ( projectRoot : string , args : string [ ] , buildConfig : IBuildConfig , projectData : IProjectData ) : Promise < void > {
387
- const defaultArchitectures = [
388
- 'ARCHS=armv7 arm64' ,
389
- 'VALID_ARCHS=armv7 arm64'
390
- ] ;
391
-
392
- // build only for device specific architecture
393
387
if ( ! buildConfig . release && ! buildConfig . architectures ) {
394
388
await this . $devicesService . initialize ( {
395
389
platform : this . $devicePlatformsConstants . iOS . toLowerCase ( ) , deviceId : buildConfig . device ,
@@ -402,18 +396,15 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
402
396
. uniq ( )
403
397
. value ( ) ;
404
398
if ( devicesArchitectures . length > 0 ) {
405
- const architectures = [
406
- `ARCHS=${ devicesArchitectures . join ( " " ) } ` ,
407
- `VALID_ARCHS=${ devicesArchitectures . join ( " " ) } `
408
- ] ;
399
+ const architectures = this . getBuildArchitectures ( projectData , buildConfig , devicesArchitectures ) ;
409
400
if ( devicesArchitectures . length > 1 ) {
410
401
architectures . push ( 'ONLY_ACTIVE_ARCH=NO' ) ;
411
402
}
412
403
buildConfig . architectures = architectures ;
413
404
}
414
405
}
415
406
416
- args = args . concat ( ( buildConfig && buildConfig . architectures ) || defaultArchitectures ) ;
407
+ args = args . concat ( ( buildConfig && buildConfig . architectures ) || this . getBuildArchitectures ( projectData , buildConfig , [ "armv7" , "arm64" ] ) ) ;
417
408
418
409
args = args . concat ( [
419
410
"-sdk" , "iphoneos" ,
@@ -457,6 +448,28 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
457
448
return commandResult ;
458
449
}
459
450
451
+ private getBuildArchitectures ( projectData : IProjectData , buildConfig : IBuildConfig , architectures : string [ ] ) : string [ ] {
452
+ let result : string [ ] = [ ] ;
453
+
454
+ const frameworkVersion = this . getFrameworkVersion ( projectData ) ;
455
+ if ( semver . valid ( frameworkVersion ) && semver . lt ( semver . coerce ( frameworkVersion ) , "5.1.0" ) ) {
456
+ const target = this . getDeploymentTarget ( projectData ) ;
457
+ if ( target && target . major >= 11 ) {
458
+ // We need to strip 32bit architectures as of deployment target >= 11 it is not allowed to have such
459
+ architectures = _ . filter ( architectures , arch => {
460
+ const is64BitArchitecture = arch === "x86_64" || arch === "arm64" ;
461
+ if ( ! is64BitArchitecture ) {
462
+ this . $logger . warn ( `The architecture ${ arch } will be stripped as it is not supported for deployment target ${ target . version } .` ) ;
463
+ }
464
+ return is64BitArchitecture ;
465
+ } ) ;
466
+ }
467
+ result = [ `ARCHS=${ architectures . join ( " " ) } ` , `VALID_ARCHS=${ architectures . join ( " " ) } ` ] ;
468
+ }
469
+
470
+ return result ;
471
+ }
472
+
460
473
private async setupSigningFromTeam ( projectRoot : string , projectData : IProjectData , teamId : string ) {
461
474
const xcode = this . $pbxprojDomXcode . Xcode . open ( this . getPbxProjPath ( projectData ) ) ;
462
475
const signing = xcode . getSigning ( projectData . projectName ) ;
@@ -555,13 +568,14 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
555
568
}
556
569
557
570
private async buildForSimulator ( projectRoot : string , args : string [ ] , projectData : IProjectData , buildConfig ?: IBuildConfig ) : Promise < void > {
571
+ const architectures = this . getBuildArchitectures ( projectData , buildConfig , [ "i386" , "x86_64" ] ) ;
572
+
558
573
args = args
574
+ . concat ( architectures )
559
575
. concat ( [
560
576
"build" ,
561
577
"-configuration" , buildConfig . release ? "Release" : "Debug" ,
562
578
"-sdk" , "iphonesimulator" ,
563
- "ARCHS=i386 x86_64" ,
564
- "VALID_ARCHS=i386 x86_64" ,
565
579
"ONLY_ACTIVE_ARCH=NO" ,
566
580
"CONFIGURATION_BUILD_DIR=" + path . join ( projectRoot , "build" , "emulator" ) ,
567
581
"CODE_SIGN_IDENTITY=" ,
@@ -1031,6 +1045,15 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
1031
1045
return [ ] ;
1032
1046
}
1033
1047
1048
+ public getDeploymentTarget ( projectData : IProjectData ) : semver . SemVer {
1049
+ const target = this . $xCConfigService . readPropertyValue ( this . getBuildXCConfigFilePath ( projectData ) , "IPHONEOS_DEPLOYMENT_TARGET" ) ;
1050
+ if ( ! target ) {
1051
+ return null ;
1052
+ }
1053
+
1054
+ return semver . coerce ( target ) ;
1055
+ }
1056
+
1034
1057
private getAllLibsForPluginWithFileExtension ( pluginData : IPluginData , fileExtension : string ) : string [ ] {
1035
1058
const filterCallback = ( fileName : string , pluginPlatformsFolderPath : string ) => path . extname ( fileName ) === fileExtension ;
1036
1059
return this . getAllNativeLibrariesForPlugin ( pluginData , IOSProjectService . IOS_PLATFORM_NAME , filterCallback ) ;
0 commit comments