-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sbt
217 lines (194 loc) · 5.79 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
import Libs._
import org.openqa.selenium.chrome.ChromeOptions
import org.scalajs.jsenv.selenium.SeleniumJSEnv
import sbtcrossproject.CrossPlugin.autoImport.{CrossType, crossProject}
inThisBuild(
Seq(
scalaVersion := "2.13.8",
// jitpack provides the env variable VERSION=<version being built> # A tag or commit
// we make use of it so that the version in class metadata (this.getClass.getPackage.getSpecificationVersion)
// and the maven repo match
version := sys.env.getOrElse("JITPACK_VERSION", "0.1.0-SNAPSHOT"),
organization := "com.github.tmtsoftware.msocket",
organizationName := "ThoughtWorks",
scalafmtOnCompile := true,
resolvers += "jitpack" at "https://jitpack.io",
scalacOptions ++= Seq(
"-encoding",
"UTF-8",
"-feature",
"-unchecked",
"-deprecation",
"-Xasync",
"-Wconf:any:warning-verbose",
"-Wdead-code",
"-Xlint:_,-missing-interpolator",
"-Xsource:3",
"-Xcheckinit"
)
)
)
lazy val `msocket-root` = project
.in(file("."))
.aggregate(
`portable`,
`msocket`,
`example`
)
//************* portable-api *****************************************************
lazy val portable = project.aggregate(
`portable-observer`.jvm,
`portable-observer`.js,
`portable-akka`.jvm,
`portable-akka`.js
)
lazy val `portable-observer` = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("portable/portable-observer"))
lazy val `portable-akka` = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Dummy)
.in(file("portable/portable-akka"))
.dependsOn(`portable-observer`)
.jvmSettings(
libraryDependencies ++= Seq(
`akka-stream`,
`akka-actor-typed`
)
)
//************* msocket *****************************************************
lazy val msocket = project.aggregate(
`msocket-api`.jvm,
`msocket-api`.js,
`msocket-security`,
`msocket-jvm`,
`msocket-http`,
`msocket-rsocket`,
`msocket-js`
)
lazy val `msocket-security` = project
.in(file("msocket/msocket-security"))
.settings(
libraryDependencies ++= Seq(
`borer-core`.value,
`borer-derivation`.value
)
)
lazy val `msocket-api` = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("msocket/msocket-api"))
.dependsOn(`portable-akka`)
.settings(
libraryDependencies ++= Seq(
`borer-core`.value,
`borer-derivation`.value
)
)
lazy val `msocket-jvm` = project
.in(file("msocket/msocket-jvm"))
.dependsOn(`msocket-api`.jvm, `msocket-security`)
.settings(
libraryDependencies ++= Seq(
Prometheus.simpleclient,
Prometheus.simpleclient_common,
scalatest.value % Test
)
)
lazy val `msocket-http` = project
.in(file("msocket/msocket-http"))
.dependsOn(`msocket-jvm`)
.settings(
libraryDependencies ++= Seq(
`akka-http`,
`borer-compat-akka`,
scalatest.value % Test,
`akka-actor-testkit-typed` % Test,
`akka-http-testkit` % Test
)
)
lazy val `msocket-rsocket` = project
.in(file("msocket/msocket-rsocket"))
.dependsOn(`msocket-jvm`)
.settings(
libraryDependencies ++= Seq(
`rsocket-transport-netty`,
`rsocket-core`
)
)
lazy val `msocket-js` = project
.in(file("msocket/msocket-js"))
.enablePlugins(ScalaJSPlugin)
.dependsOn(`msocket-api`.js)
.settings(
libraryDependencies ++= Seq(
`tmt-typed`.value,
`scalajs-dom`.value
)
)
//************* example-service *****************************************************
lazy val `example` = project.aggregate(
`example-service-api`.jvm,
`example-service-api`.js,
`example-service`,
`example-server`,
`example-client-jvm`,
`example-client-js`,
`example-client-jvm-test`
)
lazy val `example-service-api` = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("example/example-service-api"))
.dependsOn(`msocket-api`)
lazy val `example-service` = project
.in(file("example/example-service"))
.dependsOn(`example-service-api`.jvm, `msocket-jvm`)
lazy val `example-server` = project
.in(file("example/example-server"))
.dependsOn(`example-service`, `msocket-http`, `msocket-rsocket`)
.settings(
libraryDependencies ++= Seq(
`akka-http-cors`,
scalatest.value % Test,
`akka-http-testkit` % Test,
`akka-stream-testkit` % Test
)
)
lazy val `example-client-jvm` = project
.in(file("example/example-client-jvm"))
.dependsOn(`example-service-api`.jvm, `msocket-http`, `msocket-rsocket`)
lazy val `example-client-jvm-test` = project
.in(file("example/example-client-jvm-test"))
.dependsOn(`example-server`, `example-client-jvm`)
.settings(
libraryDependencies ++= Seq(
`akka-stream-testkit` % Test,
scalatest.value % Test
)
)
lazy val `example-client-js` = project
.in(file("example/example-client-js"))
.enablePlugins(ScalaJSPlugin)
.dependsOn(`example-service-api`.js, `msocket-js`)
.settings(
scalaJSUseMainModuleInitializer := true,
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.ESModule).withSourceMap(false) },
Test / jsEnv := {
new SeleniumJSEnv(
new ChromeOptions().setHeadless(true),
seleniumConfig(3000, baseDirectory.value.getAbsolutePath)
)
},
libraryDependencies ++= Seq(
scalatest.value % Test,
`scala-async`.value
)
)
def seleniumConfig(port: Int, base: String): SeleniumJSEnv.Config = {
import _root_.io.github.bonigarcia.wdm.WebDriverManager
// WebDriverManager.chromedriver().setup()
val contentDirName = "target/selenium"
val webRoot = s"http://localhost:$port/$contentDirName/"
val contentDir = s"$base/$contentDirName"
SeleniumJSEnv
.Config()
.withMaterializeInServer(contentDir, webRoot)
}