This repository has been archived by the owner on Feb 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.sbt
325 lines (304 loc) · 10.4 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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
/**
* Copyright (c) 2017-2018 BusyMachines
*
* See company homepage at: https://www.busymachines.com/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import sbt._
import Keys._
lazy val currentSnapshotVersion = "0.4.0-SNAPSHOT"
addCommandAlias("setSnapshotVersion", s"""set version in ThisBuild := "$currentSnapshotVersion"""")
addCommandAlias("recompile", ";clean;update;compile")
addCommandAlias("build", ";compile;Test/compile")
addCommandAlias("rebuild", ";clean;compile;Test/compile")
addCommandAlias("rebuild-update", ";clean;update;compile;Test/compile")
addCommandAlias("ci", ";scalafmtCheck;coverageOff;rebuild-update;test")
addCommandAlias("ci-quick", ";scalafmtCheck;build;test")
addCommandAlias("doLocal", ";rebuild-update;publishLocal")
addCommandAlias("doSnapshotLocal", ";rebuild-update;setSnapshotVersion;publishLocal")
addCommandAlias("mkSite", ";docs/makeMicrosite")
addCommandAlias("doSitePublish", ";docs/publishMicrosite")
addCommandAlias("doCoverage", ";rebuild;coverage;test;coverageReport;coverageOff")
addCommandAlias("doCoverage-ci", ";rebuild-update;coverage;test;coverageReport;coverageOff")
/**
* Use with care. Releases a snapshot to sonatype repository.
*
* Currently this will not work properly because of an SBT bug where
* the artifacts are not overriden in the SONATYPE repo:
* https://github.com/sbt/sbt/issues/3725
*
* All instructions for publishing to sonatype can be found in
* ``z-publishing-artifcats/README.md``.
*/
addCommandAlias("doSnapshotRelease", ";ci;setSnapshotVersion;publishSigned")
/**
* Use with care.
*
* All instructions for publishing to sonatype can be found in
* ``z-publishing-artifcats/README.md``.
*/
addCommandAlias("cleanPublishSigned", ";recompile;publishSigned")
addCommandAlias("do212Release", ";++2.12.10;cleanPublishSigned;sonatypeBundleRelease")
addCommandAlias("do213Release", ";++2.13.0;cleanPublishSigned;sonatypeBundleRelease")
//we do this like this, because sonatypeBundleRelease cannot parallelize 2.12, and 2.13 releases
addCommandAlias("doRelease", ";+cleanPublishSigned;do212Release;do213Release")
/**
* this is a phantom project that is simply supposed to aggregate all modules for convenience,
* it is NOT published as an artifact. It doesn't have any source files, it is just a convenient
* way to propagate all commands to the modules via the aggregation
*/
lazy val root = Project(id = "busymachines-commons", base = file("."))
.settings(PublishingSettings.noPublishSettings)
.settings(Settings.commonSettings)
.aggregate(
core,
duration,
`effects-sync`,
`effects-sync-cats`,
`effects-async`,
effects,
json,
`rest-core`,
`rest-core-testkit`,
`rest-json`,
`rest-json-testkit`,
`semver`,
`semver-parsers`,
)
lazy val core = project
.settings(Settings.commonSettings)
.settings(PublishingSettings.sonatypeSettings)
.settings(
name in ThisProject := "busymachines-commons-core",
libraryDependencies +=
Dependencies.scalaTest % Test withSources (),
)
lazy val duration = project
.settings(Settings.commonSettings)
.settings(PublishingSettings.sonatypeSettings)
.settings(
name in ThisProject := "busymachines-commons-duration",
libraryDependencies +=
Dependencies.scalaTest % Test withSources (),
)
lazy val `effects-sync` = project
.settings(Settings.commonSettings)
.settings(PublishingSettings.sonatypeSettings)
.settings(
name in ThisProject := "busymachines-commons-effects-sync",
libraryDependencies ++= Seq(
Dependencies.scalaCompat withSources (),
Dependencies.scalaTest % Test withSources (),
/**
* only in tests because we want to test if syntax
* plays well with import cats._, cats.implicits._
*/
Dependencies.catsCore % Test withSources (),
),
)
.dependsOn(
core,
)
lazy val `effects-sync-cats` = project
.settings(Settings.commonSettings)
.settings(PublishingSettings.sonatypeSettings)
.settings(
name in ThisProject := "busymachines-commons-effects-sync-cats",
libraryDependencies ++= Seq(
Dependencies.catsCore withSources (),
Dependencies.scalaCompat withSources (),
Dependencies.scalaTest % Test withSources (),
),
)
.dependsOn(
core,
`effects-sync`,
)
lazy val `effects-async` = project
.settings(Settings.commonSettings)
.settings(PublishingSettings.sonatypeSettings)
.settings(
name in ThisProject := "busymachines-commons-effects-async",
libraryDependencies ++= Seq(
Dependencies.catsCore withSources (),
Dependencies.catsEffect withSources (),
Dependencies.scalaCompat withSources (),
Dependencies.scalaTest % Test withSources (),
),
)
.dependsOn(
core,
duration,
`effects-sync`,
`effects-sync-cats`,
)
lazy val effects = project
.settings(Settings.commonSettings)
.settings(PublishingSettings.sonatypeSettings)
.settings(
name in ThisProject := "busymachines-commons-effects",
libraryDependencies ++= Seq(
Dependencies.scalaCompat withSources (),
Dependencies.scalaTest % Test withSources (),
),
)
.dependsOn(
core,
`effects-sync`,
`effects-async`,
)
lazy val json = project
.settings(Settings.commonSettings)
.settings(PublishingSettings.sonatypeSettings)
.settings(
name in ThisProject := "busymachines-commons-json",
libraryDependencies ++=
Dependencies.circe.map(c => c withSources ()) ++ Seq(
Dependencies.shapeless withSources (),
Dependencies.catsCore withSources (),
Dependencies.scalaTest % Test withSources (),
),
)
.dependsOn(
core,
`effects-sync`,
)
lazy val `rest-core` = project
.settings(Settings.commonSettings)
.settings(PublishingSettings.sonatypeSettings)
.settings(
name in ThisProject := "busymachines-commons-rest-core",
libraryDependencies ++= Seq(
Dependencies.akkaHttp withSources (),
/**
* http://doc.akka.io/docs/akka-http/current/scala/http/introduction.html#using-akka-http
*/
Dependencies.akkaStream withSources (),
//used for building the WebServerIO helpers
Dependencies.catsEffect withSources (),
),
)
.dependsOn(
core,
)
lazy val `rest-core-testkit` = project
.settings(Settings.commonSettings)
.settings(PublishingSettings.sonatypeSettings)
.settings(
name in ThisProject := "busymachines-commons-rest-core-testkit",
libraryDependencies ++= Seq(
Dependencies.akkaTestKit withSources (),
Dependencies.akkaHttpTestKit withSources (),
Dependencies.scalaTest withSources (),
Dependencies.scalaTest % Test withSources (),
),
)
.dependsOn(
core,
`rest-core`,
)
lazy val `rest-json` = project
.settings(Settings.commonSettings)
.settings(PublishingSettings.sonatypeSettings)
.settings(
name in ThisProject := "busymachines-commons-rest-json",
libraryDependencies ++= Seq(),
)
.dependsOn(
core,
json,
`rest-core`,
)
lazy val `rest-json-testkit` = project
.settings(Settings.commonSettings)
.settings(PublishingSettings.sonatypeSettings)
.settings(
name in ThisProject := "busymachines-commons-rest-json-testkit",
libraryDependencies ++= Seq(
Dependencies.scalaTest % Test withSources (),
),
)
.dependsOn(
core,
json,
`rest-core`,
`rest-json`,
`rest-core-testkit`,
)
lazy val `semver` = project
.settings(Settings.commonSettings)
.settings(PublishingSettings.sonatypeSettings)
.settings(
name in ThisProject := "busymachines-commons-semver",
libraryDependencies ++= Seq(
Dependencies.scalaTest % Test withSources (),
),
)
.dependsOn()
lazy val `semver-parsers` = project
.settings(Settings.commonSettings)
.settings(PublishingSettings.sonatypeSettings)
.settings(
name in ThisProject := "busymachines-commons-semver-parsers",
libraryDependencies ++= Seq(
Dependencies.attoParser withSources (),
Dependencies.scalaTest % Test withSources (),
),
)
.dependsOn(
core,
`effects-sync`,
`semver`,
)
lazy val docs = project
.enablePlugins(MicrositesPlugin)
.enablePlugins(TutPlugin)
.disablePlugins(ScalafmtPlugin)
//.disablePlugins(ScalafixPlugin)
.settings(Settings.commonSettings)
.settings(PublishingSettings.noPublishSettings)
.settings(micrositeTasksSettings)
.settings(
micrositeName := "busymachines-commmons",
micrositeDescription := "Light-weight, modular eco-system of libraries needed to build HTTP web apps in Scala",
micrositeBaseUrl := "/busymachines-commons",
micrositeDocumentationUrl := "/busymachines-commons/docs/",
micrositeHomepage := "http://busymachines.github.io/busymachines-commons/",
micrositeGithubOwner := "busymachines",
micrositeGithubRepo := "busymachines-commons",
micrositeHighlightTheme := "atom-one-light",
//-------------- docs project ------------
//micrositeImgDirectory := (resourceDirectory in Compile).value / "microsite" / "images",
//micrositeCssDirectory := (resourceDirectory in Compile).value / "microsite" / "styles"
//micrositeJsDirectory := (resourceDirectory in Compile).value / "microsite" / "scripts"
micrositePalette := Map(
"brand-primary" -> "#E05236",
"brand-secondary" -> "#3F3242",
"brand-tertiary" -> "#2D232F",
"gray-dark" -> "#453E46",
"gray" -> "#837F84",
"gray-light" -> "#E3E2E3",
"gray-lighter" -> "#F4F3F4",
"white-color" -> "#FFFFFF",
),
//micrositeFavicons := Seq(
// MicrositeFavicon("favicon16x16.png", "16x16"),
// MicrositeFavicon("favicon32x32.png", "32x32")
//),
micrositeFooterText := Some("""Ⓒ 2018 <a href="https://www.busymachines.com/">BusyMachines</a>"""),
//------ same as default settings --------
micrositePushSiteWith := GHPagesPlugin,
micrositeGitHostingService := GitHub,
)
.dependsOn()