Skip to content

Commit a671087

Browse files
author
Tsvetan Raikov
committed
Implemented incremental prepare
1 parent e84dd6d commit a671087

18 files changed

+233
-83
lines changed

lib/commands/appstore-upload.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,11 @@ export class PublishIOS implements ICommand {
6363
};
6464
this.$logger.info("Building .ipa with the selected mobile provision and/or certificate.");
6565
// This is not very correct as if we build multiple targets we will try to sign all of them using the signing identity here.
66-
this.$platformService.prepareAndExecute(platform, () => this.$platformService.buildPlatform(platform, iOSBuildConfig)).wait();
66+
this.$platformService.prepareAndBuild(platform, iOSBuildConfig, true).wait();
6767
ipaFilePath = this.$platformService.lastOutputPath(platform, { isForDevice: iOSBuildConfig.buildForDevice });
6868
} else {
6969
this.$logger.info("No .ipa, mobile provision or certificate set. Perfect! Now we'll build .xcarchive and let Xcode pick the distribution certificate and provisioning profile for you when exporting .ipa for AppStore submission.");
70-
if (!this.$platformService.preparePlatform(platform).wait()) {
71-
this.$errors.failWithoutHelp("Failed to prepare project.");
72-
}
70+
this.$platformService.preparePlatform(platform, true).wait();
7371

7472
let platformData = this.$platformsData.getPlatformData(platform);
7573
let iOSProjectService = <IOSProjectService>platformData.platformProjectService;

lib/commands/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export class BuildCommandBase {
55
executeCore(args: string[], buildConfig?: IBuildConfig): IFuture<void> {
66
return (() => {
77
let platform = args[0].toLowerCase();
8-
this.$platformService.prepareAndExecute(platform, () => this.$platformService.buildPlatform(platform, buildConfig)).wait();
8+
this.$platformService.prepareAndBuild(platform, buildConfig, true).wait();
99
if(this.$options.copyTo) {
1010
this.$platformService.copyLastOutput(platform, this.$options.copyTo, {isForDevice: this.$options.forDevice}).wait();
1111
}

lib/commands/prepare.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ export class PrepareCommand implements ICommand {
55

66
execute(args: string[]): IFuture<void> {
77
return (() => {
8-
if (!this.$platformService.preparePlatform(args[0]).wait()) {
9-
this.$errors.failWithoutHelp("Unable to prepare the project.");
10-
}
8+
this.$platformService.preparePlatform(args[0], true).wait();
119
}).future<void>()();
1210
}
1311

lib/common

lib/definitions/platform.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface IPlatformService {
66
removePlatforms(platforms: string[]): IFuture<void>;
77
updatePlatforms(platforms: string[]): IFuture<void>;
88
runPlatform(platform: string, buildConfig?: IBuildConfig): IFuture<void>;
9-
preparePlatform(platform: string): IFuture<boolean>;
9+
preparePlatform(platform: string, force?: boolean, skipModulesAndResources?: boolean): IFuture<boolean>;
1010
cleanDestinationApp(platform: string): IFuture<void>;
1111
buildPlatform(platform: string, buildConfig?: IBuildConfig): IFuture<void>;
1212
buildForDeploy(platform: string, buildConfig?: IBuildConfig): IFuture<void>;
@@ -23,7 +23,7 @@ interface IPlatformService {
2323
lastOutputPath(platform: string, settings: { isForDevice: boolean }): string;
2424
ensurePlatformInstalled(platform: string): IFuture<void>;
2525

26-
prepareAndExecute(platform: string, executeAction: () => IFuture<void>): IFuture<void>;
26+
prepareAndBuild(platform: string, buildConfig?: IBuildConfig, forceBuild?: boolean): IFuture<void>;
2727
}
2828

2929
interface IPlatformData {

lib/providers/livesync-provider.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ export class LiveSyncProvider implements ILiveSyncProvider {
6969

7070
public preparePlatformForSync(platform: string): IFuture<void> {
7171
return (() => {
72-
if (!this.$platformService.preparePlatform(platform).wait()) {
73-
this.$logger.out("Verify that listed files are well-formed and try again the operation.");
74-
}
72+
this.$platformService.preparePlatform(platform).wait();
7573
}).future<void>()();
7674
}
7775

lib/services/android-debug-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class AndroidDebugService implements IDebugService {
111111
let cachedDeviceOption = this.$options.forDevice;
112112
this.$options.forDevice = true;
113113
if (this.$options.rebuild) {
114-
this.$platformService.prepareAndExecute(this.platform, () => this.$platformService.buildPlatform(this.platform)).wait();
114+
this.$platformService.prepareAndBuild(this.platform).wait();
115115
}
116116
this.$options.forDevice = !!cachedDeviceOption;
117117

lib/services/app-files-updater.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ export class AppFilesUpdater {
5050
}
5151

5252
protected readSourceDir(): string[] {
53-
return this.fs.enumerateFilesInDirectorySync(this.appSourceDirectoryPath, null, { includeEmptyDirectories: true });
53+
let tnsDir = path.join(this.appSourceDirectoryPath, constants.TNS_MODULES_FOLDER_NAME);
54+
return this.fs.enumerateFilesInDirectorySync(this.appSourceDirectoryPath, null, { includeEmptyDirectories: true }).filter(dirName => dirName !== tnsDir);
5455
}
5556

5657
protected resolveAppSourceFiles(): string[] {

lib/services/ios-debug-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class IOSDebugService implements IDebugService {
102102
return (() => {
103103
let platformData = this.$platformsData.getPlatformData(this.platform);
104104
if (this.$options.rebuild) {
105-
this.$platformService.prepareAndExecute(this.platform, () => this.$platformService.buildPlatform(this.platform)).wait();
105+
this.$platformService.prepareAndBuild(this.platform).wait();
106106
}
107107
let emulatorPackage = this.$platformService.getLatestApplicationPackageForEmulator(platformData).wait();
108108

lib/services/ios-project-service.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,30 +1010,30 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
10101010

10111011
private mergeProjectXcconfigFiles(): IFuture<void> {
10121012
return (() => {
1013-
this.$fs.deleteFile(this.pluginsDebugXcconfigFilePath).wait();
1014-
this.$fs.deleteFile(this.pluginsReleaseXcconfigFilePath).wait();
1013+
this.$fs.deleteFile(this.$options.release ? this.pluginsReleaseXcconfigFilePath : this.pluginsDebugXcconfigFilePath).wait();
10151014

10161015
let allPlugins: IPluginData[] = (<IPluginsService>this.$injector.resolve("pluginsService")).getAllInstalledPlugins().wait();
10171016
for (let plugin of allPlugins) {
10181017
let pluginPlatformsFolderPath = plugin.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME);
10191018
let pluginXcconfigFilePath = path.join(pluginPlatformsFolderPath, "build.xcconfig");
10201019
if (this.$fs.exists(pluginXcconfigFilePath).wait()) {
1021-
this.mergeXcconfigFiles(pluginXcconfigFilePath, this.pluginsDebugXcconfigFilePath).wait();
1022-
this.mergeXcconfigFiles(pluginXcconfigFilePath, this.pluginsReleaseXcconfigFilePath).wait();
1020+
this.mergeXcconfigFiles(pluginXcconfigFilePath,this.$options.release ? this.pluginsReleaseXcconfigFilePath : this.pluginsDebugXcconfigFilePath).wait();
10231021
}
10241022
}
10251023

10261024
let appResourcesXcconfigPath = path.join(this.$projectData.projectDir, constants.APP_FOLDER_NAME, constants.APP_RESOURCES_FOLDER_NAME, this.platformData.normalizedPlatformName, "build.xcconfig");
10271025
if (this.$fs.exists(appResourcesXcconfigPath).wait()) {
1028-
this.mergeXcconfigFiles(appResourcesXcconfigPath, this.pluginsDebugXcconfigFilePath).wait();
1029-
this.mergeXcconfigFiles(appResourcesXcconfigPath, this.pluginsReleaseXcconfigFilePath).wait();
1026+
this.mergeXcconfigFiles(appResourcesXcconfigPath, this.$options.release ? this.pluginsReleaseXcconfigFilePath : this.pluginsDebugXcconfigFilePath).wait();
10301027
}
10311028

10321029
let podFilesRootDirName = path.join("Pods", "Target Support Files", `Pods-${this.$projectData.projectName}`);
10331030
let podFolder = path.join(this.platformData.projectRoot, podFilesRootDirName);
10341031
if (this.$fs.exists(podFolder).wait()) {
1035-
this.mergeXcconfigFiles(path.join(this.platformData.projectRoot, podFilesRootDirName, `Pods-${this.$projectData.projectName}.debug.xcconfig`), this.pluginsDebugXcconfigFilePath).wait();
1036-
this.mergeXcconfigFiles(path.join(this.platformData.projectRoot, podFilesRootDirName, `Pods-${this.$projectData.projectName}.release.xcconfig`), this.pluginsReleaseXcconfigFilePath).wait();
1032+
if (this.$options.release) {
1033+
this.mergeXcconfigFiles(path.join(this.platformData.projectRoot, podFilesRootDirName, `Pods-${this.$projectData.projectName}.release.xcconfig`), this.pluginsReleaseXcconfigFilePath).wait();
1034+
} else {
1035+
this.mergeXcconfigFiles(path.join(this.platformData.projectRoot, podFilesRootDirName, `Pods-${this.$projectData.projectName}.debug.xcconfig`), this.pluginsDebugXcconfigFilePath).wait();
1036+
}
10371037
}
10381038
}).future<void>()();
10391039
}

0 commit comments

Comments
 (0)