Skip to content

Disable fast livesync with hook #1686

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
Apr 18, 2016
Merged
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: 1 addition & 1 deletion lib/common
1 change: 1 addition & 0 deletions lib/declarations.ts
Original file line number Diff line number Diff line change
@@ -56,6 +56,7 @@ interface IOpener {

interface ILiveSyncService {
liveSync(platform: string): IFuture<void>;
forceExecuteFullSync: boolean;
}

interface IOptions extends ICommonOptions {
20 changes: 15 additions & 5 deletions lib/services/livesync/livesync-service.ts
Original file line number Diff line number Diff line change
@@ -2,10 +2,12 @@
"use strict";

import * as constants from "../../constants";
import * as helpers from "../../common/helpers";
import * as path from "path";
import * as semver from "semver";

class LiveSyncService implements ILiveSyncService {
public forceExecuteFullSync = false;
private _isInitialized = false;

constructor(private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
@@ -15,7 +17,8 @@ class LiveSyncService implements ILiveSyncService {
private $platformService: IPlatformService,
private $projectData: IProjectData,
private $projectDataService: IProjectDataService,
private $prompter: IPrompter) { }
private $prompter: IPrompter,
private $injector: IInjector) { }

private ensureAndroidFrameworkVersion(platformData: IPlatformData): IFuture<void> { // TODO: this can be moved inside command or canExecute function
return (() => {
@@ -50,15 +53,22 @@ class LiveSyncService implements ILiveSyncService {

this._isInitialized = true; // If we want before-prepare hooks to work properly, this should be set after preparePlatform function

let platformData = this.$platformsData.getPlatformData(platformLowerCase);
this.ensureAndroidFrameworkVersion(platformData).wait();
this.liveSyncCore(platform).wait();
}).future<void>()();
}

@helpers.hook('livesync')
private liveSyncCore(platform: string): IFuture<void> {
return (() => {
let platformData = this.$platformsData.getPlatformData(platform.toLowerCase());
this.ensureAndroidFrameworkVersion(platformData).wait();
let liveSyncData: ILiveSyncData = {
platform: platform,
appIdentifier: this.$projectData.projectId,
appIdentifier: this.$projectData.projectId,
projectFilesPath: path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME),
syncWorkingDirectory: path.join(this.$projectData.projectDir, constants.APP_FOLDER_NAME),
excludedProjectDirsAndFiles: constants.LIVESYNC_EXCLUDED_FILE_PATTERNS
excludedProjectDirsAndFiles: constants.LIVESYNC_EXCLUDED_FILE_PATTERNS,
forceExecuteFullSync: this.forceExecuteFullSync
};
this.$liveSyncServiceBase.sync(liveSyncData).wait();
}).future<void>()();