forked from larousso/play-zio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
90 lines (77 loc) · 2.71 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
ThisBuild / organization := "com.example"
ThisBuild / version := "1.0-SNAPSHOT"
ThisBuild / scalacOptions ++= Seq(
"-Ymacro-annotations",
)
val V = new {
val distage = "0.10.19"
val zio = "1.0.3"
val catsEffect = "2.3.1"
val silencer = "1.7.1"
val betterMonadicFor = "0.3.1"
}
val Deps = new {
val distageFramework = "io.7mind.izumi" %% "distage-framework" % V.distage
val zio = "dev.zio" %% "zio" % V.zio
val catsEffect = "org.typelevel" %% "cats-effect" % V.catsEffect
val betterMonadicFor = "com.olegpy" %% "better-monadic-for" % V.betterMonadicFor
}
val commonSettings = Seq(
scalaVersion := "2.13.4",
)
lazy val `play-zio-distage` = (project in file("."))
.settings(commonSettings)
.aggregate(macros, server, client, sharedJvm, sharedJs)
// Adds additional packages into Twirl
//TwirlKeys.templateImports += "fr.adelegue.controllers._"
// Adds additional packages into conf/routes
// play.sbt.routes.RoutesKeys.routesImport += "fr.adelegue.binders._"
lazy val macros = project
.settings(
scalaVersion := "2.13.3",
libraryDependencies ++= Seq(
compilerPlugin("com.github.ghik" % "silencer-plugin" % V.silencer cross CrossVersion.full),
"com.github.ghik" % "silencer-lib" % V.silencer % Provided cross CrossVersion.full,
"org.scala-lang" % "scala-reflect" % scalaVersion.value % "provided",
"dev.zio" %% "zio-test-sbt" % V.zio % Test,
),
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework"),
scalacOptions += "-language:experimental.macros",
)
lazy val server = project
.enablePlugins(PlayScala)
.settings(commonSettings)
.settings(
scalaJSProjects := Seq(client),
pipelineStages in Assets := Seq(scalaJSPipeline),
pipelineStages := Seq(digest, gzip),
// triggers scalaJSPipeline when using compile or continuous compilation
compile in Compile := ((compile in Compile) dependsOn scalaJSPipeline).value,
libraryDependencies ++= Seq(
Deps.distageFramework,
Deps.zio,
Deps.catsEffect,
"org.iq80.leveldb" % "leveldb" % "0.12",
"com.vmunier" %% "scalajs-scripts" % "1.1.4",
),
addCompilerPlugin(Deps.betterMonadicFor),
)
.dependsOn(sharedJvm, macros)
lazy val client = project
.enablePlugins(ScalaJSPlugin, ScalaJSWeb)
.settings(commonSettings)
.settings(
scalaJSUseMainModuleInitializer := true,
libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "1.1.0",
"dev.zio" %%% "zio" % V.zio,
),
)
.dependsOn(sharedJs)
lazy val shared = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("shared"))
.settings(commonSettings)
.jsConfigure(_.enablePlugins(ScalaJSWeb))
lazy val sharedJvm = shared.jvm
lazy val sharedJs = shared.js