@@ -4,8 +4,6 @@ import { cache, performanceLog } from "../common/decorators";
4
4
import { EventEmitter } from "events" ;
5
5
6
6
export class RunController extends EventEmitter implements IRunController {
7
- private rebuiltInformation : IDictionary < { packageFilePath : string , platform : string , isEmulator : boolean } > = { } ;
8
-
9
7
constructor (
10
8
protected $analyticsService : IAnalyticsService ,
11
9
private $buildController : IBuildController ,
@@ -246,7 +244,7 @@ export class RunController extends EventEmitter implements IRunController {
246
244
}
247
245
248
246
private async syncInitialDataOnDevices ( projectData : IProjectData , liveSyncInfo : ILiveSyncInfo , deviceDescriptors : ILiveSyncDeviceDescriptor [ ] ) : Promise < void > {
249
- this . rebuiltInformation = { } ;
247
+ const rebuiltInformation : IDictionary < { packageFilePath : string , platform : string , isEmulator : boolean } > = { } ;
250
248
251
249
const deviceAction = async ( device : Mobile . IDevice ) => {
252
250
const deviceDescriptor = _ . find ( deviceDescriptors , dd => dd . identifier === device . deviceInfo . identifier ) ;
@@ -267,14 +265,14 @@ export class RunController extends EventEmitter implements IRunController {
267
265
268
266
// Case where we have three devices attached, a change that requires build is found,
269
267
// we'll rebuild the app only for the first device, but we should install new package on all three devices.
270
- if ( this . rebuiltInformation [ platformData . platformNameLowerCase ] && ( this . $mobileHelper . isAndroidPlatform ( platformData . platformNameLowerCase ) || this . rebuiltInformation [ platformData . platformNameLowerCase ] . isEmulator === device . isEmulator ) ) {
271
- packageFilePath = this . rebuiltInformation [ platformData . platformNameLowerCase ] . packageFilePath ;
268
+ if ( rebuiltInformation [ platformData . platformNameLowerCase ] && ( this . $mobileHelper . isAndroidPlatform ( platformData . platformNameLowerCase ) || rebuiltInformation [ platformData . platformNameLowerCase ] . isEmulator === device . isEmulator ) ) {
269
+ packageFilePath = rebuiltInformation [ platformData . platformNameLowerCase ] . packageFilePath ;
272
270
await this . $deviceInstallAppService . installOnDevice ( device , buildData , packageFilePath ) ;
273
271
} else {
274
272
const shouldBuild = prepareResultData . hasNativeChanges || await this . $buildController . shouldBuild ( buildData ) ;
275
273
if ( shouldBuild ) {
276
274
packageFilePath = await deviceDescriptor . buildAction ( ) ;
277
- this . rebuiltInformation [ platformData . platformNameLowerCase ] = { isEmulator : device . isEmulator , platform : platformData . platformNameLowerCase , packageFilePath } ;
275
+ rebuiltInformation [ platformData . platformNameLowerCase ] = { isEmulator : device . isEmulator , platform : platformData . platformNameLowerCase , packageFilePath } ;
278
276
} else {
279
277
await this . $analyticsService . trackEventActionInGoogleAnalytics ( {
280
278
action : TrackActionNames . LiveSync ,
@@ -315,7 +313,7 @@ export class RunController extends EventEmitter implements IRunController {
315
313
}
316
314
317
315
private async syncChangedDataOnDevices ( data : IFilesChangeEventData , projectData : IProjectData , liveSyncInfo : ILiveSyncInfo , deviceDescriptors : ILiveSyncDeviceDescriptor [ ] ) : Promise < void > {
318
- this . rebuiltInformation = { } ;
316
+ const rebuiltInformation : IDictionary < { packageFilePath : string , platform : string , isEmulator : boolean } > = { } ;
319
317
320
318
const deviceAction = async ( device : Mobile . IDevice ) => {
321
319
const deviceDescriptor = _ . find ( deviceDescriptors , dd => dd . identifier === device . deviceInfo . identifier ) ;
@@ -343,14 +341,14 @@ export class RunController extends EventEmitter implements IRunController {
343
341
const deviceAppData = await platformLiveSyncService . getAppData ( _ . merge ( { device, watch : true } , watchInfo ) ) ;
344
342
345
343
if ( data . hasNativeChanges ) {
346
- const rebuiltInfo = this . rebuiltInformation [ platformData . platformNameLowerCase ] && ( this . $mobileHelper . isAndroidPlatform ( platformData . platformNameLowerCase ) || this . rebuiltInformation [ platformData . platformNameLowerCase ] . isEmulator === device . isEmulator ) ;
344
+ const rebuiltInfo = rebuiltInformation [ platformData . platformNameLowerCase ] && ( this . $mobileHelper . isAndroidPlatform ( platformData . platformNameLowerCase ) || rebuiltInformation [ platformData . platformNameLowerCase ] . isEmulator === device . isEmulator ) ;
347
345
if ( ! rebuiltInfo ) {
348
346
await this . $prepareNativePlatformService . prepareNativePlatform ( platformData , projectData , prepareData ) ;
349
347
await deviceDescriptor . buildAction ( ) ;
350
- this . rebuiltInformation [ platformData . platformNameLowerCase ] = { isEmulator : device . isEmulator , platform : platformData . platformNameLowerCase , packageFilePath : null } ;
348
+ rebuiltInformation [ platformData . platformNameLowerCase ] = { isEmulator : device . isEmulator , platform : platformData . platformNameLowerCase , packageFilePath : null } ;
351
349
}
352
350
353
- await this . $deviceInstallAppService . installOnDevice ( device , deviceDescriptor . buildData , this . rebuiltInformation [ platformData . platformNameLowerCase ] . packageFilePath ) ;
351
+ await this . $deviceInstallAppService . installOnDevice ( device , deviceDescriptor . buildData , rebuiltInformation [ platformData . platformNameLowerCase ] . packageFilePath ) ;
354
352
await platformLiveSyncService . syncAfterInstall ( device , watchInfo ) ;
355
353
await platformLiveSyncService . restartApplication ( projectData , { deviceAppData, modifiedFilesData : [ ] , isFullSync : false , useHotModuleReload : liveSyncInfo . useHotModuleReload } ) ;
356
354
} else {
0 commit comments