Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move device discovery to debug command as it is done for run command #3008

Merged
merged 2 commits into from
Jul 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/commands/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export class DebugPlatformCommand implements ICommand {

const selectedDeviceForDebug = await this.getDeviceForDebug();

await this.$devicesService.detectCurrentlyAttachedDevices({ shouldReturnImmediateResult: false, platform: this.platform });

await this.$liveSyncCommandHelper.executeLiveSyncOperation([selectedDeviceForDebug], this.$debugLiveSyncService, this.platform);
}

Expand Down
7 changes: 7 additions & 0 deletions lib/definitions/livesync.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,13 @@ interface IDevicePathProvider {
}

interface ILiveSyncCommandHelper {
/**
* Method sets up configuration, before calling livesync and expects that devices are already discovered.
* @param {Mobile.IDevice[]} devices List of discovered devices
* @param {ILiveSyncService} liveSyncService Service expected to do the actual livesyncing
* @param {string} platform The platform for which the livesync will be ran
* @returns {Promise<void>}
*/
executeLiveSyncOperation(devices: Mobile.IDevice[], liveSyncService: ILiveSyncService, platform: string): Promise<void>;
getPlatformsForOperation(platform: string): string[];
}
2 changes: 0 additions & 2 deletions lib/services/livesync/livesync-command-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ export class LiveSyncCommandHelper implements ILiveSyncCommandHelper {
this.$errors.failWithoutHelp("Unable to find applicable devices to execute operation and unable to start emulator when platform is not specified.");
}

await this.$devicesService.detectCurrentlyAttachedDevices({ shouldReturnImmediateResult: false, platform });

const workingWithiOSDevices = !platform || this.$mobileHelper.isiOSPlatform(platform);
const shouldKeepProcessAlive = this.$options.watch || !this.$options.justlaunch;
if (workingWithiOSDevices && shouldKeepProcessAlive) {
Expand Down