-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathbuild.sbt
196 lines (176 loc) · 6.68 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
val catsVersion = "2.9.0"
ThisBuild / tlBaseVersion := BaseVersion(finagleVersion)
ThisBuild / tlVersionIntroduced := // test bincompat starting from the beginning of this series
List("2.12", "2.13").map(_ -> s"${tlBaseVersion.value}.0").toMap
ThisBuild / tlCiHeaderCheck := false
// For the transition period, we publish artifacts for both cats-effect 2.x and 3.x
val catsEffectVersion = "2.5.5"
val catsEffect3Version = "3.4.3"
ThisBuild / crossScalaVersions := Seq("2.12.17", "2.13.10")
ThisBuild / libraryDependencySchemes ++= Seq(
// scoverage depends on scala-xml 1, but discipline-scalatest transitively pulls in scala-xml 2
// this is normally discouraged but was recommended by one of the scoverage maintainers in the Typelevel Discord
"org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always
)
Global / onChangedBuildSource := ReloadOnSourceChanges
val docMappingsApiDir = settingKey[String]("Subdirectory in site target directory for API docs")
lazy val baseSettings = Seq(
// Finagle releases monthly using a {year}.{month}.{patch} version scheme.
// The combination of year and month is effectively a major version, because
// each monthly release often contains binary-incompatible changes.
// This means we should release at least monthly as well, when Finagle does,
// but in between those monthly releases, maintain binary compatibility.
// This is effectively PVP style versioning.
// We set this at the project-level instead of ThisBuild to circumvent sbt-typelevel checks.
versionScheme := Some("pvp"),
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % catsVersion,
"org.scalacheck" %% "scalacheck" % "1.17.0" % Test,
"org.scalatest" %% "scalatest" % "3.2.14" % Test,
"org.typelevel" %% "cats-laws" % catsVersion % Test,
"org.typelevel" %% "discipline-core" % "1.5.1" % Test,
"org.typelevel" %% "discipline-scalatest" % "2.2.0" % Test
),
resolvers ++= Resolver.sonatypeOssRepos("snapshots"),
docMappingsApiDir := "api",
autoAPIMappings := true,
// disable automatic copyright header creation otherwise added via sbt-typelevel
headerMappings := Map.empty
)
lazy val allSettings = baseSettings
lazy val root = project
.in(file("."))
.enablePlugins(GhpagesPlugin, ScalaUnidocPlugin, NoPublishPlugin)
.settings(allSettings)
.settings(
ScalaUnidoc / unidoc / unidocProjectFilter := inAnyProject -- inProjects(
benchmark,
effect3,
`scalafix-input`,
`scalafix-output`,
`scalafix-tests`
),
addMappingsToSiteDir(ScalaUnidoc / packageDoc / mappings, docMappingsApiDir),
git.remoteRepo := "git@github.com:typelevel/catbird.git"
)
.settings(
console / initialCommands :=
"""
|import com.twitter.finagle._
|import com.twitter.util._
|import org.typelevel.catbird.finagle._
|import org.typelevel.catbird.util._
""".stripMargin
)
.aggregate(util, effect3, finagle, benchmark, `scalafix-rules`, `scalafix-tests`, FinaglePlugin.rootFinagle)
.dependsOn(util, finagle)
lazy val util = project
.settings(moduleName := "catbird-util")
.settings(allSettings)
.settings(
libraryDependencies += "com.twitter" %% "util-core" % finagleVersion,
Test / scalacOptions ~= {
_.filterNot(Set("-Yno-imports", "-Yno-predef"))
}
)
lazy val effect3 = project
.in(file("effect3"))
.settings(moduleName := "catbird-effect3")
.settings(allSettings)
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-effect" % catsEffect3Version,
"org.typelevel" %% "cats-effect-laws" % catsEffect3Version % Test,
"org.typelevel" %% "cats-effect-testkit" % catsEffect3Version % Test
),
Test / scalacOptions ~= {
_.filterNot(Set("-Yno-imports", "-Yno-predef"))
}
)
.dependsOn(util, util % "test->test")
lazy val finagle = project
.settings(moduleName := "catbird-finagle")
.settings(allSettings)
.settings(
libraryDependencies += "com.twitter" %% "finagle-core" % finagleVersion,
Test / scalacOptions ~= {
_.filterNot(Set("-Yno-imports", "-Yno-predef"))
}
)
.dependsOn(util)
lazy val benchmark = project
.enablePlugins(NoPublishPlugin)
.settings(allSettings)
.settings(
moduleName := "catbird-benchmark",
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.14",
scalacOptions ~= {
_.filterNot(Set("-Yno-imports", "-Yno-predef"))
}
)
.enablePlugins(JmhPlugin)
.dependsOn(util)
ThisBuild / apiURL := Some(url("https://typelevel.org/catbird/api/"))
ThisBuild / developers += Developer("travisbrown", "Travis Brown", "", url("https://twitter.com/travisbrown"))
ThisBuild / githubWorkflowBuild := Seq(
WorkflowStep.Sbt(
List(
"clean",
"coverage",
"test",
"mimaReportBinaryIssues",
"scalastyle",
"scalafmtCheckAll",
"scalafmtSbtCheck",
"unidoc",
"coverageReport"
)
),
WorkflowStep.Use(
UseRef.Public("codecov", "codecov-action", "v1"),
name = Some("Code coverage analysis")
)
)
lazy val `scalafix-rules` = (project in file("scalafix/rules"))
.settings(allSettings)
.settings(
moduleName := "catbird-scalafix",
libraryDependencies ++= Seq(
"ch.epfl.scala" %% "scalafix-core" % _root_.scalafix.sbt.BuildInfo.scalafixVersion
)
)
lazy val `scalafix-input` = (project in file("scalafix/input"))
.settings(
libraryDependencies ++= Seq(
"io.catbird" %% "catbird-util" % "21.8.0"
),
scalacOptions ~= { _.filterNot(_ == "-Xfatal-warnings") },
semanticdbEnabled := true,
semanticdbVersion := scalafixSemanticdb.revision
)
.enablePlugins(NoPublishPlugin)
lazy val `scalafix-output` = (project in file("scalafix/output"))
.settings(
githubWorkflowArtifactUpload := false,
scalacOptions ~= { _.filterNot(_ == "-Xfatal-warnings") }
)
.dependsOn(util)
.enablePlugins(NoPublishPlugin)
lazy val `scalafix-tests` = (project in file("scalafix/tests"))
.settings(allSettings)
.settings(
libraryDependencies += {
import _root_.scalafix.sbt.BuildInfo.scalafixVersion
("ch.epfl.scala" % "scalafix-testkit" % scalafixVersion % Test).cross(CrossVersion.full)
},
scalafixTestkitOutputSourceDirectories := (`scalafix-output` / Compile / unmanagedSourceDirectories).value,
scalafixTestkitInputSourceDirectories := (`scalafix-input` / Compile / unmanagedSourceDirectories).value,
scalafixTestkitInputClasspath := (`scalafix-input` / Compile / fullClasspath).value,
scalafixTestkitInputScalacOptions := (`scalafix-input` / Compile / scalacOptions).value,
scalafixTestkitInputScalaVersion := (`scalafix-input` / Compile / scalaVersion).value
)
.dependsOn(`scalafix-rules`)
.enablePlugins(
ScalafixTestkitPlugin,
NoPublishPlugin
)