Created
February 5, 2014 23:35
-
-
Save steveturner/8835639 to your computer and use it in GitHub Desktop.
build.scala sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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