Skip to content

Execute batch sync when you live sync application with the --watch option #1870

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

Merged
merged 1 commit into from
Jun 23, 2016
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
5 changes: 3 additions & 2 deletions lib/services/livesync/android-livesync-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ class AndroidLiveSyncService extends liveSyncServiceBaseLib.LiveSyncServiceBase<
private $mobileHelper: Mobile.IMobileHelper,
private $options: IOptions,
private $injector: IInjector,
private $projectData: IProjectData) {
super(_device);
private $projectData: IProjectData,
$liveSyncProvider: ILiveSyncProvider) {
super(_device, $liveSyncProvider);
}

public restartApplication(deviceAppData: Mobile.IDeviceAppData): IFuture<void> {
Expand Down
7 changes: 4 additions & 3 deletions lib/services/livesync/ios-livesync-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ class IOSLiveSyncService extends liveSyncServiceBaseLib.LiveSyncServiceBase<Mobi
private $iOSEmulatorServices: Mobile.IiOSSimulatorService,
private $injector: IInjector,
private $logger: ILogger,
private $options: IOptions) {
super(_device);
}
private $options: IOptions,
$liveSyncProvider: ILiveSyncProvider) {
super(_device, $liveSyncProvider);
}

public removeFiles(appIdentifier: string, localToDevicePaths: Mobile.ILocalToDevicePathData[]): IFuture<void> {
return (() => {
Expand Down
7 changes: 5 additions & 2 deletions lib/services/livesync/livesync-service-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ export abstract class LiveSyncServiceBase<T extends Mobile.IDevice> {
return <T>(this._device);
}

constructor(private _device: Mobile.IDevice) { }
constructor(private _device: Mobile.IDevice,
private $liveSyncProvider: ILiveSyncProvider) { }

public refreshApplication(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], canExecuteFastSync?: boolean): IFuture<void> {
public refreshApplication(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], forceExecuteFullSync: boolean): IFuture<void> {
let canExecuteFastSync = !forceExecuteFullSync && localToDevicePaths &&
_.all(localToDevicePaths, localToDevicePath => this.$liveSyncProvider.canExecuteFastSync(localToDevicePath.getLocalPath(), deviceAppData.platform));
if (canExecuteFastSync) {
return this.reloadPage(deviceAppData);
}
Expand Down
11 changes: 2 additions & 9 deletions lib/services/test-execution-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,7 @@ class TestExecutionService implements ITestExecutionService {
}
this.detourEntryPoint(projectFilesPath).wait();

let liveSyncData = {
platform: platform,
appIdentifier: this.$projectData.projectId,
projectFilesPath: projectFilesPath,
syncWorkingDirectory: path.join(projectDir, constants.APP_FOLDER_NAME)
};

this.$liveSyncServiceBase.sync(liveSyncData).wait();
this.liveSyncProject(platform);

if (this.$options.debugBrk) {
this.$logger.info('Starting debugger...');
Expand Down Expand Up @@ -233,8 +226,8 @@ class TestExecutionService implements ITestExecutionService {
platform: platform,
appIdentifier: this.$projectData.projectId,
projectFilesPath: projectFilesPath,
forceExecuteFullSync: true, // Always restart the application when change is detected, so tests will be rerun.
syncWorkingDirectory: path.join(this.$projectData.projectDir, constants.APP_FOLDER_NAME),
canExecuteFastSync: false, // Always restart the application when change is detected, so tests will be rerun.
excludedProjectDirsAndFiles: this.$options.release ? constants.LIVESYNC_EXCLUDED_FILE_PATTERNS : []
};

Expand Down