@@ -333,7 +333,7 @@ export class PlatformService extends EventEmitter implements IPlatformService {
333333
334334 const platformData = this . $platformsData . getPlatformData ( platform , projectData ) ;
335335 const forDevice = ! buildConfig || buildConfig . buildForDevice ;
336- outputPath = outputPath || ( forDevice ? platformData . deviceBuildOutputPath : platformData . emulatorBuildOutputPath || platformData . deviceBuildOutputPath ) ;
336+ outputPath = outputPath || ( forDevice ? platformData . getDeviceBuildOutputPath ( buildConfig ) : platformData . emulatorBuildOutputPath || platformData . getDeviceBuildOutputPath ( buildConfig ) ) ;
337337 if ( ! this . $fs . exists ( outputPath ) ) {
338338 return true ;
339339 }
@@ -433,15 +433,15 @@ export class PlatformService extends EventEmitter implements IPlatformService {
433433 this . $fs . writeJson ( buildInfoFile , buildInfo ) ;
434434 }
435435
436- public async shouldInstall ( device : Mobile . IDevice , projectData : IProjectData , outputPath ?: string ) : Promise < boolean > {
436+ public async shouldInstall ( device : Mobile . IDevice , projectData : IProjectData , release : IBuildConfig , outputPath ?: string ) : Promise < boolean > {
437437 const platform = device . deviceInfo . platform ;
438438 if ( ! ( await device . applicationManager . isApplicationInstalled ( projectData . projectId ) ) ) {
439439 return true ;
440440 }
441441
442442 const platformData = this . $platformsData . getPlatformData ( platform , projectData ) ;
443443 const deviceBuildInfo : IBuildInfo = await this . getDeviceBuildInfo ( device , projectData ) ;
444- const localBuildInfo = this . getBuildInfo ( platform , platformData , { buildForDevice : ! device . isEmulator } , outputPath ) ;
444+ const localBuildInfo = this . getBuildInfo ( platform , platformData , { buildForDevice : ! device . isEmulator , release : release . release } , outputPath ) ;
445445 return ! localBuildInfo || ! deviceBuildInfo || deviceBuildInfo . buildTime !== localBuildInfo . buildTime ;
446446 }
447447
@@ -469,7 +469,9 @@ export class PlatformService extends EventEmitter implements IPlatformService {
469469
470470 if ( ! buildConfig . release ) {
471471 const deviceFilePath = await this . getDeviceBuildInfoFilePath ( device , projectData ) ;
472- const buildInfoFilePath = outputFilePath || this . getBuildOutputPath ( device . deviceInfo . platform , platformData , { buildForDevice : ! device . isEmulator } ) ;
472+ const options = buildConfig ;
473+ options . buildForDevice = ! device . isEmulator ;
474+ const buildInfoFilePath = outputFilePath || this . getBuildOutputPath ( device . deviceInfo . platform , platformData , options ) ;
473475 const appIdentifier = projectData . projectId ;
474476
475477 await device . fileSystem . putFile ( path . join ( buildInfoFilePath , buildInfoFileName ) , deviceFilePath , appIdentifier ) ;
@@ -515,8 +517,8 @@ export class PlatformService extends EventEmitter implements IPlatformService {
515517 this . $logger . out ( "Skipping package build. No changes detected on the native side. This will be fast!" ) ;
516518 }
517519
518- if ( deployInfo . deployOptions . forceInstall || shouldBuild || ( await this . shouldInstall ( device , deployInfo . projectData ) ) ) {
519- await this . installApplication ( device , buildConfig , deployInfo . projectData , installPackageFile , deployInfo . outputPath ) ;
520+ if ( deployInfo . deployOptions . forceInstall || shouldBuild || ( await this . shouldInstall ( device , deployInfo . projectData , buildConfig ) ) ) {
521+ await this . installApplication ( device , buildConfig , deployInfo . projectData ) ;
520522 } else {
521523 this . $logger . out ( "Skipping install." ) ;
522524 }
@@ -550,12 +552,12 @@ export class PlatformService extends EventEmitter implements IPlatformService {
550552 await this . $devicesService . execute ( action , this . getCanExecuteAction ( platform , runOptions ) ) ;
551553 }
552554
553- private getBuildOutputPath ( platform : string , platformData : IPlatformData , options : IBuildForDevice ) : string {
555+ private getBuildOutputPath ( platform : string , platformData : IPlatformData , options : IShouldInstall ) : string {
554556 if ( platform . toLowerCase ( ) === this . $devicePlatformsConstants . iOS . toLowerCase ( ) ) {
555- return options . buildForDevice ? platformData . deviceBuildOutputPath : platformData . emulatorBuildOutputPath ;
557+ return options . buildForDevice ? platformData . getDeviceBuildOutputPath ( options ) : platformData . emulatorBuildOutputPath ;
556558 }
557559
558- return platformData . deviceBuildOutputPath ;
560+ return platformData . getDeviceBuildOutputPath ( options ) ;
559561 }
560562
561563 private async getDeviceBuildInfoFilePath ( device : Mobile . IDevice , projectData : IProjectData ) : Promise < string > {
@@ -575,7 +577,7 @@ export class PlatformService extends EventEmitter implements IPlatformService {
575577 }
576578 }
577579
578- private getBuildInfo ( platform : string , platformData : IPlatformData , options : IBuildForDevice , buildOutputPath ?: string ) : IBuildInfo {
580+ private getBuildInfo ( platform : string , platformData : IPlatformData , options : IShouldInstall , buildOutputPath ?: string ) : IBuildInfo {
579581 buildOutputPath = buildOutputPath || this . getBuildOutputPath ( platform , platformData , options ) ;
580582 const buildInfoFile = path . join ( buildOutputPath , buildInfoFileName ) ;
581583 if ( this . $fs . exists ( buildInfoFile ) ) {
@@ -765,11 +767,11 @@ export class PlatformService extends EventEmitter implements IPlatformService {
765767 }
766768
767769 public getLatestApplicationPackageForDevice ( platformData : IPlatformData , buildConfig : IBuildConfig , outputPath ?: string ) : IApplicationPackage {
768- return this . getLatestApplicationPackage ( outputPath || platformData . deviceBuildOutputPath , platformData . getValidPackageNames ( { isForDevice : true , isReleaseBuild : buildConfig . release } ) ) ;
770+ return this . getLatestApplicationPackage ( outputPath || platformData . getDeviceBuildOutputPath ( buildConfig ) , platformData . getValidPackageNames ( { isForDevice : true , isReleaseBuild : buildConfig . release } ) ) ;
769771 }
770772
771773 public getLatestApplicationPackageForEmulator ( platformData : IPlatformData , buildConfig : IBuildConfig , outputPath ?: string ) : IApplicationPackage {
772- return this . getLatestApplicationPackage ( outputPath || platformData . emulatorBuildOutputPath || platformData . deviceBuildOutputPath , platformData . getValidPackageNames ( { isForDevice : false , isReleaseBuild : buildConfig . release } ) ) ;
774+ return this . getLatestApplicationPackage ( outputPath || platformData . emulatorBuildOutputPath || platformData . getDeviceBuildOutputPath ( buildConfig ) , platformData . getValidPackageNames ( { isForDevice : false , isReleaseBuild : buildConfig . release } ) ) ;
773775 }
774776
775777 private async updatePlatform ( platform : string , version : string , platformTemplate : string , projectData : IProjectData , config : IPlatformOptions ) : Promise < void > {
0 commit comments