@@ -384,12 +384,6 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
384384 }
385385
386386 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
393387 if ( ! buildConfig . release && ! buildConfig . architectures ) {
394388 await this . $devicesService . initialize ( {
395389 platform : this . $devicePlatformsConstants . iOS . toLowerCase ( ) , deviceId : buildConfig . device ,
@@ -402,18 +396,15 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
402396 . uniq ( )
403397 . value ( ) ;
404398 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 ) ;
409400 if ( devicesArchitectures . length > 1 ) {
410401 architectures . push ( 'ONLY_ACTIVE_ARCH=NO' ) ;
411402 }
412403 buildConfig . architectures = architectures ;
413404 }
414405 }
415406
416- args = args . concat ( ( buildConfig && buildConfig . architectures ) || defaultArchitectures ) ;
407+ args = args . concat ( ( buildConfig && buildConfig . architectures ) || this . getBuildArchitectures ( projectData , buildConfig , [ "armv7" , "arm64" ] ) ) ;
417408
418409 args = args . concat ( [
419410 "-sdk" , "iphoneos" ,
@@ -457,6 +448,28 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
457448 return commandResult ;
458449 }
459450
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+
460473 private async setupSigningFromTeam ( projectRoot : string , projectData : IProjectData , teamId : string ) {
461474 const xcode = this . $pbxprojDomXcode . Xcode . open ( this . getPbxProjPath ( projectData ) ) ;
462475 const signing = xcode . getSigning ( projectData . projectName ) ;
@@ -555,13 +568,14 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
555568 }
556569
557570 private async buildForSimulator ( projectRoot : string , args : string [ ] , projectData : IProjectData , buildConfig ?: IBuildConfig ) : Promise < void > {
571+ const architectures = this . getBuildArchitectures ( projectData , buildConfig , [ "i386" , "x86_64" ] ) ;
572+
558573 args = args
574+ . concat ( architectures )
559575 . concat ( [
560576 "build" ,
561577 "-configuration" , buildConfig . release ? "Release" : "Debug" ,
562578 "-sdk" , "iphonesimulator" ,
563- "ARCHS=i386 x86_64" ,
564- "VALID_ARCHS=i386 x86_64" ,
565579 "ONLY_ACTIVE_ARCH=NO" ,
566580 "CONFIGURATION_BUILD_DIR=" + path . join ( projectRoot , "build" , "emulator" ) ,
567581 "CODE_SIGN_IDENTITY=" ,
@@ -1031,6 +1045,15 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
10311045 return [ ] ;
10321046 }
10331047
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+
10341057 private getAllLibsForPluginWithFileExtension ( pluginData : IPluginData , fileExtension : string ) : string [ ] {
10351058 const filterCallback = ( fileName : string , pluginPlatformsFolderPath : string ) => path . extname ( fileName ) === fileExtension ;
10361059 return this . getAllNativeLibrariesForPlugin ( pluginData , IOSProjectService . IOS_PLATFORM_NAME , filterCallback ) ;
0 commit comments