forked from walfie/gbf-raidfinder
-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sbt
143 lines (127 loc) · 5.16 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
// TODO: Put all dependencies in a Dependencies.scala file with versions
lazy val commonSettings = Seq(
scalaVersion := "2.11.8",
organization := "com.github.walfie",
scalacOptions ++= Seq("-deprecation", "-feature", "-unchecked", "-Xlint"),
// Disable publishing of {java,scala}doc
publishArtifact in (Compile, packageDoc) := false,
publishArtifact in packageDoc := false,
sources in (Compile, doc) := Seq.empty,
Scalariform.settings
)
lazy val buildInfo = (crossProject.crossType(CrossType.Pure) in file(".build-info"))
.enablePlugins(ScalaJSPlugin, BuildInfoPlugin)
.settings(commonSettings: _*)
.settings(
buildInfoPackage := "walfie.gbf.raidfinder",
buildInfoKeys := Seq[BuildInfoKey](version, git.gitHeadCommit)
)
lazy val buildInfoJVM = buildInfo.jvm
lazy val buildInfoJS = buildInfo.js
lazy val stream = (project in file("stream"))
.settings(commonSettings: _*)
.settings(
name := "gbf-raidfinder-stream",
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-agent" % Versions.Akka,
"io.monix" %% "monix" % Versions.Monix,
"org.twitter4j" % "twitter4j-stream" % Versions.Twitter4j,
"org.scalatest" %% "scalatest" % Versions.ScalaTest % "test",
"org.mockito" % "mockito-all" % Versions.Mockito % "test"
)
)
lazy val protocol = (crossProject in file("protocol"))
.settings(name := "gbf-raidfinder-protocol")
.enablePlugins(ScalaJSPlugin)
.settings(commonSettings: _*)
.settings(ScalaPB.settings: _*)
lazy val protocolJVM = protocol.jvm
lazy val protocolJS = protocol.js
lazy val server = (project in file("server"))
.settings(commonSettings: _*)
.settings(Defaults.itSettings: _*)
.configs(IntegrationTest)
.settings(
name := "gbf-raidfinder-server",
resolvers += Resolver.jcenterRepo, // for ficus
libraryDependencies ++= Seq(
"com.iheart" %% "ficus" % "1.2.6",
"com.trueaccord.scalapb" %% "scalapb-json4s" % Versions.ScalaPB_json4s,
"com.typesafe.play" %% "filters-helpers" % Versions.Play,
"com.typesafe.play" %% "play-logback" % Versions.Play,
"com.typesafe.play" %% "play-netty-server" % Versions.Play,
"org.scalatest" %% "scalatest" % Versions.ScalaTest % "it,test",
"redis.clients" % "jedis" % "2.8.1"
)
)
.dependsOn(stream, protocolJVM, buildInfoJVM)
val jsPath = settingKey[File]("Output directory for scala.js compiled files")
lazy val client = (project in file("client"))
.enablePlugins(ScalaJSPlugin)
.settings(commonSettings: _*)
.settings(
name := "gbf-raidfinder-client",
// Put output JS files in `target/scala_2.11/classes/public/js`
jsPath := crossTarget.value / "classes" / "public" / "js",
crossTarget in (Compile, fullOptJS) := jsPath.value,
crossTarget in (Compile, fastOptJS) := jsPath.value,
crossTarget in (Compile, packageJSDependencies) := jsPath.value,
crossTarget in (Compile, packageScalaJSLauncher) := jsPath.value,
crossTarget in (Compile, packageMinifiedJSDependencies) := jsPath.value,
libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "0.9.1",
"com.thoughtworks.binding" %%% "dom" % "9.0.2",
"org.webjars.npm" % "moment" % Versions.MomentJS,
"org.webjars.bower" % "dialog-polyfill" % Versions.DialogPolyfillJS,
compilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)
),
jsDependencies ++= Seq(
"org.webjars.npm" % "moment" % Versions.MomentJS
/ s"${Versions.MomentJS}/moment.js"
minified "min/moment.min.js",
"org.webjars.bower" % "dialog-polyfill" % Versions.DialogPolyfillJS
/ s"${Versions.DialogPolyfillJS}/dialog-polyfill.js"
)
)
.dependsOn(protocolJS, buildInfoJS)
lazy val herokuSettings = Seq(
herokuAppName in Compile := "gbf-raidfinder",
herokuSkipSubProjects in Compile := false,
herokuProcessTypes in Compile := Map(
"web" -> Seq(
s"target/universal/stage/bin/${name.value}",
"-Dhttp.port=$PORT",
"-Dapplication.cache.redisUrl=$REDISCLOUD_URL",
"-Dapplication.mode=prod"
).mkString(" ")
)
)
val jsFast = fastOptJS.in(client, Compile)
val jsFull = fullOptJS.in(client, Compile)
val jsAll = Seq(jsFast, jsFull)
lazy val dockerSettings = Seq(
packageName in Docker := name.value,
dockerRepository := Some("walfie"),
dockerExposedPorts := Seq(9000),
dockerEntrypoint := Seq(
s"bin/${executableScriptName.value}",
"-Dapplication.mode=prod",
s"-Dhttp.port=${dockerExposedPorts.value.head}"
),
dockerBaseImage := "anapsix/alpine-java:8_server-jre",
dockerUpdateLatest := true,
stage in Docker := stage.in(Docker).dependsOn(jsAll: _*).value
)
// TODO: Running `test` on the root project doesn't test `stream` project
lazy val root = (project in file("."))
.enablePlugins(JavaServerAppPackaging, DockerPlugin)
.dependsOn(server, client)
.settings((commonSettings ++ herokuSettings ++ dockerSettings): _*)
.settings(
name := "gbf-raidfinder",
publish := (),
releaseProcess -= ReleaseTransformations.publishArtifacts,
mainClass in Compile := Some("walfie.gbf.raidfinder.server.Application"),
run in Compile := run.in(Compile).dependsOn(jsFast).evaluated,
stage := stage.dependsOn(jsAll: _*).value
)