Skip to content

Instantly share code, notes, and snippets.

@pfn
Last active December 11, 2015 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pfn/4658693 to your computer and use it in GitHub Desktop.
Save pfn/4658693 to your computer and use it in GitHub Desktop.
another multi-project/complex build.scala for android
import sbt._
import sbt.Keys._
import AndroidKeys._
object ComplexBuild extends Build {
lazy val rootSettings = Seq(
packageT in Compile <<= packageT in Android in app,
packageRelease <<= packageRelease in Android in app,
packageDebug <<= packageDebug in Android in app,
install <<= install in Android in app,
uninstall <<= uninstall in Android in app,
run <<= run in Android in app,
cleanAapt <<= (cleanAapt in Android in app,
cleanAapt in Android in lib) map { (_,_) => () }
) ++ AndroidSdkPlugin.androidCommands
lazy val root = Project(id = "root", base = file(".")) settings(
rootSettings:_*
) aggregate(app, lib, anotherlib) settings(test <<= test in Test in lib)
lazy val appSettings =
(javacOptions in Compile += "-Xlint:deprecation") +:
(name := "some-mobile") +:
(compile in Compile <<= compile in Compile
dependsOn(packageT in Compile in lib,
packageT in Compile in anotherlib)) +:
AndroidSdkPlugin.androidBuildSettings :+ (libraryDependencies ++= Seq(
"junit" % "junit" % "4.8.2" % "test",
"org.scalatest" %% "scalatest" % "1.7.1" % "test"))
lazy val app = Project(id = "app", base = file("AppProjectDir")) settings(
appSettings:_*
) dependsOn(lib, anotherlib)
lazy val lib = Project(id = "lib", base = file("LibProjectDir")) settings(
((libraryDependencies += "com.google.android" % "support-v4" % "r7") +:
(javacOptions in Compile += "-Xlint:deprecation") +:
AndroidSdkPlugin.androidBuildSettings: _*)
lazy val anotherlib = Project(id = "anotherlib",
base = file("AnotherAndroidLibDir")
) settings(AndroidSdkPlugin.androidBuildSettings:_*)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment