-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
76 lines (70 loc) · 2.49 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
Global / name := "Shapes"
Global / organization := "cz.matejcerny"
Global / scalaVersion := "2.13.2"
lazy val client = project
.in(file("client"))
.enablePlugins(ScalaJSPlugin)
.settings(
name := "Shapes.Client",
scalaJSLinkerConfig ~= { _.withOptimizer(false).withClosureCompilerIfAvailable(false) }
)
.dependsOn(sharedJS)
lazy val server = project
.in(file("server"))
.settings(
name := "Shapes.Server",
// allows to read the generated JS on client
(resources in Compile) += {
(fastOptJS in (client, Compile)).value
(fastOptJS in (client, Compile)).value.data
(artifactPath in (client, Compile, fastOptJS)).value
},
// lets the backend to read the .map file for js
resources in Compile += (fastOptJS in (client, Compile)).value
.map((x: sbt.File) => new File(x.getAbsolutePath + ".map"))
.data,
// do a fastOptJS on reStart
reStart := (reStart dependsOn (fastOptJS in (client, Compile))).evaluated,
mainClass in reStart := Some("Server"),
// makes reStart to rebuild if a scala.js file changes on the client
watchSources ++= (watchSources in client).value,
libraryDependencies ++=
Dependencies.Cats ++
Dependencies.Http4s ++
Dependencies.Logging
)
.dependsOn(sharedJVM)
lazy val shared = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("shared"))
.settings(
name := "Shapes.Shared",
libraryDependencies ++= Seq(
Dependencies.CirceCore.value,
Dependencies.CirceGeneric.value,
Dependencies.CirceParser.value,
Dependencies.ScalaTags.value,
Dependencies.ScalaTest.value
)
)
lazy val sharedJVM = shared.jvm
lazy val sharedJS = shared.js
lazy val assemblySettings = Seq(
assembly / assemblyJarName := s"${name.value}.jar",
assembly / test := {},
assembly / assemblyMergeStrategy := {
case PathList("META-INF", _ @_*) => MergeStrategy.discard
case x =>
val oldStrategy = (assembly / assemblyMergeStrategy).value
oldStrategy(x)
}
)
ThisBuild / scalacOptions ++= Seq(
"-deprecation", // Emit warning and location for usages of deprecated APIs.
"-encoding",
"utf-8", // Specify character encoding used by source files.
"-explaintypes", // Explain type errors in more detail.
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
"-language:higherKinds", // Allow higher-kinded types
"-Ywarn-unused:imports" // Warn if an import selector is not referenced.
)