-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.sbt
121 lines (113 loc) · 4.32 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
organization in ThisBuild := "com.github.benfradet"
lazy val baseSettings = Seq(
scalacOptions in (Compile, console) ~= {
_.filterNot(Set("-Ywarn-unused-import"))
},
scalacOptions in (Test, console) ~= {
_.filterNot(Set("-Ywarn-unused-import"))
},
scalaVersion := "2.12.8",
version := "0.1.0-SNAPSHOT"
)
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
lazy val shared = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("shared"))
.settings(baseSettings)
lazy val sharedJVM = shared.jvm.settings(name := "sharedJVM")
lazy val sharedJS = shared.js.settings(name := "sharedJS")
lazy val scalajsDomVersion = "0.9.8"
lazy val scalajsReactVersion = "1.4.2"
lazy val reactVersion = "16.7.0"
lazy val chartjsVersion = "2.7.2"
lazy val client = project.in(file("client"))
.settings(baseSettings)
.settings(
name := "client",
scalaJSUseMainModuleInitializer := true,
scalaJSUseMainModuleInitializer in Test := false,
skip in packageJSDependencies := false,
scalacOptions in (Compile) ~= {
_.filterNot(Set("-Xfatal-warnings"))
},
libraryDependencies ++= Seq(
"com.github.japgolly.scalajs-react" %%% "core",
"com.github.japgolly.scalajs-react" %%% "extra"
).map(_ % scalajsReactVersion) :+
"org.scala-js" %%% "scalajs-dom" % scalajsDomVersion,
jsDependencies ++= Seq(
"org.webjars.npm" % "js-tokens" % "4.0.0" / "META-INF/resources/webjars/js-tokens/4.0.0/index.js",
"org.webjars.npm" % "react" % reactVersion
/ "umd/react.development.js"
minified "umd/react.production.min.js"
commonJSName "React",
"org.webjars.npm" % "react-dom" % reactVersion
/ "umd/react-dom.development.js"
minified "umd/react-dom.production.min.js"
dependsOn "umd/react.development.js"
commonJSName "ReactDOM",
"org.webjars.npm" % "react-dom" % reactVersion
/ "umd/react-dom-server.browser.development.js"
minified "umd/react-dom-server.browser.production.min.js"
dependsOn "umd/react-dom.development.js"
commonJSName "ReactDOMServer",
"org.webjars" % "chartjs" % chartjsVersion
/ "Chart.js"
minified "Chart.min.js"
)
)
.enablePlugins(ScalaJSPlugin)
.dependsOn(sharedJS)
import com.typesafe.sbt.packager.docker._
dockerBaseImage := "openjdk:8u171-jre-alpine"
dockerExposedPorts := Seq(8080)
dockerExposedVolumes := Seq("/dashing/config")
maintainer in Docker := "Ben Fradet <https://github.com/BenFradet>"
lazy val http4sVersion = "0.20.15"
lazy val circeVersion = "0.12.3"
lazy val circeConfigVersion = "0.7.0"
lazy val scalatagsVersion = "0.8.1"
lazy val mulesVersion = "0.2.1"
lazy val logbackVersion = "1.2.3"
lazy val specs2Version = "4.8.1"
lazy val catsVersion = "2.0.0"
lazy val catsEffectVersion = "2.0.0"
lazy val server = project.in(file("server"))
.settings(baseSettings)
.settings(
name := "server",
libraryDependencies ++= Seq(
"org.http4s" %% "http4s-dsl",
"org.http4s" %% "http4s-blaze-server",
"org.http4s" %% "http4s-blaze-client",
"org.http4s" %% "http4s-circe",
).map(_ % http4sVersion) ++ Seq(
"io.circe" %% "circe-core",
"io.circe" %% "circe-generic",
).map(_ % circeVersion) ++ Seq(
"org.typelevel" %% "cats-effect" % catsEffectVersion,
"com.lihaoyi" %% "scalatags" % scalatagsVersion,
"io.circe" %% "circe-config" % circeConfigVersion,
"io.chrisdavenport" %% "mules" % mulesVersion,
"ch.qos.logback" % "logback-classic" % logbackVersion,
) ++ (Seq(
"org.specs2" %% "specs2-core",
"org.specs2" %% "specs2-scalacheck",
).map(_ % specs2Version) ++ Seq(
"org.http4s" %% "http4s-testing" % http4sVersion,
"org.typelevel" %% "cats-laws" % catsVersion,
)).map(_ % Test)
)
.settings(
// lets us access client-fastopt.js
resources in Compile += (fastOptJS in (client, Compile)).value.data,
// lets us access client-fastopt.js.map
resources in Compile += (fastOptJS in (client, Compile)).value
.map((f: File) => new File(f.getAbsolutePath + ".map"))
.data,
// lets us access client-jsdeps.js
(managedResources in Compile) +=
(artifactPath in (client, Compile, packageJSDependencies)).value
)
.enablePlugins(JavaServerAppPackaging)
.dependsOn(sharedJVM)