-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.sbt
112 lines (105 loc) · 3.53 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import Dependencies._
import Helpers._
import play.sbt.routes.RoutesKeys
import sbtbuildinfo.BuildInfoKeys.buildInfoKeys
import scala.sys.process._
inThisBuild(
List(
semanticdbEnabled := true,
semanticdbOptions += "-P:semanticdb:synthetics:on",
semanticdbVersion := scalafixSemanticdb.revision,
scalafixScalaBinaryVersion := "2.13",
scalafixDependencies += "org.scala-lang" %% "scala-rewrites" % "0.1.5"
)
)
val commonSettings = Seq(
organization := "com.gu",
scalaVersion := "2.13.14",
scalacOptions ++= Seq(
"-feature",
"-language:postfixOps,reflectiveCalls,implicitConversions",
"-Wconf:cat=other-match-analysis:error"
// , "-Xfatal-warnings" TODO: Akka Agents have been deprecated. Once they have been replaced we can re-enable, but that's not trivial
),
Compile / doc / scalacOptions ++= Seq(
"-no-link-warnings" // Suppresses problems with Scaladoc @throws links
),
version := "1.0"
)
lazy val root = project
.in(file("."))
.aggregate(lib, riffraff)
.settings(
name := "riff-raff"
)
lazy val lib = project
.in(file("magenta-lib"))
.settings(commonSettings)
.settings(
Seq(
libraryDependencies ++= magentaLibDeps,
Test / testOptions += Tests.Argument("-oF")
)
)
def env(propName: String): String =
sys.env.get(propName).filter(_.trim.nonEmpty).getOrElse("DEV")
lazy val riffraff = project
.in(file("riff-raff"))
.dependsOn(lib % "compile->compile;test->test")
.enablePlugins(PlayScala, SbtWeb, BuildInfoPlugin)
.settings(commonSettings)
.settings(
Seq(
name := "riff-raff",
TwirlKeys.templateImports ++= Seq(
"magenta._",
"deployment._",
"controllers._",
"views.html.helper.magenta._",
"com.gu.googleauth.AuthenticatedRequest"
),
RoutesKeys.routesImport += "utils.PathBindables._",
buildInfoKeys := Seq[BuildInfoKey](
name,
version,
scalaVersion,
sbtVersion,
// These env vars are set by GitHub Actions
// See https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
"gitCommitId" -> env("GITHUB_SHA"),
"buildNumber" -> env("BUILD_NUMBER")
),
buildInfoOptions += BuildInfoOption.BuildTime,
buildInfoPackage := "riffraff",
libraryDependencies ++= riffRaffDeps,
Universal / javaOptions ++= Seq(
s"-Dpidfile.path=/dev/null",
"-J-XX:MaxRAMFraction=2",
"-J-XX:InitialRAMFraction=2",
"-J-XX:MaxMetaspaceSize=300m",
"-J-Xlog:gc*",
s"-J-Xlog:gc:/var/log/${packageName.value}/gc.log"
),
Universal / packageName := normalizedName.value,
Universal / topLevelDirectory := Some(normalizedName.value),
ivyXML := {
<dependencies>
<exclude org="commons-logging"><!-- Conflicts with acl-over-slf4j in Play. --> </exclude>
<exclude org="oauth.signpost"><!-- Conflicts with play-googleauth--></exclude>
<exclude org="org.springframework"><!-- Because I don't like it. --></exclude>
<exclude org="xpp3"></exclude>
</dependencies>
},
Test / fork := false,
Test / testOptions += Tests.Setup(_ => {
println(s"Starting Docker containers for tests")
"docker compose up -d".!
}),
Test / testOptions += Tests.Cleanup(_ => {
println(s"Stopping Docker containers for tests")
"docker compose rm --stop --force".!
}),
Assets / LessKeys.less / includeFilter := "*.less",
Assets / pipelineStages := Seq(digest)
)
)