Skip to content

Instantly share code, notes, and snippets.

@pt2121
Created July 6, 2013 21:43
Show Gist options
  • Save pt2121/5941406 to your computer and use it in GitHub Desktop.
Save pt2121/5941406 to your computer and use it in GitHub Desktop.
import sbt._
import sbt.Keys._
import android.Keys._
object JavaAndroidBuild extends Build {
lazy val rootSettings = Seq(
packageT in Compile <<= packageT in Android in app3,
packageRelease <<= packageRelease in Android in app3,
packageDebug <<= packageDebug in Android in app3
) ++ android.Plugin.androidCommands
lazy val root = Project(id = "approot", base = file(".")) settings(
rootSettings:_*
) aggregate(app3, lib) settings(test <<= test in Test in lib)
lazy val app3Settings = Seq(
name := "mobile3",
libraryDependencies ++= Seq(
"junit" % "junit" % "4.8.2" % "test",
"org.scalatest" %% "scalatest" % "1.7.1" % "test"),
useProguard in Android := true,
proguardOptions in Android ++= Seq("-dontwarn sun.misc.Unsafe",
"-dontwarn com.google.common.collect.MinMaxPriorityQueue")
) ++ android.Plugin.androidBuild(lib)
lazy val app3 = Project(id = "app3", base = file("MobileR3")) settings(
app3Settings:_*
) dependsOn(lib)
lazy val lib = Project(id = "lib", base = file("Lib")) settings(Seq(
libraryDependencies ++= Seq(
"com.pivotallabs" % "robolectric" % "1.1" % "test",
"junit" % "junit" % "4.8.2" % "test",
"xpp3" % "xpp3" % "1.1.4c" % "test",
"org.scalatest" %% "scalatest" % "1.7.1" % "test"
),
managedClasspath in Test <++= (platformJars in Android, baseDirectory) map {
case ((j,_), b) =>
Seq(Attributed.blank(b / "bin" / "classes"), Attributed.blank(file(j)))
},
exportJars in Test := false,
fullClasspath in Test ~= ( _ filter ( _.data.getName != "classes.jar" ) ),
fullClasspath in Test <+= (sourceDirectory in Test) map { s =>
Attributed.blank(s / "resources")
},
testOptions in Test += Tests.Argument("-oD"),
javacOptions += "-Xlint:unchecked"
) ++ android.Plugin.androidBuild: _*)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment