@@ -215,8 +215,9 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
215215 * Returns the path to the .xcarchive.
216216 */
217217 public async archive ( projectData : IProjectData , buildConfig ?: IBuildConfig , options ?: { archivePath ?: string , additionalArgs ?: string [ ] } ) : Promise < string > {
218+ const platformData = this . getPlatformData ( projectData ) ;
218219 const projectRoot = this . getPlatformData ( projectData ) . projectRoot ;
219- const archivePath = options && options . archivePath ? path . resolve ( options . archivePath ) : path . join ( projectRoot , "/build/archive/" , projectData . projectName + ".xcarchive" ) ;
220+ const archivePath = options && options . archivePath ? path . resolve ( options . archivePath ) : path . join ( platformData . getBuildOutputPath ( buildConfig ) , projectData . projectName + ".xcarchive" ) ;
220221 let args = [ "archive" , "-archivePath" , archivePath , "-configuration" ,
221222 getConfigurationName ( ! buildConfig || buildConfig . release ) ]
222223 . concat ( this . xcbuildProjectArgs ( projectRoot , projectData , "scheme" ) ) ;
@@ -287,12 +288,11 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
287288 /**
288289 * Exports .xcarchive for a development device.
289290 */
290- private async exportDevelopmentArchive ( projectData : IProjectData , buildConfig : IBuildConfig , options : { archivePath : string , exportDir ?: string , teamID ?: string , provision ?: string } ) : Promise < string > {
291+ private async exportDevelopmentArchive ( projectData : IProjectData , buildConfig : IBuildConfig , options : { archivePath : string , provision ?: string } ) : Promise < string > {
291292 const platformData = this . getPlatformData ( projectData ) ;
292293 const projectRoot = platformData . projectRoot ;
293294 const archivePath = options . archivePath ;
294- const buildOutputPath = path . join ( projectRoot , constants . BUILD_DIR ) ;
295- const exportOptionsMethod = await this . getExportOptionsMethod ( projectData ) ;
295+ const exportOptionsMethod = await this . getExportOptionsMethod ( projectData , archivePath ) ;
296296 let plistTemplate = `<?xml version="1.0" encoding="UTF-8"?>
297297<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
298298<plist version="1.0">
@@ -320,7 +320,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
320320 this . $fs . writeFile ( exportOptionsPlist , plistTemplate ) ;
321321
322322 // The xcodebuild exportPath expects directory and writes the <project-name>.ipa at that directory.
323- const exportPath = path . resolve ( options . exportDir || buildOutputPath ) ;
323+ const exportPath = path . resolve ( path . dirname ( archivePath ) ) ;
324324 const exportFile = path . join ( exportPath , projectData . projectName + ".ipa" ) ;
325325
326326 await this . xcodebuild (
@@ -1399,8 +1399,8 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
13991399 }
14001400 }
14011401
1402- private getExportOptionsMethod ( projectData : IProjectData ) : string {
1403- const embeddedMobileProvisionPath = path . join ( this . getPlatformData ( projectData ) . projectRoot , constants . BUILD_DIR , "archive" , ` ${ projectData . projectName } .xcarchive` , 'Products' , 'Applications' , `${ projectData . projectName } .app` , "embedded.mobileprovision" ) ;
1402+ private getExportOptionsMethod ( projectData : IProjectData , archivePath : string ) : string {
1403+ const embeddedMobileProvisionPath = path . join ( archivePath , 'Products' , 'Applications' , `${ projectData . projectName } .app` , "embedded.mobileprovision" ) ;
14041404 const provision = mobileprovision . provision . readFromFile ( embeddedMobileProvisionPath ) ;
14051405
14061406 return {
0 commit comments