@@ -423,22 +423,37 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
423
423
} ) . future < void > ( ) ( ) ;
424
424
}
425
425
426
- private createIpa ( projectRoot : string ) : IFuture < void > {
426
+ /**
427
+ * Exports .xcarchive for a development device.
428
+ */
429
+ private exportDevelopmentArchive ( projectData : IProjectData , options : { archivePath : string , exportDir ?: string , teamID ?: string } ) : IFuture < string > {
427
430
return ( ( ) => {
431
+ let projectRoot = this . platformData . projectRoot ;
432
+ let archivePath = options . archivePath ;
428
433
let buildOutputPath = path . join ( projectRoot , "build" , "device" ) ;
429
- let xcrunArgs = [
430
- "-sdk" , "iphoneos" ,
431
- "PackageApplication" ,
432
- path . join ( buildOutputPath , this . $projectData . projectName + ".app" ) ,
433
- "-o" , path . join ( buildOutputPath , this . $projectData . projectName + ".ipa" )
434
+
435
+ // The xcodebuild exportPath expects directory and writes the <project-name>.ipa at that directory.
436
+ let exportPath = path . resolve ( options . exportDir || buildOutputPath ) ;
437
+ let exportFile = path . join ( exportPath , projectData . projectName + ".ipa" ) ;
438
+
439
+ let args = [ "-exportArchive" ,
440
+ "-archivePath" , archivePath ,
441
+ "-exportPath" , exportPath ,
442
+ "-exportOptionsPlist" , this . platformData . configurationFilePath
434
443
] ;
435
- // if (this.$logger.getLevel() !== "INFO") {
436
- xcrunArgs . push ( "-verbose" ) ;
437
- // }
438
- // this.$logger.out("Packaging project...");
439
- this . $childProcess . spawnFromEvent ( "xcrun" , xcrunArgs , "exit" , { cwd : this . $options , stdio : 'inherit' } ) . wait ( ) ;
440
- // this.$logger.out("Project package succeeded.");
441
- } ) . future < void > ( ) ( ) ;
444
+
445
+ this . $childProcess . spawnFromEvent ( "xcodebuild" , args , "exit" , { stdio : 'inherit' , cwd : this . $options } ) . wait ( ) ;
446
+
447
+ return exportFile ;
448
+ } ) . future < string > ( ) ( ) ;
449
+ }
450
+
451
+ private createIpa ( projectRoot : string ) : IFuture < string > {
452
+ return ( ( ) => {
453
+ let xArchivePath = this . archive ( ) . wait ( ) ;
454
+ let exportFileIpa = this . exportDevelopmentArchive ( this . $projectData , { archivePath : xArchivePath } ) . wait ( ) ;
455
+ return exportFileIpa ;
456
+ } ) . future < string > ( ) ( ) ;
442
457
}
443
458
444
459
public isPlatformPrepared ( projectRoot : string ) : boolean {
0 commit comments