@@ -373,7 +373,7 @@ export class PlatformService extends EventEmitter implements IPlatformService {
373373 return true ;
374374 }
375375
376- const validBuildOutputData = platformData . getValidBuildOutputData ( { isForDevice : forDevice } ) ;
376+ const validBuildOutputData = platformData . getValidBuildOutputData ( { isForDevice : forDevice , isReleaseBuild : buildConfig . release } ) ;
377377 const packages = this . getApplicationPackages ( outputPath , validBuildOutputData ) ;
378378 if ( packages . length === 0 ) {
379379 return true ;
@@ -449,7 +449,7 @@ export class PlatformService extends EventEmitter implements IPlatformService {
449449
450450 await attachAwaitDetach ( constants . BUILD_OUTPUT_EVENT_NAME , platformData . platformProjectService , handler , platformData . platformProjectService . buildProject ( platformData . projectRoot , projectData , buildConfig ) ) ;
451451
452- const buildInfoFilePath = this . getBuildOutputPath ( platform , platformData , buildConfig ) ;
452+ const buildInfoFilePath = this . getBuildOutputPath ( platform , platformData , { isForDevice : buildConfig . buildForDevice , isReleaseBuild : buildConfig . release , androidBundle : buildConfig . androidBundle } ) ;
453453 this . saveBuildInfoFile ( platform , projectData . projectDir , buildInfoFilePath ) ;
454454
455455 this . $logger . out ( "Project successfully built." ) ;
@@ -468,15 +468,15 @@ export class PlatformService extends EventEmitter implements IPlatformService {
468468 this . $fs . writeJson ( buildInfoFile , buildInfo ) ;
469469 }
470470
471- public async shouldInstall ( device : Mobile . IDevice , projectData : IProjectData , release : IBuildConfig , outputPath ?: string ) : Promise < boolean > {
471+ public async shouldInstall ( device : Mobile . IDevice , projectData : IProjectData , release : IRelease , outputPath ?: string ) : Promise < boolean > {
472472 const platform = device . deviceInfo . platform ;
473473 if ( ! ( await device . applicationManager . isApplicationInstalled ( projectData . projectIdentifiers [ platform . toLowerCase ( ) ] ) ) ) {
474474 return true ;
475475 }
476476
477477 const platformData = this . $platformsData . getPlatformData ( platform , projectData ) ;
478478 const deviceBuildInfo : IBuildInfo = await this . getDeviceBuildInfo ( device , projectData ) ;
479- const localBuildInfo = this . getBuildInfo ( platform , platformData , { buildForDevice : ! device . isEmulator } , outputPath ) ;
479+ const localBuildInfo = this . getBuildInfo ( platform , platformData , { isForDevice : ! device . isEmulator , isReleaseBuild : release . release } , outputPath ) ;
480480 return ! localBuildInfo || ! deviceBuildInfo || deviceBuildInfo . buildTime !== localBuildInfo . buildTime ;
481481 }
482482
@@ -514,7 +514,7 @@ export class PlatformService extends EventEmitter implements IPlatformService {
514514 const deviceFilePath = await this . getDeviceBuildInfoFilePath ( device , projectData ) ;
515515 const options = buildConfig ;
516516 options . buildForDevice = ! device . isEmulator ;
517- const buildInfoFilePath = outputFilePath || this . getBuildOutputPath ( device . deviceInfo . platform , platformData , options ) ;
517+ const buildInfoFilePath = outputFilePath || this . getBuildOutputPath ( device . deviceInfo . platform , platformData , { isForDevice : buildConfig . buildForDevice , isReleaseBuild : buildConfig . release , androidBundle : buildConfig . androidBundle } ) ;
518518 const appIdentifier = projectData . projectIdentifiers [ platform ] ;
519519
520520 await device . fileSystem . putFile ( path . join ( buildInfoFilePath , buildInfoFileName ) , deviceFilePath , appIdentifier ) ;
@@ -611,9 +611,13 @@ export class PlatformService extends EventEmitter implements IPlatformService {
611611 await this . $devicesService . execute ( action , this . getCanExecuteAction ( platform , runOptions ) ) ;
612612 }
613613
614- private getBuildOutputPath ( platform : string , platformData : IPlatformData , options : IBuildForDevice ) : string {
614+ private getBuildOutputPath ( platform : string , platformData : IPlatformData , options : IBuildOutputOptions ) : string {
615+ if ( options . androidBundle ) {
616+ return platformData . bundleBuildOutputPath ;
617+ }
618+
615619 if ( platform . toLowerCase ( ) === this . $devicePlatformsConstants . iOS . toLowerCase ( ) ) {
616- return options . buildForDevice ? platformData . deviceBuildOutputPath : platformData . emulatorBuildOutputPath ;
620+ return options . isForDevice ? platformData . deviceBuildOutputPath : platformData . emulatorBuildOutputPath ;
617621 }
618622
619623 return platformData . deviceBuildOutputPath ;
@@ -637,7 +641,7 @@ export class PlatformService extends EventEmitter implements IPlatformService {
637641 }
638642 }
639643
640- private getBuildInfo ( platform : string , platformData : IPlatformData , options : IBuildForDevice , buildOutputPath ?: string ) : IBuildInfo {
644+ private getBuildInfo ( platform : string , platformData : IPlatformData , options : IBuildOutputOptions , buildOutputPath ?: string ) : IBuildInfo {
641645 buildOutputPath = buildOutputPath || this . getBuildOutputPath ( platform , platformData , options ) ;
642646 const buildInfoFile = path . join ( buildOutputPath , buildInfoFileName ) ;
643647 if ( this . $fs . exists ( buildInfoFile ) ) {
@@ -899,11 +903,13 @@ export class PlatformService extends EventEmitter implements IPlatformService {
899903 }
900904
901905 public getLatestApplicationPackageForDevice ( platformData : IPlatformData , buildConfig : IBuildConfig , outputPath ?: string ) : IApplicationPackage {
902- return this . getLatestApplicationPackage ( outputPath || platformData . deviceBuildOutputPath , platformData . getValidBuildOutputData ( { isForDevice : true , isReleaseBuild : buildConfig . release } ) ) ;
906+ return this . getLatestApplicationPackage ( outputPath || platformData . deviceBuildOutputPath , platformData . getValidBuildOutputData ( { isForDevice : true , isReleaseBuild : buildConfig . release , androidBundle : buildConfig . androidBundle } ) ) ;
903907 }
904908
905909 public getLatestApplicationPackageForEmulator ( platformData : IPlatformData , buildConfig : IBuildConfig , outputPath ?: string ) : IApplicationPackage {
906- return this . getLatestApplicationPackage ( outputPath || platformData . emulatorBuildOutputPath || platformData . deviceBuildOutputPath , platformData . getValidBuildOutputData ( { isForDevice : false , isReleaseBuild : buildConfig . release } ) ) ;
910+ const buildOutputOptions : IBuildOutputOptions = { isForDevice : false , isReleaseBuild : buildConfig . release , androidBundle : buildConfig . androidBundle } ;
911+ outputPath = outputPath || this . getBuildOutputPath ( platformData . normalizedPlatformName . toLowerCase ( ) , platformData , buildOutputOptions ) ;
912+ return this . getLatestApplicationPackage ( outputPath || platformData . emulatorBuildOutputPath || platformData . deviceBuildOutputPath , platformData . getValidBuildOutputData ( buildOutputOptions ) ) ;
907913 }
908914
909915 private async updatePlatform ( platform : string , version : string , platformTemplate : string , projectData : IProjectData , config : IPlatformOptions ) : Promise < void > {
0 commit comments