@@ -436,31 +436,44 @@ export class PlatformService implements IPlatformService {
436436 let platformData = this . $platformsData . getPlatformData ( platform ) ;
437437
438438 this . $devicesService . initialize ( { platform : platform , deviceId : this . $options . device } ) . wait ( ) ;
439- let packageFile : string = null ;
439+ let packageFileDict : IStringDictionary = { } ;
440440
441441 let action = ( device : Mobile . IDevice ) : IFuture < void > => {
442442 return ( ( ) => {
443+
444+ let packageFileKey = this . getPackageFileKey ( device ) ;
445+ let packageFile = packageFileDict [ packageFileKey ] ;
443446 if ( ! packageFile ) {
444447 if ( this . $devicesService . isiOSSimulator ( device ) ) {
445448 this . prepareAndExecute ( platform , ( ) => this . buildForDeploy ( platform , buildConfig ) ) . wait ( ) ;
446449 packageFile = this . getLatestApplicationPackageForEmulator ( platformData ) . wait ( ) . packageName ;
447450 } else {
448- buildConfig = buildConfig || { } ;
449- buildConfig . buildForDevice = true ;
450- this . prepareAndExecute ( platform , ( ) => this . buildForDeploy ( platform , buildConfig ) ) . wait ( ) ;
451+ let deviceBuildConfig = buildConfig || { } ;
452+ deviceBuildConfig . buildForDevice = true ;
453+ this . prepareAndExecute ( platform , ( ) => this . buildForDeploy ( platform , deviceBuildConfig ) ) . wait ( ) ;
451454 packageFile = this . getLatestApplicationPackageForDevice ( platformData ) . wait ( ) . packageName ;
452455 }
453456 }
454457
455458 platformData . platformProjectService . deploy ( device . deviceInfo . identifier ) . wait ( ) ;
456459 device . applicationManager . reinstallApplication ( this . $projectData . projectId , packageFile ) . wait ( ) ;
457460 this . $logger . info ( `Successfully deployed on device with identifier '${ device . deviceInfo . identifier } '.` ) ;
461+
462+ packageFileDict [ packageFileKey ] = packageFile ;
463+
458464 } ) . future < void > ( ) ( ) ;
459465 } ;
460466 this . $devicesService . execute ( action , this . getCanExecuteAction ( platform ) ) . wait ( ) ;
461467 } ) . future < void > ( ) ( ) ;
462468 }
463469
470+ private getPackageFileKey ( device : Mobile . IDevice ) : string {
471+ if ( this . $mobileHelper . isAndroidPlatform ( device . deviceInfo . platform ) ) {
472+ return device . deviceInfo . platform . toLowerCase ( ) ;
473+ }
474+ return device . deviceInfo . platform . toLowerCase ( ) + device . deviceInfo . type ;
475+ }
476+
464477 public deployOnDevice ( platform : string , buildConfig ?: IBuildConfig ) : IFuture < void > {
465478 return ( ( ) => {
466479 this . installOnDevice ( platform , buildConfig ) . wait ( ) ;
0 commit comments