Skip to content

Instantly share code, notes, and snippets.

@dant3
Created July 18, 2014 20:24
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 dant3/86ba0078f68c935af1bf to your computer and use it in GitHub Desktop.
Save dant3/86ba0078f68c935af1bf 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