@@ -35,7 +35,9 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
3535 $projectDataService : IProjectDataService ,
3636 private $prompter : IPrompter ,
3737 private $config : IConfiguration ,
38- private $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ) {
38+ private $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
39+ private $devicesService : Mobile . IDevicesService ,
40+ private $mobileHelper : Mobile . IMobileHelper ) {
3941 super ( $fs , $projectData , $projectDataService ) ;
4042 }
4143
@@ -177,12 +179,17 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
177179 let args : string [ ] = [ ] ;
178180 let buildForDevice = this . $options . forDevice || ( buildConfig && buildConfig . buildForDevice ) ;
179181 if ( buildForDevice ) {
182+ let defaultArchitectures = [
183+ 'ARCHS=armv7 arm64' ,
184+ 'VALID_ARCHS=armv7 arm64'
185+ ] ;
186+
180187 args = basicArgs . concat ( [
181188 "-sdk" , "iphoneos" ,
182- 'ARCHS=armv7 arm64' ,
183- 'VALID_ARCHS=armv7 arm64' ,
184189 "CONFIGURATION_BUILD_DIR=" + path . join ( projectRoot , "build" , "device" )
185190 ] ) ;
191+
192+ args = args . concat ( ( buildConfig && buildConfig . architectures ) || defaultArchitectures ) ;
186193 } else {
187194 args = basicArgs . concat ( [
188195 "-sdk" , "iphonesimulator" ,
@@ -210,6 +217,29 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
210217 } ) . future < void > ( ) ( ) ;
211218 }
212219
220+ public buildForDeploy ( platform : string ) : IFuture < void > {
221+ if ( this . $options . release ) {
222+ return this . buildProject ( this . platformData . projectRoot ) ;
223+ }
224+
225+ let devicesArchitectures = _ ( this . $devicesService . getDeviceInstances ( ) )
226+ . filter ( d => this . $mobileHelper . isiOSPlatform ( d . deviceInfo . platform ) )
227+ . map ( d => d . deviceInfo . activeArchitecture )
228+ . uniq ( )
229+ . value ( ) ;
230+
231+ let architectures = [
232+ `ARCHS=${ devicesArchitectures . join ( " " ) } ` ,
233+ `VALID_ARCHS=${ devicesArchitectures . join ( " " ) } `
234+ ] ;
235+
236+ if ( devicesArchitectures . length > 1 ) {
237+ architectures . push ( 'ONLY_ACTIVE_ARCH=NO' ) ;
238+ }
239+
240+ return this . buildProject ( this . platformData . projectRoot , { architectures : architectures } ) ;
241+ }
242+
213243 public isPlatformPrepared ( projectRoot : string ) : IFuture < boolean > {
214244 return this . $fs . exists ( path . join ( projectRoot , this . $projectData . projectName , constants . APP_FOLDER_NAME ) ) ;
215245 }
0 commit comments