diff --git a/lib/common b/lib/common index c31dbcdf56..6ec3a807b3 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit c31dbcdf56dd94b1f409b42fa9eec8e964a768bf +Subproject commit 6ec3a807b3d18399366f50d186266b9610c210d8 diff --git a/lib/services/livesync/platform-livesync-service-base.ts b/lib/services/livesync/platform-livesync-service-base.ts index 27500ab6d9..ce27af8453 100644 --- a/lib/services/livesync/platform-livesync-service-base.ts +++ b/lib/services/livesync/platform-livesync-service-base.ts @@ -58,7 +58,7 @@ export abstract class PlatformLiveSyncServiceBase { const syncInfo = _.merge({ device, watch: true }, liveSyncInfo); const deviceAppData = await this.getAppData(syncInfo); - const modifiedLocalToDevicePaths: Mobile.ILocalToDevicePathData[] = []; + let modifiedLocalToDevicePaths: Mobile.ILocalToDevicePathData[] = []; if (liveSyncInfo.filesToSync.length) { const filesToSync = liveSyncInfo.filesToSync; const mappedFiles = _.map(filesToSync, filePath => this.$projectFilesProvider.mapFilePath(filePath, device.deviceInfo.platform, projectData)); @@ -77,7 +77,7 @@ export abstract class PlatformLiveSyncServiceBase { const localToDevicePaths = await this.$projectFilesManager.createLocalToDevicePaths(deviceAppData, projectFilesPath, existingFiles, []); modifiedLocalToDevicePaths.push(...localToDevicePaths); - await this.transferFiles(deviceAppData, localToDevicePaths, projectFilesPath, false); + modifiedLocalToDevicePaths = await this.transferFiles(deviceAppData, localToDevicePaths, projectFilesPath, false); } } @@ -105,11 +105,11 @@ export abstract class PlatformLiveSyncServiceBase { } protected async transferFiles(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], projectFilesPath: string, isFullSync: boolean): Promise { - let transferredFiles = localToDevicePaths; + let transferredFiles: Mobile.ILocalToDevicePathData[] = []; if (isFullSync) { transferredFiles = await deviceAppData.device.fileSystem.transferDirectory(deviceAppData, localToDevicePaths, projectFilesPath); } else { - await deviceAppData.device.fileSystem.transferFiles(deviceAppData, localToDevicePaths); + transferredFiles = await deviceAppData.device.fileSystem.transferFiles(deviceAppData, localToDevicePaths); } this.logFilesSyncInformation(transferredFiles, "Successfully transferred %s.", this.$logger.info); diff --git a/lib/services/prepare-platform-service.ts b/lib/services/prepare-platform-service.ts index 61a04ed249..8f05199c4d 100644 --- a/lib/services/prepare-platform-service.ts +++ b/lib/services/prepare-platform-service.ts @@ -26,9 +26,13 @@ export class PreparePlatformService { beforeCopyAction: sourceFiles => { this.$xmlValidator.validateXmlFiles(sourceFiles); }, - filesToSync: copyAppFilesData.filesToSync, filesToRemove: copyAppFilesData.filesToRemove }; + // TODO: consider passing filesToSync in appUpdaterOptions + // this would currently lead to the following problem: imagine changing two files rapidly one after the other (transpilation for example) + // the first file would trigger the whole LiveSync process and the second will be queued + // after the first LiveSync is done the .nsprepare file is written and the second file is later on wrongly assumed as having been prepared + // because .nsprepare was written after both file changes appUpdater.updateApp(appUpdaterOptions, copyAppFilesData.projectData); } }