@@ -333,7 +333,7 @@ export class PlatformService extends EventEmitter implements IPlatformService {
333
333
334
334
const platformData = this . $platformsData . getPlatformData ( platform , projectData ) ;
335
335
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 ) ) ;
337
337
if ( ! this . $fs . exists ( outputPath ) ) {
338
338
return true ;
339
339
}
@@ -433,15 +433,15 @@ export class PlatformService extends EventEmitter implements IPlatformService {
433
433
this . $fs . writeJson ( buildInfoFile , buildInfo ) ;
434
434
}
435
435
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 > {
437
437
const platform = device . deviceInfo . platform ;
438
438
if ( ! ( await device . applicationManager . isApplicationInstalled ( projectData . projectId ) ) ) {
439
439
return true ;
440
440
}
441
441
442
442
const platformData = this . $platformsData . getPlatformData ( platform , projectData ) ;
443
443
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 ) ;
445
445
return ! localBuildInfo || ! deviceBuildInfo || deviceBuildInfo . buildTime !== localBuildInfo . buildTime ;
446
446
}
447
447
@@ -469,7 +469,9 @@ export class PlatformService extends EventEmitter implements IPlatformService {
469
469
470
470
if ( ! buildConfig . release ) {
471
471
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 ) ;
473
475
const appIdentifier = projectData . projectId ;
474
476
475
477
await device . fileSystem . putFile ( path . join ( buildInfoFilePath , buildInfoFileName ) , deviceFilePath , appIdentifier ) ;
@@ -515,8 +517,8 @@ export class PlatformService extends EventEmitter implements IPlatformService {
515
517
this . $logger . out ( "Skipping package build. No changes detected on the native side. This will be fast!" ) ;
516
518
}
517
519
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 ) ;
520
522
} else {
521
523
this . $logger . out ( "Skipping install." ) ;
522
524
}
@@ -550,12 +552,12 @@ export class PlatformService extends EventEmitter implements IPlatformService {
550
552
await this . $devicesService . execute ( action , this . getCanExecuteAction ( platform , runOptions ) ) ;
551
553
}
552
554
553
- private getBuildOutputPath ( platform : string , platformData : IPlatformData , options : IBuildForDevice ) : string {
555
+ private getBuildOutputPath ( platform : string , platformData : IPlatformData , options : IShouldInstall ) : string {
554
556
if ( platform . toLowerCase ( ) === this . $devicePlatformsConstants . iOS . toLowerCase ( ) ) {
555
- return options . buildForDevice ? platformData . deviceBuildOutputPath : platformData . emulatorBuildOutputPath ;
557
+ return options . buildForDevice ? platformData . getDeviceBuildOutputPath ( options ) : platformData . emulatorBuildOutputPath ;
556
558
}
557
559
558
- return platformData . deviceBuildOutputPath ;
560
+ return platformData . getDeviceBuildOutputPath ( options ) ;
559
561
}
560
562
561
563
private async getDeviceBuildInfoFilePath ( device : Mobile . IDevice , projectData : IProjectData ) : Promise < string > {
@@ -575,7 +577,7 @@ export class PlatformService extends EventEmitter implements IPlatformService {
575
577
}
576
578
}
577
579
578
- private getBuildInfo ( platform : string , platformData : IPlatformData , options : IBuildForDevice , buildOutputPath ?: string ) : IBuildInfo {
580
+ private getBuildInfo ( platform : string , platformData : IPlatformData , options : IShouldInstall , buildOutputPath ?: string ) : IBuildInfo {
579
581
buildOutputPath = buildOutputPath || this . getBuildOutputPath ( platform , platformData , options ) ;
580
582
const buildInfoFile = path . join ( buildOutputPath , buildInfoFileName ) ;
581
583
if ( this . $fs . exists ( buildInfoFile ) ) {
@@ -765,11 +767,11 @@ export class PlatformService extends EventEmitter implements IPlatformService {
765
767
}
766
768
767
769
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 } ) ) ;
769
771
}
770
772
771
773
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 } ) ) ;
773
775
}
774
776
775
777
private async updatePlatform ( platform : string , version : string , platformTemplate : string , projectData : IProjectData , config : IPlatformOptions ) : Promise < void > {
0 commit comments