-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
build.sbt
190 lines (171 loc) · 6.3 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
import Dependencies.*
import microsites.ExtraMdFileConfig
import scala.collection.immutable
ThisBuild / name := "fs2-rabbit"
ThisBuild / scalaVersion := "2.13.15"
ThisBuild / crossScalaVersions := List("2.13.15", "3.3.4", "3.5.2")
ThisBuild / versionScheme := Some("semver-spec")
ThisBuild / organization := "dev.profunktor"
ThisBuild / homepage := Some(url("https://fs2-rabbit.profunktor.dev/"))
ThisBuild / licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0"))
ThisBuild / developers := List(
Developer(
"gvolpe",
"Gabriel Volpe",
"volpegabriel@gmail.com",
url("https://gvolpe.github.io")
)
)
publish / skip := true
def scalaOptions(v: String): immutable.Seq[String] =
CrossVersion.partialVersion(v) match {
case Some((2, 13)) => List.empty[String]
case Some((3, _)) => List("-source:3.0-migration")
case _ => List("-Xmax-classfile-name", "100")
}
def commonDependencies(v: String): Seq[ModuleID] =
List(
Libraries.amqpClient,
Libraries.catsEffect,
Libraries.fs2Core,
Libraries.scalaTest % Test,
Libraries.scalaCheck % Test,
Libraries.scalaTestPlusScalaCheck % Test
) ++
(CrossVersion.partialVersion(v) match {
case Some((3, _)) => List.empty
case _ =>
List(
compilerPlugin(Libraries.kindProjector)
)
})
val commonSettings = List(
organizationName := "ProfunKtor",
startYear := Some(2017),
licenses += ("Apache-2.0", new URL("https://www.apache.org/licenses/LICENSE-2.0.txt")),
homepage := Some(url("https://fs2-rabbit.profunktor.dev/")),
headerLicense := Some(HeaderLicense.ALv2(s"${startYear.value.get}-${java.time.Year.now}", "ProfunKtor")),
Compile / doc / scalacOptions ++= List("-no-link-warnings"),
scalacOptions ++= scalaOptions(scalaVersion.value),
scalacOptions --= List("-Wunused:params", "-Xfatal-warnings"),
libraryDependencies ++= commonDependencies(scalaVersion.value),
resolvers += "Apache public" at "https://repository.apache.org/content/groups/public/",
scalafmtOnCompile := true,
mimaPreviousArtifacts := previousStableVersion.value.map(organization.value %% moduleName.value % _).toSet
)
def CoreDependencies(scalaVersionStr: String): List[ModuleID] =
List(
Libraries.scodecCats,
Libraries.logback % Test
)
def JsonDependencies(scalaVersionStr: String): List[ModuleID] =
List(
Libraries.circeCore,
Libraries.circeGeneric,
Libraries.circeParser
)
def ExamplesDependencies(scalaVersionStr: String): List[ModuleID] =
List(
Libraries.logback % "runtime",
Libraries.zioCore,
Libraries.zioCats,
Libraries.dropwizard,
Libraries.dropwizardJmx
)
def TestKitDependencies(scalaVersionStr: String): List[ModuleID] = List(Libraries.scalaCheck)
def TestsDependencies(scalaVersionStr: String): List[ModuleID] =
List(
Libraries.disciplineScalaCheck % Test,
Libraries.catsLaws % Test,
Libraries.catsKernelLaws % Test
)
lazy val noPublish = List(
publish := {},
publishLocal := {},
publishArtifact := false,
publish / skip := true,
crossScalaVersions := Nil
)
lazy val `fs2-rabbit-root`: Project = project
.in(file("."))
.disablePlugins(MimaPlugin)
.aggregate(`fs2-rabbit`, `fs2-rabbit-circe`, tests, examples, microsite, `fs2-rabbit-testkit`)
.settings(noPublish)
lazy val `fs2-rabbit`: Project = project
.in(file("core"))
.settings(commonSettings: _*)
.settings(libraryDependencies ++= CoreDependencies(scalaVersion.value))
.settings(Test / parallelExecution := false)
.enablePlugins(AutomateHeaderPlugin)
lazy val `fs2-rabbit-circe`: Project = project
.in(file("json-circe"))
.settings(commonSettings: _*)
.settings(libraryDependencies ++= JsonDependencies(scalaVersion.value))
.settings(Test / parallelExecution := false)
.enablePlugins(AutomateHeaderPlugin)
.dependsOn(`fs2-rabbit`)
lazy val tests: Project = project
.in(file("tests"))
.settings(commonSettings: _*)
.settings(noPublish)
.enablePlugins(AutomateHeaderPlugin)
.disablePlugins(MimaPlugin)
.settings(libraryDependencies ++= TestsDependencies(scalaVersion.value))
.settings(Test / parallelExecution := false)
.dependsOn(`fs2-rabbit`, `fs2-rabbit-testkit`)
lazy val examples: Project = project
.in(file("examples"))
.settings(commonSettings: _*)
.settings(libraryDependencies ++= ExamplesDependencies(scalaVersion.value))
.settings(noPublish)
.enablePlugins(AutomateHeaderPlugin)
.disablePlugins(MimaPlugin)
.dependsOn(`fs2-rabbit`, `fs2-rabbit-circe`)
lazy val `fs2-rabbit-testkit`: Project = project
.in(file("testkit"))
.settings(commonSettings: _*)
.settings(libraryDependencies ++= TestKitDependencies(scalaVersion.value))
.enablePlugins(AutomateHeaderPlugin)
.dependsOn(`fs2-rabbit`)
lazy val microsite: Project = project
.in(file("site"))
.enablePlugins(MicrositesPlugin)
.disablePlugins(MimaPlugin)
.settings(commonSettings: _*)
.settings(noPublish)
.settings(
micrositeName := "Fs2 Rabbit",
micrositeDescription := "RabbitMQ stream-based client",
micrositeAuthor := "ProfunKtor",
micrositeGithubOwner := "profunktor",
micrositeGithubRepo := "fs2-rabbit",
micrositeBaseUrl := "",
micrositeExtraMdFiles := Map(
file("README.md") -> ExtraMdFileConfig(
"index.md",
"home",
Map("title" -> "Home", "position" -> "0")
),
file("CODE_OF_CONDUCT.md") -> ExtraMdFileConfig(
"CODE_OF_CONDUCT.md",
"page",
Map("title" -> "Code of Conduct")
)
),
micrositeExtraMdFilesOutput := (Compile / resourceManaged).value / "jekyll",
micrositeGitterChannel := true,
micrositeGitterChannelUrl := "profunktor-dev/fs2-rabbit",
micrositePushSiteWith := GitHub4s,
micrositeGithubToken := sys.env.get("GITHUB_TOKEN"),
scalacOptions --= List(
"-Werror",
"-Xfatal-warnings",
"-Ywarn-unused-import",
"-Ywarn-numeric-widen",
"-Ywarn-dead-code",
"-Xlint:-missing-interpolator,_"
)
)
.dependsOn(`fs2-rabbit`, `fs2-rabbit-circe`, `examples`)
// CI build
addCommandAlias("buildFs2Rabbit", ";clean;+test;mdoc")