clojure-android/lein-droid — pull request #95 by AdamClements (2014-06-17 19:13:28+00:00)
Title: Improved manifest manipulation

Much more flexible manifest system. Define a :manifest-template xml file which has placeholders in the clostache format, for example {{version-code}}, then specify an :android :manifest map with the appropriate substitutions. This can be used to insert debug permissions, version codes, change app names in different profiles, etc.

Bundled with this I have made the default map insert the {{version-name}} and {{version-code}} substitutions from the semantic leiningen version string. This will work if you stick to standard semantic
versioning (which the new leiningen releases feature does).

This feature is back-compatible. :manifest-file remains as an option, and is the *output* of the template substitution, so I would recommend by default this is set to target/AndroidManifest.xml if you're using the
new :manifest-template option.

There is a lot of other code which could be simplified in lein-droid using this approach without breaking back-compatibility I think, and even bigger improvements which could be made if this was the default way to do manifest manipulation. This has the nice property that it can be overridden in different profiles and arbitrarily extended without needing to hardcode every situation ahead of time.

I've also included the option to change the apk package namespace (different to the namespace which R references etc), this lets you install multiple versions of your app without them conflicting, which I need to have a release version installed at the same time as actively developing.

Here's a gist with a skeleton manifest and project.clj making use of the new features. Note that when this runs, the versionCode and versionName will be automatically set in the manifest map as per the "1.3.1-SNAPSHOT" set in the project.clj