jberkel / android-plugin

An sbt plugin for Android development in Scala
https://groups.google.com/forum/#!forum/scala-on-android
Other
476 stars 113 forks source link

Spring cleaning #175

Closed fxthomas closed 11 years ago

fxthomas commented 11 years ago

A lot of things to (hopefully) make the plugin a little easier to use. This will break your current build files and require you to change a few things, but I tried to make both the plugin source and your build files easier to read and understand. Tell me what you think of it.

Questions?

The default (compile) configuration builds a development app (no Scala Library, use the preloaded one and skip Proguard).

The debug configuration builds a debug app with the Scala Library bundled in, and with Proguard.

The release configuration builds a release app package.

To run a command in a specific configuration, prefix it with the configuration name. apk will use the default development mode, while debug:apk and release:apk will each use Debug and Release settings.

To change a setting or a task for one specific configuration only, just use in, like in mySettingKey in Release := "Hello, world".

build.sbt

androidDefaults

name := "AppName"

version := "0.1"

versionCode := 0

scalaVersion := "2.10.1"

platformName := "android-16"

project/build.scala

import sbt._
import Keys._
import Defaults._

// Import the Android plugin
import org.scalasbt.androidplugin.AndroidPlugin._

object AndroidBuild extends Build {

  // Global settings for all projects
  val globalSettings = Seq(
    name := "App",
    version := "0.1",
    versionCode := 0,
    scalaVersion := "2.10.1",
    platformName := "android-16",
  )

  // Main project
  lazy val main = AndroidProject("main", file("."), settings=globalSettings)

  // Android instrumentation tests
  lazy val tests = AndroidTestProject("tests", file("tests"), settings=globalSettings)
    .dependsOn(main % "provided")
    .settings(name := "AppTests")
}
fxthomas commented 11 years ago

(Don't merge all that right now, it would be nice to check the other PRs before doing so)