android manifest generation

jqno edited this page Jan 18, 2012 · 5 revisions

Android manifest generation

If you would like your AndroidManifest.xml file to automatically inherit versionName and versionCode from your SBT project, add the AndroidManifestGenerator.settings build settings to your project.

It will look for an AndroidManifest.xml template in src/main and generate a new manifest (written to target/scala-2.x.y/resource_managed/main/) based on your current build settings (version and versionCode). This only works if the original AndroidManifest.xml template does not contain the android:version and android:versionCode attributes.

val settings = Defaults.defaultSettings ++ Seq (
  version := "1.0",
  versionCode := 1,
  // ...
)

// ...

object AndroidBuild extends Build {
  lazy val main = Project (
    "My Project",
    file("."),
    settings = General.fullAndroidSettings ++ AndroidManifestGenerator.settings
  )
}