@@ -4,11 +4,10 @@ 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 < any > = { } ;
7
+ private rebuiltInformation : IDictionary < { packageFilePath : string , platform : string , isEmulator : boolean } > = { } ;
8
8
9
9
constructor (
10
10
protected $analyticsService : IAnalyticsService ,
11
- private $buildDataService : IBuildDataService ,
12
11
private $buildController : IBuildController ,
13
12
private $debugController : IDebugController ,
14
13
private $deviceInstallAppService : IDeviceInstallAppService ,
@@ -191,7 +190,7 @@ export class RunController extends EventEmitter implements IRunController {
191
190
projectDir : projectData . projectDir ,
192
191
deviceIdentifier,
193
192
debugOptions : deviceDescriptor . debugOptions ,
194
- outputPath : deviceDescriptor . outputPath
193
+ outputPath : deviceDescriptor . buildData . outputPath
195
194
} ;
196
195
this . emit ( USER_INTERACTION_NEEDED_EVENT_NAME , attachDebuggerOptions ) ;
197
196
}
@@ -242,9 +241,16 @@ export class RunController extends EventEmitter implements IRunController {
242
241
const deviceAction = async ( device : Mobile . IDevice ) => {
243
242
const deviceDescriptor = _ . find ( deviceDescriptors , dd => dd . identifier === device . deviceInfo . identifier ) ;
244
243
const platformData = this . $platformsDataService . getPlatformData ( device . deviceInfo . platform , projectData ) ;
245
- const prepareData = this . $prepareDataService . getPrepareData ( liveSyncInfo . projectDir , device . deviceInfo . platform , { ...liveSyncInfo , watch : ! liveSyncInfo . skipWatcher , nativePrepare : { skipNativePrepare : ! ! deviceDescriptor . skipNativePrepare } } ) ;
246
- const buildData = this . $buildDataService . getBuildData ( projectData . projectDir , device . deviceInfo . platform , { ...liveSyncInfo , outputPath : deviceDescriptor . outputPath , buildForDevice : ! device . isEmulator } ) ;
244
+ const prepareData = this . $prepareDataService . getPrepareData ( liveSyncInfo . projectDir , device . deviceInfo . platform ,
245
+ {
246
+ ...liveSyncInfo ,
247
+ ...deviceDescriptor . buildData ,
248
+ nativePrepare : { skipNativePrepare : ! ! deviceDescriptor . skipNativePrepare } ,
249
+ watch : ! liveSyncInfo . skipWatcher ,
250
+ } ) ;
251
+
247
252
const prepareResultData = await this . $prepareController . prepare ( prepareData ) ;
253
+ const buildData = { ...deviceDescriptor . buildData , buildForDevice : ! device . isEmulator } ;
248
254
249
255
try {
250
256
let packageFilePath : string = null ;
@@ -312,14 +318,24 @@ export class RunController extends EventEmitter implements IRunController {
312
318
const deviceAction = async ( device : Mobile . IDevice ) => {
313
319
const deviceDescriptor = _ . find ( deviceDescriptors , dd => dd . identifier === device . deviceInfo . identifier ) ;
314
320
const platformData = this . $platformsDataService . getPlatformData ( data . platform , projectData ) ;
315
- const prepareData = this . $prepareDataService . getPrepareData ( projectData . projectDir , data . platform , { ...liveSyncInfo , watch : ! liveSyncInfo . skipWatcher } ) ;
321
+ const prepareData = this . $prepareDataService . getPrepareData ( liveSyncInfo . projectDir , device . deviceInfo . platform ,
322
+ {
323
+ ...liveSyncInfo ,
324
+ ...deviceDescriptor . buildData ,
325
+ nativePrepare : { skipNativePrepare : ! ! deviceDescriptor . skipNativePrepare } ,
326
+ watch : ! liveSyncInfo . skipWatcher ,
327
+ } ) ;
316
328
317
329
try {
318
- const rebuiltInfo = this . rebuiltInformation [ platformData . platformNameLowerCase ] && ( this . $mobileHelper . isAndroidPlatform ( platformData . platformNameLowerCase ) || this . rebuiltInformation [ platformData . platformNameLowerCase ] . isEmulator === device . isEmulator ) ;
319
- if ( data . hasNativeChanges && ! rebuiltInfo ) {
320
- await this . $prepareNativePlatformService . prepareNativePlatform ( platformData , projectData , prepareData ) ;
321
- await deviceDescriptor . buildAction ( ) ;
322
- this . rebuiltInformation [ platformData . platformNameLowerCase ] = { isEmulator : device . isEmulator , platform : platformData . platformNameLowerCase , packageFilePath : null } ;
330
+ if ( data . hasNativeChanges ) {
331
+ const rebuiltInfo = this . rebuiltInformation [ platformData . platformNameLowerCase ] && ( this . $mobileHelper . isAndroidPlatform ( platformData . platformNameLowerCase ) || this . rebuiltInformation [ platformData . platformNameLowerCase ] . isEmulator === device . isEmulator ) ;
332
+ if ( ! rebuiltInfo ) {
333
+ await this . $prepareNativePlatformService . prepareNativePlatform ( platformData , projectData , prepareData ) ;
334
+ await deviceDescriptor . buildAction ( ) ;
335
+ this . rebuiltInformation [ platformData . platformNameLowerCase ] = { isEmulator : device . isEmulator , platform : platformData . platformNameLowerCase , packageFilePath : null } ;
336
+ }
337
+
338
+ await this . $deviceInstallAppService . installOnDevice ( device , deviceDescriptor . buildData , this . rebuiltInformation [ platformData . platformNameLowerCase ] . packageFilePath ) ;
323
339
}
324
340
325
341
const isInHMRMode = liveSyncInfo . useHotModuleReload && data . hmrData && data . hmrData . hash ;
0 commit comments