Advertisement
Guest User

Untitled

a guest
Mar 27th, 2014
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 2.80 KB | None | 0 0
  1. organization := "MyOrg"
  2.  
  3. name := "MyProj"
  4.  
  5. // artifactName in ThisBuild := {
  6. //   (_: ScalaVersion, module: ModuleID, artifact: Artifact) =>
  7. //   artifact.name + "-" + module.revision + "." + artifact.extension
  8. // }
  9.  
  10. scalaVersion := "2.10.3"
  11.  
  12. scalacOptions in ThisBuild ++= Seq("-unchecked", "-deprecation", "-feature")
  13.  
  14. compileOrder := CompileOrder.JavaThenScala
  15.  
  16. libraryDependencies in ThisBuild ++= Seq(
  17.   "org.scalatest" %% "scalatest" % "2.0" % "test",
  18.   "com.github.nscala-time" %% "nscala-time" % "0.8.0",
  19.   "net.liftweb" %% "lift-mongodb-record" % "2.6-M2" % "compile->default",
  20.   "com.foursquare" %% "rogue-field" % "2.2.1" intransitive(),
  21.   "com.foursquare" %% "rogue-core" % "2.3.0" intransitive(),
  22.   "com.foursquare" %% "rogue-lift" % "2.3.0" intransitive(),
  23.   "com.foursquare" %% "rogue-index" % "2.3.0" intransitive(),
  24.   "org.scribe" % "scribe" % "1.3.5")
  25.  
  26. EclipseKeys.skipParents := false
  27.  
  28. lazy val common = project in file("BAGCommon")
  29. lazy val core = project in file("Personality.Core") dependsOn common
  30. // for some reason, 'analysis' clashes with something in SBT when referred to in makeDeployJar below
  31. lazy val analysisProj = project in file("Personality.Analysis") dependsOn (common, core)
  32. lazy val ui = project in file("Personality.UI") dependsOn (core, analysisProj)
  33. lazy val root = project in file(".") aggregate (common, core, analysisProj, ui) dependsOn (common, core, analysisProj, ui)
  34.  
  35. // avoid 'clean' cleaning out the dependencies
  36.  
  37. cleanKeepFiles <+= target / "streams"
  38.  
  39. cleanKeepFiles <+= target / "resolution-cache"
  40.  
  41. // one-jar
  42.  
  43. seq(com.github.retronym.SbtOneJar.oneJarSettings: _*)
  44.  
  45. exportJars := true
  46.  
  47. mainClass in oneJar := Some("com.myorg.myproj.web.WebMain")
  48.  
  49. lazy val makeDeployJar = taskKey[java.io.File](
  50.   "Runs 'package', collects all the sub-project JARs in the lib folder of the root project, and runs 'one-jar'")
  51.  
  52. makeDeployJar := {
  53.   val jars = List(
  54.     (Keys.`package` in Compile in root).value,
  55.     (Keys.`package` in Compile in common).value,
  56.     (Keys.`package` in Compile in core).value,
  57.     (Keys.`package` in Compile in analysisProj).value,
  58.     (Keys.`package` in Compile in ui).value
  59.   )
  60.   // looks like OneJar operates on JARs in the root lib only, so we need to collect all of our JARs
  61.   // and temporarily copy them to lib and delete them later:
  62.   val libDir = (baseDirectory in root).value / "lib"
  63.   val libPaths = jars.map(libDir / _.getName)
  64.   IO.copy(jars zip libPaths)
  65.   val ret = oneJar.value
  66.   IO.delete(libPaths)
  67.   // move the resulting JAR to a more human friendly location
  68.   val finalPath = (baseDirectory in root).value / "profile.jar"
  69.   IO.copyFile(ret, finalPath)
  70.   // this is the tedious SBT way of logging
  71.   streams.value.log.info(finalPath.toString)
  72.   // return the resulting JAR path for completeness' sake
  73.   finalPath
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement