Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import play.Play.autoImport._
- import PlayKeys._
- import sbt._
- import sbt.Keys._
- import Common._
- import sbt.Package.ManifestAttributes
- import sbtassembly.Plugin._
- import sbtassembly.AssemblyUtils._
- import AssemblyKeys._
- object ApplicationBuild extends Build {
- val branch = "git rev-parse --abbrev-ref HEAD".!!.trim
- val commit = "git rev-parse --short HEAD".!!.trim
- val buildTime = new java.text.SimpleDateFormat("yyyyMMdd-HHmmss").format(new java.util.Date())
- val appVersion = "%s-%s-%s".format(branch, commit, buildTime)
- val commonWebDependencies = Seq(
- thumbnailator,
- mailer,
- joda,
- sigar
- )
- val webDependencies = Seq(
- riak_scala_client,
- //This is just for playframework dependencies
- "com.typesafe.akka" %% "akka-cluster" % "2.3.4",
- play.PlayImport.cache,
- "javax.servlet" % "javax.servlet-api" % "3.1.0",
- "org.atmosphere" % "atmosphere-runtime" % "2.2.0",
- "eu.infomas" % "annotation-detector" % "3.0.0",
- "org.atmosphere" % "atmosphere-annotations" % "2.2.0"
- )
- val scalaBuildOptions = Seq("-unchecked", "-deprecation", "-feature", "-language:reflectiveCalls",
- "-language:implicitConversions", "-language:postfixOps", "-language:dynamics","-language:higherKinds",
- "-language:existentials", "-language:experimental.macros", "-Xmax-classfile-name", "140")
- lazy val baseSettings = Project.defaultSettings ++ Seq(
- version := version.value,
- organization := organization.value,
- scalaVersion := scalaVersion.value,
- scalacOptions in Compile:= scalaBuildOptions)
- //Manifest settings
- /*lazy val packageSettings = Seq(
- packageOptions in Compile := Seq(ManifestAttributes(
- ("Implementation-Vendor", organization.value),
- ("Class-Path", "common.jar db.jar"))))*/
- //Exclude common deps settings
- lazy val excludeCommonDeps = Seq(
- mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
- {
- case x if "clever/common/.*".r.pattern.matcher(x).matches =>
- println(x)
- println("clever/common/.*".r.pattern.matcher(x).matches)
- MergeStrategy.discard
- case x if "clever/db/.*".r.pattern.matcher(x).matches =>
- MergeStrategy.discard
- case x =>
- println(x)
- old(x)
- }
- }
- )
- // Root project
- lazy val aaaRoot = project.in(file("."))
- .aggregate(web, coreBackend)
- .settings(
- aggregate in run := true
- )
- // Common classes
- lazy val common = Project(id = "common", base = file("common"))
- .dependsOn(db)
- // Database classes
- lazy val db = Project(id = "db",base = file("db"))
- // Actors
- lazy val manager = Project(id = "manager", base = file("manager"),
- settings = baseSettings ++ excludeCommonDeps)
- .dependsOn(common, db)
- .aggregate(common, db)
- // Services
- lazy val coreBackend = Project( id = "corebackend", base = file("services/corebackend"))
- .dependsOn(common, db)
- .aggregate(common, db)
- lazy val timesheet = Project( id = "timesheet", base = file("services/timesheet"))
- .dependsOn(common, db)
- .aggregate(common, db)
- // Web project
- val web = Project( id = "web", base = file("web")
- ).enablePlugins(play.PlayScala)
- .settings(
- scalacOptions ++= scalaBuildOptions,
- sources in doc in Compile := List(),
- libraryDependencies ++= webDependencies ++ commonWebDependencies,
- resolvers += "Spy Repository" at "http://files.couchbase.com/maven2")
- .dependsOn(
- common % "test->test; compile->compile",
- db % "test->test; compile->compile")
- .aggregate(common, db)
- /*
- mappings in (Compile, packageBin) ~= { _.filterNot { case (_, name) =>
- Seq("application.conf", "anotherconfig").contains(name)
- }}*/
- /*mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
- {
- case x if "clever/common/.*".r.pattern.matcher(x).matches =>
- MergeStrategy.discard
- case x if "clever/db/.*".r.pattern.matcher(x).matches =>
- MergeStrategy.discard
- case x => old(x)
- }
- }*/
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement