-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
175 lines (160 loc) · 6.24 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
import sbt.Project.projectToRef
lazy val scalaV = "2.11.8"
lazy val globalSettings = Seq(
addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.7.1")
, addCompilerPlugin("com.milessabin" % "si2712fix-plugin_2.11.8" % "1.1.0")
, addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)
, resolvers ++= Seq(
Resolver.sonatypeRepo("releases")
, Resolver.sonatypeRepo("snapshots")
)
)
val importStaticData = taskKey[Unit]("Import the static data from postgres-latest.dmp")
val eveapiVersion = "0.1-SNAPSHOT"
val doobieVersion = "0.3.0"
scalaVersion in ThisBuild := scalaV
lazy val server: Project = (project in file("server")).settings(
fork := true,
scalaVersion := scalaV,
pipelineStages := Seq(gzip),
resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases",
libraryDependencies ++= Seq(
"io.verizon.knobs" %% "core" % "3.11.26a"
, "org.scalaz" %% "scalaz-core" % "7.2.2"
, "org.scalaz" %% "scalaz-concurrent" % "7.2.2"
, "commons-codec" % "commons-codec" % "1.10"
, "ch.qos.logback" % "logback-classic" % "1.1.7"
, "org.scalacheck" %% "scalacheck" % "1.13.0" % Test
, "org.reactormonk" %% "counter" % "1.3.3"
, "org.typelevel" %% "shapeless-scalaz" % "0.4"
, "org.flywaydb" % "flyway-core" % "4.0.1"
, "org.reactormonk" %% "cryptobits" % "1.1"
, "com.github.alexarchambault" %% "scalacheck-shapeless_1.13" % "1.1.3"
, "org.specs2" %% "specs2-scalacheck" % "3.8.6"
) ++ Seq(
"org.http4s" %% "http4s-core"
, "org.http4s" %% "http4s-dsl"
, "org.http4s" %% "http4s-blaze-server"
, "org.http4s" %% "http4s-blaze-client"
).map(_ % "0.14.11a") ++ Seq(
"org.tpolecat" %% "doobie-core"
, "org.tpolecat" %% "doobie-contrib-postgresql"
, "org.tpolecat" %% "doobie-contrib-specs2"
).map(_ % doobieVersion) ++ Seq(
"eveapi" %% "blazeargonautapi"
, "eveapi" %% "compress"
).map(_ % eveapiVersion)
)
.dependsOn(sharedJvm)
.settings(globalSettings: _*)
.settings(
(managedResources in Compile) ++= Seq(
(compileElm in client).value
, (compileCss in client).value
, file("client/semantic/dist/semantic.min.css")
, file("client/semantic/dist/semantic.min.js")
, file("client/index.html")
, file("client/sample.html")
)
, (unmanagedResourceDirectories in Compile) += file("client/resources")
)
.enablePlugins(JavaServerAppPackaging, DebianPlugin, SystemdPlugin)
.settings(
daemonUser in Linux := "fleetbuddy"
, name in Linux := "fleetbuddy"
, packageName in Linux := "fleetbuddy"
, maintainer in Linux := "Simon Hafner <[email protected]>"
, packageSummary in Linux := "Fleetbuddy. Your friendly fleet helper."
, executableScriptName := "fleetbuddy"
, javaOptions in Universal ++= Seq(
"-J-Xmx950M"
, "-Dconfigfile=/etc/fleetbuddy/application.conf"
)
, debianPackageDependencies in Debian ++= Seq(
"openjdk-8-jre"
, "postgresql"
, "pwgen"
, "debsums"
)
, maintainerScripts in Debian := {
val scripts = (maintainerScripts in Debian).value
scripts + ("postinst" -> IO.readLines(sourceDirectory.value / "debian" / "DEBIAN" / "postinst"))
}
)
.settings(
flywayClean := flywayClean in flyway
, flywayMigrate := flywayMigrate in flyway
, test := Def.sequential(flywayMigrate in (flyway, Test), test in Test).value
)
.enablePlugins(BuildInfoPlugin)
.settings(
buildInfoKeys := Seq[BuildInfoKey](flywayUrl, flywayDriver, flywayUser, flywayPassword)
, buildInfoPackage := "buildInfo"
)
.settings(ApplicationConf.settings: _*)
.settings((unmanagedResourceDirectories in Compile) += (resourceDirectory in (flyway, Compile)).value)
.settings(
mainClass in Compile := Some("controllers.Loader")
)
.settings(
importStaticData in Test := {
runner.value.run(s"StaticDataFromSbt", Attributed.data((fullClasspath in Compile).value), Seq("postgres-latest.dmp", "test"), streams.value.log)
},
importStaticData := {
runner.value.run(s"StaticDataFromSbt", Attributed.data((fullClasspath in Compile).value), Seq("postgres-latest.dmp"), streams.value.log)
}
)
lazy val shared = (crossProject.crossType(CrossType.Pure) in file("shared"))
.settings(
scalaVersion := scalaV,
libraryDependencies ++= Seq(
"eveapi" %% "compress" % eveapiVersion,
"org.reactormonk" %% "elmtypes" % "0.2"
)
)
.settings(globalSettings: _*)
lazy val flyway = (project in file("."))
.settings(
flywayUrl in Test := { flywayUrl.value + "test" }
, flywayDriver in Test := flywayDriver.value
, flywayUser in Test := flywayUser.value
, flywayPassword in Test := flywayPassword.value
, scalaVersion := scalaV
, libraryDependencies += "org.tpolecat" %% "doobie-contrib-postgresql" % doobieVersion
, flywayBaselineOnMigrate := true
, flywayBaselineVersion := "0"
, flywayBaselineOnMigrate in Test := true
, flywayBaselineVersion in Test := "0"
)
.settings(ApplicationConf.settings: _*)
lazy val sharedJvm = shared.jvm
lazy val sharedJs = shared.js
onLoad in Global := (Command.process("project server", _: State)) compose (onLoad in Global).value
lazy val client = project in file("client")
val compileElm = taskKey[File]("Compile the elm into a elm.css")
(compileElm in client) := {
val codec = (baseDirectory in client).value / "Codec.elm"
(runner in (sharedJvm, run)).value.run("ElmTypes", Attributed.data((fullClasspath in sharedJvm in Compile).value), Seq(codec.toString), streams.value.log)
if (Process("elm-make Main.elm --yes --output=elm.js", file("client")).! != 0) {throw new Exception("elm build failed!")}
(baseDirectory in client).value / "elm.js"
}
val compileCss = taskKey[File]("Compile the elm into an styles.css")
(compileCss in client) := {
if (Process("node_modules/.bin/elm-css Stylesheets.elm", file("client")).! != 0) {throw new Exception("elm build failed!")}
(baseDirectory in client).value / "styles.css"
}
scalacOptions in ThisBuild ++= Seq(
"-deprecation",
"-feature",
"-unchecked",
"-Xlint",
"-Ywarn-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-inaccessible",
"-Ywarn-nullary-override",
"-Ywarn-numeric-widen",
"-language:implicitConversions",
"-language:higherKinds",
"-language:existentials",
"-encoding", "utf8"
)