Skip to content

apply PR #2452 based to master #2568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/definitions/project.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ interface IPlatformProjectService {
* @returns {void}
*/
stopServices(): Promise<ISpawnResult>;

/**
* Removes build artifacts specific to the platform
* @returns {void}
*/
cleanProject(projectRoot: string, options: string[]): Promise<void>
}

interface IAndroidProjectPropertiesManager {
Expand Down
2 changes: 1 addition & 1 deletion lib/services/android-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
return this.$childProcess.spawnFromEvent(gradleBin, ["--stop", "--quiet"], "close", { stdio: "inherit", cwd: projectRoot });
}

private async cleanProject(projectRoot: string, options: string[]): Promise<void> {
public async cleanProject(projectRoot: string, options: string[]): Promise<void> {
options.unshift("clean");

let gradleBin = path.join(projectRoot, "gradlew");
Expand Down
4 changes: 4 additions & 0 deletions lib/services/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,10 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
return Promise.resolve({stderr: "", stdout: "", exitCode: 0});
}

public async cleanProject(projectRoot: string, options: string[]): Promise<void> {
return Promise.resolve();
}

private async mergeInfoPlists(): Promise<void> {
let projectDir = this.$projectData.projectDir;
let infoPlistPath = this.$options.baseConfig || path.join(projectDir, constants.APP_FOLDER_NAME, constants.APP_RESOURCES_FOLDER_NAME, this.platformData.normalizedPlatformName, this.platformData.configurationFileName);
Expand Down
10 changes: 10 additions & 0 deletions lib/services/platform-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,16 @@ export class PlatformService implements IPlatformService {
this.$logger.trace("Changes info in prepare platform:", changesInfo);

if (changesInfo.hasChanges) {
// android build artifacts need to be cleaned up when switching from release to debug builds
if (platform.toLowerCase() === "android") {
let previousPrepareInfo = this.$projectChangesService.getPrepareInfo(platform);
// clean up prepared plugins when not building for release
if (previousPrepareInfo && previousPrepareInfo.release !== this.$options.release) {
let platformData = this.$platformsData.getPlatformData(platform);
await platformData.platformProjectService.cleanProject(platformData.projectRoot, []);
}
}

await this.preparePlatformCore(platform, changesInfo);
this.$projectChangesService.savePrepareInfo(platform);
} else {
Expand Down
3 changes: 3 additions & 0 deletions test/stubs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,9 @@ export class PlatformProjectServiceStub implements IPlatformProjectService {
async stopServices(): Promise<ISpawnResult> {
return Promise.resolve({stderr: "", stdout: "", exitCode: 0});
}
async cleanProject(projectRoot: string, options: string[]): Promise<void> {
return Promise.resolve();
}
}

export class ProjectDataService implements IProjectDataService {
Expand Down