Skip to content

Commit 0388273

Browse files
authored
move device discovery to debug command as it is done for run command (NativeScript#3008)
* move device discovery to debug command as it is done for run command * update after review
1 parent 2d02102 commit 0388273

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

lib/commands/debug.ts

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ export class DebugPlatformCommand implements ICommand {
3737

3838
const selectedDeviceForDebug = await this.getDeviceForDebug();
3939

40+
await this.$devicesService.detectCurrentlyAttachedDevices({ shouldReturnImmediateResult: false, platform: this.platform });
41+
4042
await this.$liveSyncCommandHelper.executeLiveSyncOperation([selectedDeviceForDebug], this.$debugLiveSyncService, this.platform);
4143
}
4244

lib/definitions/livesync.d.ts

+7
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,13 @@ interface IDevicePathProvider {
267267
}
268268

269269
interface ILiveSyncCommandHelper {
270+
/**
271+
* Method sets up configuration, before calling livesync and expects that devices are already discovered.
272+
* @param {Mobile.IDevice[]} devices List of discovered devices
273+
* @param {ILiveSyncService} liveSyncService Service expected to do the actual livesyncing
274+
* @param {string} platform The platform for which the livesync will be ran
275+
* @returns {Promise<void>}
276+
*/
270277
executeLiveSyncOperation(devices: Mobile.IDevice[], liveSyncService: ILiveSyncService, platform: string): Promise<void>;
271278
getPlatformsForOperation(platform: string): string[];
272279
}

lib/services/livesync/livesync-command-helper.ts

-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ export class LiveSyncCommandHelper implements ILiveSyncCommandHelper {
2020
this.$errors.failWithoutHelp("Unable to find applicable devices to execute operation and unable to start emulator when platform is not specified.");
2121
}
2222

23-
await this.$devicesService.detectCurrentlyAttachedDevices({ shouldReturnImmediateResult: false, platform });
24-
2523
const workingWithiOSDevices = !platform || this.$mobileHelper.isiOSPlatform(platform);
2624
const shouldKeepProcessAlive = this.$options.watch || !this.$options.justlaunch;
2725
if (workingWithiOSDevices && shouldKeepProcessAlive) {

0 commit comments

Comments
 (0)