Skip to content

Commit 67fbbe9

Browse files
author
Tsvetan Raikov
committed
Fixed incremental build when running on device and for release
1 parent c24b867 commit 67fbbe9

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

lib/services/platform-service.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,8 @@ export class PlatformService implements IPlatformService {
348348
return (() => {
349349
let shouldBuild = this.preparePlatform(platform, false).wait();
350350
let platformData = this.$platformsData.getPlatformData(platform);
351-
let buildInfoFile = path.join(platformData.projectRoot, buildInfoFileName);
351+
let buildInfoFilePath = this.getBuildOutputPath(platform, platformData, buildConfig);
352+
let buildInfoFile = path.join(buildInfoFilePath, buildInfoFileName);
352353
if (!shouldBuild) {
353354
if (this.$fs.exists(buildInfoFile).wait()) {
354355
let buildInfoText = this.$fs.readText(buildInfoFile).wait();
@@ -364,6 +365,14 @@ export class PlatformService implements IPlatformService {
364365
}).future<void>()();
365366
}
366367

368+
private getBuildOutputPath(platform: string, platformData: IPlatformData, buildConfig?: IBuildConfig): string {
369+
let buildForDevice = buildConfig ? buildConfig.buildForDevice : false;
370+
if (platform === this.$devicePlatformsConstants.iOS.toLowerCase()) {
371+
return buildForDevice ? platformData.deviceBuildOutputPath : platformData.emulatorBuildOutputPath;
372+
}
373+
return platformData.deviceBuildOutputPath;
374+
}
375+
367376
public buildForDeploy(platform: string, buildConfig?: IBuildConfig): IFuture<void> {
368377
return (() => {
369378
platform = platform.toLowerCase();
@@ -467,7 +476,7 @@ export class PlatformService implements IPlatformService {
467476
} else {
468477
let deviceBuildConfig = buildConfig || {};
469478
deviceBuildConfig.buildForDevice = true;
470-
this.prepareAndBuild(platform, buildConfig).wait();
479+
this.prepareAndBuild(platform, deviceBuildConfig).wait();
471480
packageFile = this.getLatestApplicationPackageForDevice(platformData).wait().packageName;
472481
}
473482
}

lib/services/project-changes-info.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const prepareInfoFileName = ".nsprepareinfo";
55
export interface IPrepareInfo {
66
time: string;
77
bundle: boolean;
8+
release: boolean;
89
}
910

1011
export class ProjectChangesInfo {
@@ -36,7 +37,7 @@ export class ProjectChangesInfo {
3637
this.appResourcesChanged = true;
3738
this.modulesChanged = true;
3839
this.configChanged = true;
39-
this.prepareInfo = { time: "", bundle: $options.bundle };
40+
this.prepareInfo = { time: "", bundle: $options.bundle, release: $options.release };
4041
} else {
4142
let outputProjectMtime = this.$fs.getFsStats(buildInfoFile).wait().mtime.getTime();
4243
this.prepareInfo = this.$fs.readJson(buildInfoFile).wait();
@@ -58,10 +59,21 @@ export class ProjectChangesInfo {
5859
], outputProjectMtime);
5960
}
6061
}
62+
6163
if (this.$options.bundle !== this.prepareInfo.bundle) {
6264
this.modulesChanged = true;
6365
this.prepareInfo.bundle = this.$options.bundle;
6466
}
67+
if (this.$options.release !== this.prepareInfo.release) {
68+
this.appFilesChanged = true;
69+
this.appResourcesChanged = true;
70+
this.modulesChanged = true;
71+
this.configChanged = true;
72+
this.prepareInfo.release = this.$options.release;
73+
}
74+
if (this.modulesChanged || this.appResourcesChanged) {
75+
this.configChanged = true;
76+
}
6577
}
6678

6779
if (this.hasChanges) {

0 commit comments

Comments
 (0)