Skip to content

Instantly share code, notes, and snippets.

@steveturner
Created February 5, 2014 23:35
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 steveturner/8835639 to your computer and use it in GitHub Desktop.
Save steveturner/8835639 to your computer and use it in GitHub Desktop.
build.scala sample
import sbt._
import Keys._
import play.Project._
object ApplicationBuild extends Build {
val hgbranch = "hg branch".!!.trim
val branch = if (hgbranch == "default") {
"RELEASE"
} else {
"SNAPSHOT"
}
val computedVersion = if (branch == "RELEASE") {
"hg log -r . --template {latesttag}".!!.trim
} else {
"0.0.1"
}
val appVersion = "%s-%s".format(version, branch)
val commonDependencies = Seq(
// Add your project dependencies here,
javaCore,
javaJdbc,
javaEbean,
jdbc,
anorm,
cache,
"com.wordnik" % "swagger-play2_2.10" % "1.3.1",
("com.wordnik" % "swagger-play2-utils_2.10" % "1.3.1").excludeAll(ExclusionRule(organization = "org.slf4j"))
)
val adminDependencies = Seq() // You can have service specific dependencies
val webDependencies = Seq()
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")
val common = play.Project("common", appVersion, commonDependencies, path = file("modules/common")).settings(
// Add common settings here
scalacOptions ++= scalaBuildOptions,
sources in doc in Compile := List(),
javaOptions in Test += "-Dconfig.resource=common-application.conf"
)
val admin = play.Project("admin", appVersion, commonDependencies ++ adminDependencies, path = file("modules/admin")).settings(
// Add admin settings here
scalacOptions ++= scalaBuildOptions,
sources in doc in Compile := List(),
javaOptions in Test += "-Dconfig.resource=admin-application.conf"
).dependsOn(common % "test->test;compile->compile").aggregate(common)
val web = play.Project("web", appVersion, commonDependencies ++ webDependencies, path = file("modules/web")).settings(
// Add web settings here
scalacOptions ++= scalaBuildOptions,
sources in doc in Compile := List(),
javaOptions in Test += "-Dconfig.resource=web-application.conf"
).dependsOn(common % "test->test;compile->compile").aggregate(common)
// The default SBT project is based on the first project alphabetically. To force sbt to use this one,
// we prefit it with 'aaa'
val aaaMultiProject = play.Project("server", appVersion, commonDependencies ++ adminDependencies ++ webDependencies).settings(
// This project runs both services together, which is mostly useful in development mode.
scalacOptions ++= scalaBuildOptions,
sources in doc in Compile := List()
).dependsOn(common % "test->test;compile->compile", admin % "test->test;compile->compile", web % "test->test;compile->compile").aggregate(common, admin, web)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment