simpligility/android-maven-plugin — pull request #533 by greek1979 (2014-12-10 15:27:06+00:00)
Title: Improving Android Manifest file handling upon changes

There is an implicit issue in the way Android Maven Plugin handle application manifest file (AndroidManifest.xml) if developer has requested any build-time changes to it through plugin execution configuration. The root cause of all the confusion is the way how three configurable parameters - *sourceManifestFile*, *androidManifestFile*, and *updatedManifestFile* are treated by different plugin goals (mojos).

Suppose the following scenario. We have an apk build which needs to update manifest properties (e.g. inject application icon, bump up version code, set "debuggable" flag), but also to do code-related changes to the manifest (e.g. rename application package or generate R file in a custom package). This cannot be easily accomplished even when developer activates all three parameters, as some are shared between mojos - the original value in pom.xml, not runtime value - the rest is not.

The following changes are offered. First, get rid of duplicate logic for copying the manifest file by both *ManifestUpdateMojo* and *GenerateSourcesMojo*. Second, treat *updatedManifestFile* parameter as optional; if it is not explicitly defined, manifest file is effectively overwritten in place. Third, add proper support for *sourceManifestFile* parameter to those who still prefer to keep application manifest in project root (as in old times).