Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2014
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import play.Play.autoImport._
  2. import PlayKeys._
  3. import sbt._
  4. import sbt.Keys._
  5. import Common._
  6. import sbt.Package.ManifestAttributes
  7. import sbtassembly.Plugin._
  8. import sbtassembly.AssemblyUtils._
  9. import AssemblyKeys._
  10.  
  11. object ApplicationBuild extends Build {
  12.  
  13.   val branch = "git rev-parse --abbrev-ref HEAD".!!.trim
  14.   val commit = "git rev-parse --short HEAD".!!.trim
  15.   val buildTime = new java.text.SimpleDateFormat("yyyyMMdd-HHmmss").format(new java.util.Date())
  16.   val appVersion = "%s-%s-%s".format(branch, commit, buildTime)
  17.  
  18.   val commonWebDependencies = Seq(
  19.     thumbnailator,
  20.     mailer,
  21.     joda,
  22.     sigar
  23.   )
  24.  
  25.   val webDependencies = Seq(
  26.     riak_scala_client,
  27.     //This is just for playframework dependencies
  28.     "com.typesafe.akka" %% "akka-cluster" % "2.3.4",
  29.     play.PlayImport.cache,
  30.     "javax.servlet" % "javax.servlet-api" % "3.1.0",
  31.     "org.atmosphere" % "atmosphere-runtime" % "2.2.0",
  32.     "eu.infomas" % "annotation-detector" % "3.0.0",
  33.     "org.atmosphere" % "atmosphere-annotations" % "2.2.0"
  34.   )
  35.  
  36.   val scalaBuildOptions = Seq("-unchecked", "-deprecation", "-feature", "-language:reflectiveCalls",
  37.     "-language:implicitConversions", "-language:postfixOps", "-language:dynamics","-language:higherKinds",
  38.     "-language:existentials", "-language:experimental.macros", "-Xmax-classfile-name", "140")
  39.  
  40.   lazy val baseSettings = Project.defaultSettings ++ Seq(
  41.     version := version.value,
  42.     organization := organization.value,
  43.     scalaVersion := scalaVersion.value,
  44.     scalacOptions in Compile:= scalaBuildOptions)
  45.  
  46.   //Manifest settings
  47.   /*lazy val packageSettings = Seq(
  48.     packageOptions in Compile := Seq(ManifestAttributes(
  49.                       ("Implementation-Vendor", organization.value),
  50.                       ("Class-Path", "common.jar db.jar"))))*/
  51.  
  52.   //Exclude common deps settings
  53.   lazy val excludeCommonDeps = Seq(
  54.     mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
  55.       {
  56.         case x if "clever/common/.*".r.pattern.matcher(x).matches =>
  57.           println(x)
  58.           println("clever/common/.*".r.pattern.matcher(x).matches)
  59.           MergeStrategy.discard
  60.         case x if "clever/db/.*".r.pattern.matcher(x).matches =>
  61.           MergeStrategy.discard
  62.         case x =>
  63.           println(x)
  64.           old(x)
  65.       }
  66.     }
  67.   )
  68.  
  69.   // Root project
  70.   lazy val aaaRoot = project.in(file("."))
  71.     .aggregate(web, coreBackend)
  72.     .settings(
  73.       aggregate in run := true
  74.     )
  75.  
  76.   // Common classes
  77.   lazy val common = Project(id = "common", base = file("common"))
  78.     .dependsOn(db)
  79.  
  80.   // Database classes
  81.   lazy val db = Project(id = "db",base = file("db"))
  82.  
  83.   // Actors
  84.   lazy val manager = Project(id = "manager", base = file("manager"),
  85.     settings = baseSettings ++ excludeCommonDeps)
  86.     .dependsOn(common, db)
  87.     .aggregate(common, db)
  88.  
  89.   // Services
  90.   lazy val coreBackend = Project( id = "corebackend", base = file("services/corebackend"))
  91.     .dependsOn(common, db)
  92.     .aggregate(common, db)
  93.  
  94.   lazy val timesheet = Project( id = "timesheet", base = file("services/timesheet"))
  95.     .dependsOn(common, db)
  96.     .aggregate(common, db)
  97.  
  98.   // Web project
  99.   val web = Project( id = "web", base = file("web")
  100.     ).enablePlugins(play.PlayScala)
  101.     .settings(
  102.         scalacOptions ++= scalaBuildOptions,
  103.         sources in doc in Compile := List(),
  104.         libraryDependencies ++= webDependencies ++ commonWebDependencies,
  105.         resolvers += "Spy Repository" at "http://files.couchbase.com/maven2")
  106.     .dependsOn(
  107.       common % "test->test; compile->compile",
  108.       db     % "test->test; compile->compile")
  109.     .aggregate(common, db)
  110.  
  111.     /*
  112.         mappings in (Compile, packageBin) ~= { _.filterNot { case (_, name) =>
  113.           Seq("application.conf", "anotherconfig").contains(name)
  114.         }}*/
  115.  
  116.         /*mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
  117.         {
  118.           case x if "clever/common/.*".r.pattern.matcher(x).matches =>
  119.             MergeStrategy.discard
  120.           case x if "clever/db/.*".r.pattern.matcher(x).matches =>
  121.             MergeStrategy.discard
  122.           case x => old(x)
  123.         }
  124.       }*/
  125.  
  126. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement