From 95d6d9405be9846fa1a28089e39164114e760241 Mon Sep 17 00:00:00 2001 From: TsvetanMilanov Date: Fri, 15 Apr 2016 13:18:46 +0300 Subject: [PATCH] Disable fast livesync with hook Add before livesync hook to be able to control the livesync data. Added property in livesync service to force full sync which will be passed to the livesync data. --- lib/common | 2 +- lib/declarations.ts | 1 + lib/services/livesync/livesync-service.ts | 20 +++++++++++++++----- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/lib/common b/lib/common index ab8070f35d..e6e3a42247 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit ab8070f35d6ee20e0b7b926d47d1c2a87cae4c23 +Subproject commit e6e3a42247f9a052fb2b54c51c928678f0a09c6f diff --git a/lib/declarations.ts b/lib/declarations.ts index 99352b6419..f306c86c6d 100644 --- a/lib/declarations.ts +++ b/lib/declarations.ts @@ -56,6 +56,7 @@ interface IOpener { interface ILiveSyncService { liveSync(platform: string): IFuture; + forceExecuteFullSync: boolean; } interface IOptions extends ICommonOptions { diff --git a/lib/services/livesync/livesync-service.ts b/lib/services/livesync/livesync-service.ts index 9795c809b7..6787f20267 100644 --- a/lib/services/livesync/livesync-service.ts +++ b/lib/services/livesync/livesync-service.ts @@ -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 { // 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()(); + } + @helpers.hook('livesync') + private liveSyncCore(platform: string): IFuture { + 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()();