Skip to content

Conversation

@petekanev
Copy link
Contributor

If app's built with the --release option, the settings are recorded in .nsprepareinfo in the platforms/android directory. If the file is present, and follow up builds are not built in release, then the project directory is cleaned manually to ensure that no build artifacts specific to just release (like the android snapshot binaries) are packaged into the debug application.

File changes:

  • exposed an android-specific private method as public to the IPlatformProjectService and created a stub on the ios side.
  • added conditions to clean the build directories on prepare when targeting android

Addresses #2443

@petekanev petekanev added this to the 2.5.0 milestone Jan 24, 2017
}

public cleanProject(projectRoot: string, options: string[]): IFuture<void> {
return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to use:

return Future.fromResult();

This way the code will not fail in case the method is called (currently in case you call cleanProject(..).wait() it will fail that it cannot read property wait fo null.

let changesInfo = this.$projectChangesService.checkForChanges(platform);
if (changesInfo.hasChanges) {
// android build artifacts need to be cleaned up when switching from release to debug builds
if (platform.toLowerCase() === "android") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the whole logic is Android specific, instead of using this if, you can move the whole code inside AndroidProjectService's cleanProject method. Here you can just call:

platformData.platformProjectService.cleanProject(platformData.projectRoot, []).wait();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought about that earlier, but I don't think cleanProject should depend on conditions specific to the prepare phase, and the android test prevents unnecessary prepareInfo checks when preparing an ios project.

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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it good idea to call the clean method in case the previous build was for debug config and the current one is for release? For example:

if (previousPrepareInfo && previousPrepareInfo.release !== this.$options.release) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! Build artifacts should be cleaned when changing the build type. Don't know why I didn't leave it that way.

@petekanev petekanev force-pushed the pete/patch-release--debug-android-build branch from 413e271 to 9495948 Compare January 25, 2017 08:21
@rosen-vladimirov
Copy link
Contributor

👍 After green build, of course ;)

@petekanev petekanev force-pushed the pete/patch-release--debug-android-build branch from 9495948 to 2302507 Compare January 25, 2017 08:39
@petekanev petekanev merged commit 4b475f7 into release Jan 25, 2017
@petekanev petekanev deleted the pete/patch-release--debug-android-build branch January 25, 2017 08:53
petekanev added a commit that referenced this pull request Feb 23, 2017
petekanev added a commit that referenced this pull request Feb 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants