-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.sbt
305 lines (278 loc) · 10.6 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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
val CreateReactClassVersion = "^15.5.1"
val HistoryVersion = "^4.6.1"
val ReactVersion = "^15.5.3"
val ReactReduxVersion = "^5.0.3"
val ReactRouterVersion = "^4.0.0"
val ReactRouterReduxVersion = "next"
val ReduxVersion = "^3.6.0"
val ReduxDevToolsVersion = "^2.13.0"
val WebpackVersion = "^2.3.2"
val StaticTagsVersion = "[2.4.0,3.0.0["
val JettyVersion = "9.+"
val SeleniumVersion = "[3.4.0,4.0.0["
val ScalaTestVersion = "[3.1.0,4.0.0["
crossScalaVersions := Seq("2.12.2")
publishTo := {
val nexus = "https://oss.sonatype.org/"
isSnapshot.value match {
case true => Some("snapshots" at nexus + "content/repositories/snapshots")
case false => Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
}
publishArtifact := false
val commonSettings = Seq(
organization := "io.github.shogowada",
name := "scalajs-reactjs",
version := "0.14.0",
licenses := Seq("MIT" -> url("https://opensource.org/licenses/MIT")),
homepage := Some(url("https://github.com/shogowada/scalajs-reactjs")),
scalaVersion := "2.12.2",
ivyScala := ivyScala.value.map {
_.copy(overrideScalaVersion = true)
},
publishMavenStyle := true,
publishTo := {
val nexus = "https://oss.sonatype.org/"
isSnapshot.value match {
case true => Some("snapshots" at nexus + "content/repositories/snapshots")
case false => Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
},
publishArtifact := false,
pomExtra := <scm>
<url>git@github.com:shogowada/scalajs-reactjs.git</url>
<connection>scm:git:git@github.com:shogowada/scalajs-reactjs.git</connection>
</scm>
<developers>
<developer>
<id>shogowada</id>
<name>Shogo Wada</name>
<url>https://github.com/shogowada</url>
</developer>
</developers>
)
lazy val core = project.in(file("core"))
.settings(commonSettings: _*)
.settings(
libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "0.9.+",
"io.github.shogowada" %%% "statictags" % StaticTagsVersion
),
npmDependencies in Compile ++= Seq(
"create-react-class" -> CreateReactClassVersion,
"react" -> ReactVersion,
"react-dom" -> ReactVersion
),
(version in webpack) := WebpackVersion,
(webpack in(Compile, fastOptJS)) := Seq(),
(webpack in(Compile, fullOptJS)) := Seq(),
publishArtifact := true
)
.enablePlugins(ScalaJSPlugin, ScalaJSBundlerPlugin)
lazy val history = project.in(file("history"))
.settings(commonSettings: _*)
.settings(
name := "scalajs-history",
npmDependencies in Compile ++= Seq(
"history" -> HistoryVersion
),
(webpack in(Compile, fastOptJS)) := Seq(),
(webpack in(Compile, fullOptJS)) := Seq(),
publishArtifact := true
)
.enablePlugins(ScalaJSPlugin, ScalaJSBundlerPlugin)
lazy val router = project.in(file("router"))
.settings(commonSettings: _*)
.settings(
name += "-router",
npmDependencies in Compile ++= Seq(
"react-router" -> ReactRouterVersion
),
(webpack in(Compile, fastOptJS)) := Seq(),
(webpack in(Compile, fullOptJS)) := Seq(),
publishArtifact := true
)
.enablePlugins(ScalaJSPlugin, ScalaJSBundlerPlugin)
.dependsOn(core, history)
lazy val routerDom = project.in(file("router-dom"))
.settings(commonSettings: _*)
.settings(
name += "-router-dom",
npmDependencies in Compile ++= Seq(
"react-router-dom" -> ReactRouterVersion
),
(webpack in(Compile, fastOptJS)) := Seq(),
(webpack in(Compile, fullOptJS)) := Seq(),
publishArtifact := true
)
.enablePlugins(ScalaJSPlugin, ScalaJSBundlerPlugin)
.dependsOn(core, router)
lazy val redux = project.in(file("redux"))
.settings(commonSettings: _*)
.settings(
name += "-redux",
npmDependencies in Compile ++= Seq(
"react-redux" -> ReactReduxVersion,
"redux" -> ReduxVersion
),
(webpack in(Compile, fastOptJS)) := Seq(),
(webpack in(Compile, fullOptJS)) := Seq(),
publishArtifact := true
)
.enablePlugins(ScalaJSPlugin, ScalaJSBundlerPlugin)
.dependsOn(core)
lazy val reduxDevTools = project.in(file("redux-devtools"))
.settings(commonSettings: _*)
.settings(
name += "-redux-devtools",
npmDependencies in Compile ++= Seq(
"redux-devtools-extension" -> ReduxDevToolsVersion
),
(webpack in(Compile, fastOptJS)) := Seq(),
(webpack in(Compile, fullOptJS)) := Seq(),
publishArtifact := true
)
.enablePlugins(ScalaJSPlugin, ScalaJSBundlerPlugin)
.dependsOn(core, redux)
lazy val routerRedux = project.in(file("router-redux"))
.settings(commonSettings: _*)
.settings(
name += "-router-redux",
npmDependencies in Compile ++= Seq(
"react-router-redux" -> ReactRouterReduxVersion
),
(webpack in(Compile, fastOptJS)) := Seq(),
(webpack in(Compile, fullOptJS)) := Seq(),
publishArtifact := true
)
.enablePlugins(ScalaJSPlugin, ScalaJSBundlerPlugin)
.dependsOn(core, history, router, redux)
val exampleCommonSettings = commonSettings ++ Seq(
name += "-example",
(unmanagedResourceDirectories in Compile) += baseDirectory.value / "src" / "main" / "webapp"
)
lazy val exampleCustomVirtualDOM = project.in(file("example") / "custom-virtual-dom")
.settings(exampleCommonSettings: _*)
.settings(
name += "-custom-virtual-dom"
)
.enablePlugins(ScalaJSPlugin, ScalaJSBundlerPlugin)
.dependsOn(core)
lazy val exampleHelloWorld = project.in(file("example") / "helloworld")
.settings(exampleCommonSettings: _*)
.settings(
name += "-helloworld"
)
.enablePlugins(ScalaJSPlugin, ScalaJSBundlerPlugin)
.dependsOn(core)
lazy val exampleHelloWorldFunction = project.in(file("example") / "helloworld-function")
.settings(exampleCommonSettings: _*)
.settings(
name += "-helloworld-function"
)
.enablePlugins(ScalaJSPlugin, ScalaJSBundlerPlugin)
.dependsOn(core)
lazy val exampleInteractiveHelloWorld = project.in(file("example") / "interactive-helloworld")
.settings(exampleCommonSettings: _*)
.settings(
name += "-interactive-helloworld"
)
.enablePlugins(ScalaJSPlugin, ScalaJSBundlerPlugin)
.dependsOn(core)
lazy val exampleLifecycle = project.in(file("example") / "lifecycle")
.settings(exampleCommonSettings: _*)
.settings(
name += "-lifecycle"
)
.enablePlugins(ScalaJSPlugin, ScalaJSBundlerPlugin)
.dependsOn(core)
lazy val exampleReduxDevTools = project.in(file("example") / "redux-devtools")
.settings(exampleCommonSettings: _*)
.settings(
name += "-redux-devtools"
)
.enablePlugins(ScalaJSPlugin, ScalaJSBundlerPlugin)
.dependsOn(core, redux, reduxDevTools)
lazy val exampleReduxMiddleware = project.in(file("example") / "redux-middleware")
.settings(exampleCommonSettings: _*)
.settings(
name += "-redux-middleware"
)
.enablePlugins(ScalaJSPlugin, ScalaJSBundlerPlugin)
.dependsOn(core, redux, reduxDevTools)
lazy val exampleRouter = project.in(file("example") / "router")
.settings(exampleCommonSettings: _*)
.settings(
name += "-router"
)
.enablePlugins(ScalaJSPlugin, ScalaJSBundlerPlugin)
.dependsOn(core, routerDom)
lazy val exampleRouterRedux = project.in(file("example") / "router-redux")
.settings(exampleCommonSettings: _*)
.settings(
name += "-router-redux"
)
.enablePlugins(ScalaJSPlugin, ScalaJSBundlerPlugin)
.dependsOn(core, redux, routerDom, routerRedux, reduxDevTools)
lazy val exampleStyle = project.in(file("example") / "style")
.settings(exampleCommonSettings: _*)
.settings(
name += "-style"
)
.enablePlugins(ScalaJSPlugin, ScalaJSBundlerPlugin)
.dependsOn(core)
lazy val exampleTodoApp = project.in(file("example") / "todo-app")
.settings(exampleCommonSettings: _*)
.settings(
name += "-todo-app"
)
.enablePlugins(ScalaJSPlugin, ScalaJSBundlerPlugin)
.dependsOn(core)
lazy val exampleTodoAppRedux = project.in(file("example") / "todo-app-redux")
.settings(exampleCommonSettings: _*)
.settings(
name += "-todo-app-redux"
)
.enablePlugins(ScalaJSPlugin, ScalaJSBundlerPlugin)
.dependsOn(core, redux)
lazy val exampleTest = project.in(file("example") / "test")
.configs(IntegrationTest)
.settings(commonSettings: _*)
.settings(Defaults.itSettings: _*)
.settings(
name += "-example-test",
libraryDependencies ++= Seq(
"org.eclipse.jetty" % "jetty-server" % JettyVersion,
"org.seleniumhq.selenium" % "selenium-java" % SeleniumVersion,
"org.scalatest" %% "scalatest" % ScalaTestVersion
),
javaOptions ++= Seq(
s"-Dtarget.path.custom-virtual-dom=${(crossTarget in exampleCustomVirtualDOM).value}",
s"-Dtarget.path.helloworld=${(crossTarget in exampleHelloWorld).value}",
s"-Dtarget.path.helloworld-function=${(crossTarget in exampleHelloWorldFunction).value}",
s"-Dtarget.path.interactive-helloworld=${(crossTarget in exampleInteractiveHelloWorld).value}",
s"-Dtarget.path.lifecycle=${(crossTarget in exampleLifecycle).value}",
s"-Dtarget.path.redux-devtools=${(crossTarget in exampleReduxDevTools).value}",
s"-Dtarget.path.redux-middleware=${(crossTarget in exampleReduxMiddleware).value}",
s"-Dtarget.path.router=${(crossTarget in exampleRouter).value}",
s"-Dtarget.path.router-redux=${(crossTarget in exampleRouterRedux).value}",
s"-Dtarget.path.style=${(crossTarget in exampleStyle).value}",
s"-Dtarget.path.todo-app=${(crossTarget in exampleTodoApp).value}",
s"-Dtarget.path.todo-app-redux=${(crossTarget in exampleTodoAppRedux).value}"
),
(test in IntegrationTest) := (test in IntegrationTest).dependsOn(
webpack in fastOptJS in Compile in exampleCustomVirtualDOM,
webpack in fastOptJS in Compile in exampleHelloWorld,
webpack in fastOptJS in Compile in exampleHelloWorldFunction,
webpack in fastOptJS in Compile in exampleInteractiveHelloWorld,
webpack in fastOptJS in Compile in exampleLifecycle,
webpack in fastOptJS in Compile in exampleReduxDevTools,
webpack in fastOptJS in Compile in exampleReduxMiddleware,
webpack in fastOptJS in Compile in exampleRouter,
webpack in fastOptJS in Compile in exampleRouterRedux,
webpack in fastOptJS in Compile in exampleStyle,
webpack in fastOptJS in Compile in exampleTodoApp,
webpack in fastOptJS in Compile in exampleTodoAppRedux
).value,
fork := true
)