Skip to content

Commit 413e271

Browse files
committed
clean-up after release build in android to prevent runtime errors
1 parent c220cc0 commit 413e271

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

lib/definitions/project.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ interface IPlatformProjectService {
163163
* @returns {void}
164164
*/
165165
ensureConfigurationFileInAppResources(): void;
166+
167+
/**
168+
* Removes build artifacts specific to the platform
169+
* @returns {void}
170+
*/
171+
cleanProject(projectRoot: string, options: string[]): IFuture<void>
166172
}
167173

168174
interface IAndroidProjectPropertiesManager {

lib/services/android-project-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
410410
return Future.fromResult();
411411
}
412412

413-
private cleanProject(projectRoot: string, options: string[]): IFuture<void> {
413+
public cleanProject(projectRoot: string, options: string[]): IFuture<void> {
414414
return (() => {
415415
options.unshift("clean");
416416

lib/services/ios-project-service.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,10 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
657657
return null;
658658
}
659659

660+
public cleanProject(projectRoot: string, options: string[]): IFuture<void> {
661+
return null;
662+
}
663+
660664
private mergeInfoPlists(): IFuture<void> {
661665
return (() => {
662666
let projectDir = this.$projectData.projectDir;

lib/services/platform-service.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,16 @@ export class PlatformService implements IPlatformService {
217217
this.ensurePlatformInstalled(platform).wait();
218218
let changesInfo = this.$projectChangesService.checkForChanges(platform);
219219
if (changesInfo.hasChanges) {
220+
// android build artifacts need to be cleaned up when switching from release to debug builds
221+
if (platform.toLowerCase() === "android") {
222+
let previousPrepareInfo = this.$projectChangesService.getPrepareInfo(platform);
223+
// clean up prepared plugins when not building for release
224+
if (previousPrepareInfo && previousPrepareInfo.release && !this.$options.release) {
225+
let platformData = this.$platformsData.getPlatformData(platform);
226+
platformData.platformProjectService.cleanProject(platformData.projectRoot, []).wait();
227+
}
228+
}
229+
220230
this.preparePlatformCore(platform, changesInfo).wait();
221231
this.$projectChangesService.savePrepareInfo(platform);
222232
} else {

0 commit comments

Comments
 (0)