-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sbt
223 lines (193 loc) · 7.07 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
import com.jsuereth.sbtpgp.PgpKeys.publishSigned
name := "pekko-streams-circe"
val scala213Version = "2.13.15"
val scala212Version = "2.12.20"
val scala3Version = "3.3.4"
val circeVersion = "0.14.10"
val pekkoVersion = "1.0.3"
val pekkoHttpVersion = "1.0.1"
val jawnVersion = "1.6.0"
val scalaTestVersion = "3.2.19"
ThisBuild / crossScalaVersions := Seq(scala212Version, scala213Version, scala3Version)
ThisBuild / scalaVersion := scala213Version
ThisBuild / organization := "org.mdedetrich"
ThisBuild / versionScheme := Some(VersionScheme.EarlySemVer)
ThisBuild / versionPolicyIntention := Compatibility.BinaryCompatible
lazy val streamJson = project
.in(file("stream-json"))
.settings(
name := "pekko-stream-json",
libraryDependencies ++= Seq(
"org.apache.pekko" %% "pekko-stream" % pekkoVersion,
"org.typelevel" %% "jawn-parser" % jawnVersion
)
)
lazy val httpJson = project
.in(file("http-json"))
.settings(
name := "pekko-http-json",
libraryDependencies ++= Seq(
"org.apache.pekko" %% "pekko-stream" % pekkoVersion,
"org.apache.pekko" %% "pekko-http" % pekkoHttpVersion
)
)
.dependsOn(streamJson)
lazy val streamCirce = project
.in(file("support") / "stream-circe")
.settings(
name := "pekko-stream-circe",
libraryDependencies ++= Seq(
"org.apache.pekko" %% "pekko-stream" % pekkoVersion,
"io.circe" %% "circe-jawn" % circeVersion
)
)
.dependsOn(streamJson)
lazy val httpCirce = project
.in(file("support") / "http-circe")
.settings(
name := "pekko-http-circe",
libraryDependencies ++= Seq(
"org.apache.pekko" %% "pekko-http" % pekkoHttpVersion
)
)
.dependsOn(streamCirce, httpJson)
lazy val parent = project
.in(file("."))
.dependsOn(httpJson, httpCirce)
.aggregate(streamJson, httpJson, streamCirce, httpCirce, tests)
.settings(
name := "pekko-streams-circe",
mimaPreviousArtifacts := Set.empty,
publish / skip := true,
publishSigned / skip := true,
publishLocal / skip := true
)
lazy val tests = project
.in(file("tests"))
.dependsOn(streamJson, httpJson, streamCirce, httpCirce)
.settings(
libraryDependencies ++=
List(
"org.apache.pekko" %% "pekko-stream" % pekkoVersion % Test,
"org.apache.pekko" %% "pekko-http" % pekkoHttpVersion % Test,
"org.scalatest" %% "scalatest" % scalaTestVersion % Test,
"io.circe" %% "circe-generic" % circeVersion % Test
),
publish / skip := true,
publishSigned / skip := true,
publishLocal / skip := true
)
.disablePlugins(MimaPlugin)
ThisBuild / scalacOptions ++= Seq(
"-release:8",
"-encoding",
"UTF-8",
"-deprecation", // warning and location for usages of deprecated APIs
"-feature", // warning and location for usages of features that should be imported explicitly
"-unchecked", // additional warnings where generated code depends on assumptions
"-language:postfixOps"
)
ThisBuild / homepage := Some(url("https://github.com/mdedetrich/pekko-streams-circe"))
ThisBuild / scmInfo := Some(
ScmInfo(url("https://github.com/mdedetrich/pekko-streams-circe"), "[email protected]:mdedetrich/pekko-streams-circe.git")
)
ThisBuild / developers := List(
Developer("knutwalker", "Paul Horn", "", url("https://github.com/knutwalker/")),
Developer("mdedetrich", "Matthew de Detrich", "[email protected]", url("https://github.com/mdedetrich"))
)
ThisBuild / licenses += ("Apache-2.0", url("https://opensource.org/licenses/Apache-2.0"))
ThisBuild / publishMavenStyle := true
ThisBuild / publishTo := sonatypePublishToBundle.value
ThisBuild / test / publishArtifact := false
ThisBuild / pomIncludeRepository := (_ => false)
val flagsFor12 = Seq(
"-Xlint:_",
"-Xcheckinit", // runtime error when a val is not initialized due to trait hierarchies (instead of NPE somewhere else)
"-Ywarn-infer-any",
"-Ywarn-adapted-args", // Warn if an argument list is modified to match the receiver
"-Ywarn-inaccessible",
"-Ywarn-infer-any",
"-Ywarn-value-discard", // Warn when non-Unit expression results are unused
"-Ywarn-dead-code",
"-opt-inline-from:<sources>",
"-opt:l:inline"
)
val flagsFor13 = Seq(
"-Xlint:_",
"-Xcheckinit", // runtime error when a val is not initialized due to trait hierarchies (instead of NPE somewhere else)
"-Ywarn-value-discard", // Warn when non-Unit expression results are unused
"-Ywarn-dead-code",
"-opt-inline-from:<sources>",
"-opt:l:inline"
)
val flagsFor3 = Seq.empty
ThisBuild / scalacOptions ++= {
if (insideCI.value) {
val log = sLog.value
log.info("Running in CI, enabling Scala2 optimizer")
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n == 13 =>
flagsFor13
case Some((2, n)) if n == 12 =>
flagsFor12
case Some((3, _)) =>
Seq.empty
}
} else Seq.empty
}
ThisBuild / githubWorkflowTargetBranches := Seq("main") // Once we have branches per version, add the pattern here
ThisBuild / githubWorkflowBuild := Seq(
WorkflowStep.Sbt(List("versionPolicyCheck"), name = Some("Report version policy issues")),
WorkflowStep.Sbt(List("clean", "coverage", "test"), name = Some("Build project"))
)
ThisBuild / githubWorkflowBuildPostamble ++= Seq(
// See https://github.com/scoverage/sbt-coveralls#github-actions-integration
WorkflowStep.Sbt(
List("coverageReport", "coverageAggregate", "coveralls"),
name = Some("Upload coverage data to Coveralls"),
env = Map(
"COVERALLS_REPO_TOKEN" -> "${{ secrets.GITHUB_TOKEN }}",
"COVERALLS_FLAG_NAME" -> "Scala ${{ matrix.scala }}"
)
)
)
// This is causing problems with env variables being passed in, see
// https://github.com/sbt/sbt/issues/6468
ThisBuild / githubWorkflowUseSbtThinClient := false
ThisBuild / githubWorkflowPublish := Seq(
WorkflowStep.Sbt(
commands = List("ci-release"),
name = Some("Publish project"),
env = Map(
"PGP_PASSPHRASE" -> "${{ secrets.PGP_PASSPHRASE }}",
"PGP_SECRET" -> "${{ secrets.PGP_SECRET }}",
"SONATYPE_PASSWORD" -> "${{ secrets.SONATYPE_PASSWORD }}",
"SONATYPE_USERNAME" -> "${{ secrets.SONATYPE_USERNAME }}"
)
)
)
ThisBuild / githubWorkflowTargetTags ++= Seq("v*")
ThisBuild / githubWorkflowPublishTargetBranches :=
Seq(
RefPredicate.StartsWith(Ref.Tag("v")),
RefPredicate.Equals(Ref.Branch("main"))
)
ThisBuild / githubWorkflowOSes := Seq("ubuntu-latest", "macos-12", "macos-latest", "windows-latest")
ThisBuild / githubWorkflowJavaVersions := List(
JavaSpec.temurin("8"),
JavaSpec.temurin("11"),
JavaSpec.temurin("17"),
JavaSpec.temurin("21")
)
ThisBuild / githubWorkflowBuildMatrixExclusions +=
MatrixExclude(Map("java" -> "temurin@8", "os" -> "macos-latest"))
// GitHub Actions macOS 13+ runner images do not come with sbt preinstalled anymore
ThisBuild / githubWorkflowBuildPreamble ++= Seq(
WorkflowStep.Run(
commands = List(
"brew install sbt"
),
cond = Some("matrix.os == 'macos-latest'"),
name = Some("Install sbt")
)
)