Skip to content

Commit 3cc2cad

Browse files
authored
Update Pekko to 1.2.0, update everything (#218)
* Update Pekko to 1.2.0, update everything Because of the akka-to-pekko-adapter update to 1.0.0, this change requires upping the major version to 3. Also: * update Scala, sbt, sbt plugins, scalafmt to the latest * return bincompat checks * disable JMH benchmark code publishing - most likely was enabled by mistake * refactor build files to improve readability * Scala version matrix strategy removed from the CI action because it is not necessary anymore, since sbt-projectmatrix is used
1 parent 49416ee commit 3cc2cad

File tree

10 files changed

+149
-105
lines changed

10 files changed

+149
-105
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
name: CI
22

3-
on: [push, pull_request]
3+
on: [ push, pull_request ]
44

55
jobs:
66
test:
77

88
runs-on: ubuntu-latest
99

10-
strategy:
11-
matrix:
12-
scala:
13-
- 2.13.16
14-
- 3.3.3
10+
# not setting up a matrix strategy because the project uses sbt-projectmatrix
1511

1612
steps:
17-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v5
1814

1915
- uses: coursier/cache-action@v6
2016

2117
- name: setup Java 17
22-
uses: actions/setup-java@v4
18+
uses: actions/setup-java@v5
2319
with:
2420
java-version: '17'
2521
distribution: 'oracle'
@@ -28,15 +24,15 @@ jobs:
2824
- name: setup SBT
2925
uses: sbt/setup-sbt@v1
3026

31-
- name: build ${{ matrix.scala }}
32-
run: sbt ++${{ matrix.scala }} clean check coverage test
27+
- name: build
28+
run: sbt clean check coverage test
3329

3430
- name: test coverage
3531
if: success()
3632
env:
3733
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3834
COVERALLS_FLAG_NAME: Scala ${{ matrix.scala }}
39-
run: sbt ++${{ matrix.scala }} coverageReport coverageAggregate coveralls
35+
run: sbt coverageReport coverageAggregate coveralls
4036

4137
- name: slack
4238
uses: homoluctus/slatify@master

.scalafmt.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = 3.9.6
1+
version = 3.9.9
22

33
runner.dialect = scala213source3
44

build.sbt

Lines changed: 89 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
import sbt.Keys.publish
1+
import Dependencies.*
2+
import ProjectMatrixSyntax.*
3+
import sbt.Keys.*
24
import sbt.internal.ProjectMatrix
35

4-
lazy val ScalaVersions = Seq("2.13.16", "3.3.3")
6+
lazy val scalaVersions = Seq("2.13.16", "3.3.6")
57

68
lazy val commonSettings = Seq(
79
organization := "com.evolutiongaming",
810
homepage := Some(url("https://github.com/evolution-gaming/sequentially")),
911
startYear := Some(2018),
1012
organizationName := "Evolution",
1113
organizationHomepage := Some(url("https://evolution.com")),
14+
licenses := Seq(("MIT", url("https://opensource.org/licenses/MIT"))),
15+
16+
// compiler settings
1217
Compile / scalacOptions ++= {
1318
if (scalaBinaryVersion.value == "2.13") {
1419
Seq(
@@ -17,99 +22,76 @@ lazy val commonSettings = Seq(
1722
} else Seq.empty
1823
},
1924
Compile / doc / scalacOptions += "-no-link-warnings",
25+
26+
// publishing and versioning settings
2027
publishTo := Some(Resolver.evolutionReleases),
21-
licenses := Seq(("MIT", url("https://opensource.org/licenses/MIT"))),
2228
versionScheme := Some("semver-spec"),
29+
versionPolicyIntention := Compatibility.BinaryCompatible,
2330
)
2431

25-
// Your next release will be binary compatible with the previous one,
26-
// but it may not be source compatible (ie, it will be a minor release).
27-
ThisBuild / versionPolicyIntention := Compatibility.None
28-
29-
lazy val root = (project
30-
in file(".")
31-
settings (name := "sequentially-root")
32-
settings commonSettings
33-
settings (publish / skip := true)
34-
aggregate (
35-
sequentially.projectRefs ++
36-
benchmark.projectRefs ++
37-
`sequentially-metrics`.projectRefs: _*
38-
))
39-
lazy val PekkoVersion = "1.1.3"
40-
lazy val sequentially = (projectMatrix
41-
in file("sequentially")
42-
settings (name := "sequentially")
43-
settings commonSettings
44-
settings (libraryDependencies ++= Seq(
45-
"com.evolutiongaming" %% "future-helper" % "1.0.7",
46-
"org.scalatest" %% "scalatest" % "3.2.19" % Test,
47-
)))
48-
.jvmPlatform(
49-
scalaVersions = ScalaVersions,
50-
axisValues = Seq(ConfigAxis.Provider.pekko),
51-
configure = _.settings(
52-
moduleName := moduleName.value + "-pekko",
53-
libraryDependencies ++= Seq(
54-
"org.apache.pekko" %% "pekko-actor" % PekkoVersion,
55-
"org.apache.pekko" %% "pekko-stream" % PekkoVersion,
56-
"org.apache.pekko" %% "pekko-testkit" % PekkoVersion % Test,
57-
"com.evolution" %% "akka-to-pekko-adapter-actor" % "0.0.5",
58-
"com.evolution" %% "akka-to-pekko-adapter-stream" % "0.0.5",
59-
"com.evolution" %% "akka-to-pekko-adapter-test-kit" % "0.0.5" % Test,
60-
),
61-
),
32+
lazy val root = project
33+
.in(file("."))
34+
.settings(commonSettings)
35+
.settings(
36+
name := "sequentially-root",
37+
publish / skip := true,
38+
// setting the Scala version so this module does not pull scalafix & others for 2.12
39+
scalaVersion := scalaVersions.head,
6240
)
63-
.jvmPlatform(
64-
scalaVersions = ScalaVersions,
65-
axisValues = Seq(ConfigAxis.Provider.akka),
66-
configure = _.settings(
67-
libraryDependencies ++= Seq(
68-
"com.typesafe.akka" %% "akka-stream" % "2.6.21",
69-
"com.typesafe.akka" %% "akka-testkit" % "2.6.21" % Test,
70-
)
71-
),
41+
.aggregate(
42+
(sequentially.projectRefs ++
43+
benchmark.projectRefs ++
44+
`sequentially-metrics`.projectRefs) *
7245
)
7346

74-
lazy val benchmark = (projectMatrix
75-
in file("benchmark")
76-
enablePlugins JmhPlugin
77-
settings (name := "benchmark")
78-
settings commonSettings
79-
dependsOn sequentially % "compile->compile")
80-
.jvmPlatform(
81-
scalaVersions = ScalaVersions,
82-
axisValues = Seq(ConfigAxis.Provider.pekko),
83-
configure = _.settings(
84-
moduleName := moduleName.value + "-pekko"
85-
),
47+
lazy val sequentially = projectMatrix
48+
.in(file("sequentially"))
49+
.settings(commonSettings)
50+
.settings(
51+
name := "sequentially"
8652
)
87-
.jvmPlatform(
88-
scalaVersions = ScalaVersions,
89-
axisValues = Seq(ConfigAxis.Provider.akka),
90-
configure = identity,
53+
.settings(
54+
libraryDependencies ++= Seq(
55+
FutureHelper,
56+
Scalatest % Test,
57+
)
9158
)
92-
93-
lazy val `sequentially-metrics` = (projectMatrix
94-
in file("sequentially-metrics")
95-
settings (name := "sequentially-metrics")
96-
settings commonSettings
97-
dependsOn sequentially % "compile->compile"
98-
settings (libraryDependencies ++= Seq(
99-
"com.evolutiongaming" %% "prometheus-tools" % "1.1.0"
100-
)))
101-
.jvmPlatform(
102-
scalaVersions = ScalaVersions,
103-
axisValues = Seq(ConfigAxis.Provider.pekko),
104-
configure = _.settings(
105-
moduleName := moduleName.value + "-pekko"
59+
.configureMatrix(asAkkaPekkoModule(
60+
akkaDependencies = Seq(
61+
Akka.Stream,
62+
Akka.Testkit % Test,
10663
),
64+
pekkoDependencies = Seq(
65+
Pekko.Stream,
66+
Pekko.Testkit % Test,
67+
AkkaToPekkoAdapter.Actor,
68+
AkkaToPekkoAdapter.Stream,
69+
AkkaToPekkoAdapter.Testkit % Test,
70+
),
71+
))
72+
73+
lazy val benchmark = projectMatrix
74+
.in(file("benchmark"))
75+
.settings(commonSettings)
76+
.enablePlugins(JmhPlugin)
77+
.settings(
78+
name := "benchmark",
79+
publish / skip := true,
10780
)
108-
.jvmPlatform(
109-
scalaVersions = ScalaVersions,
110-
axisValues = Seq(ConfigAxis.Provider.akka),
111-
configure = identity,
81+
.dependsOn(sequentially)
82+
.configureMatrix(asAkkaPekkoModule())
83+
84+
lazy val `sequentially-metrics` = projectMatrix
85+
.in(file("sequentially-metrics"))
86+
.settings(commonSettings)
87+
.settings(name := "sequentially-metrics")
88+
.dependsOn(sequentially)
89+
.settings(
90+
libraryDependencies ++= Seq(
91+
PrometheusTools
92+
)
11293
)
94+
.configureMatrix(asAkkaPekkoModule())
11395

11496
//used by evolution-gaming/scala-github-actions
11597
addCommandAlias(
@@ -118,3 +100,27 @@ addCommandAlias(
118100
)
119101

120102
addCommandAlias("fmtAll", "all scalafmtAll scalafmtSbt; scalafixEnable; scalafixAll")
103+
104+
def asAkkaPekkoModule(
105+
akkaDependencies: Seq[ModuleID] = Seq.empty,
106+
pekkoDependencies: Seq[ModuleID] = Seq.empty,
107+
)(
108+
p: ProjectMatrix
109+
): ProjectMatrix = {
110+
p
111+
.jvmPlatform(
112+
scalaVersions = scalaVersions,
113+
axisValues = Seq(ConfigAxis.Provider.pekko),
114+
configure = _.settings(
115+
moduleName := moduleName.value + "-pekko",
116+
libraryDependencies ++= pekkoDependencies,
117+
),
118+
)
119+
.jvmPlatform(
120+
scalaVersions = scalaVersions,
121+
axisValues = Seq(ConfigAxis.Provider.akka),
122+
configure = _.settings(
123+
libraryDependencies ++= akkaDependencies
124+
),
125+
)
126+
}

project/ConfigAxis.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import sbt.{VirtualAxis, *}
1+
import sbt.VirtualAxis
22

33
case class ConfigAxis(idSuffix: String, directorySuffix: String) extends VirtualAxis.StrongAxis {}
44

project/Dependencies.scala

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import sbt.*
2+
3+
object Dependencies {
4+
5+
val PrometheusTools = "com.evolutiongaming" %% "prometheus-tools" % "1.1.0"
6+
val FutureHelper = "com.evolutiongaming" %% "future-helper" % "1.0.7"
7+
val Scalatest = "org.scalatest" %% "scalatest" % "3.2.19"
8+
9+
object Akka {
10+
private val Version = "2.6.21" // last OSS Akka version
11+
12+
val Stream = "com.typesafe.akka" %% "akka-stream" % Version
13+
val Testkit = "com.typesafe.akka" %% "akka-testkit" % Version
14+
}
15+
16+
object Pekko {
17+
private val Version = "1.2.0"
18+
19+
val Stream = "org.apache.pekko" %% "pekko-stream" % Version
20+
val Testkit = "org.apache.pekko" %% "pekko-testkit" % Version
21+
}
22+
23+
object AkkaToPekkoAdapter {
24+
private val Version = "1.0.0"
25+
26+
val Actor = "com.evolution" %% "akka-to-pekko-adapter-actor" % Version
27+
val Stream = "com.evolution" %% "akka-to-pekko-adapter-stream" % Version
28+
val Testkit = "com.evolution" %% "akka-to-pekko-adapter-test-kit" % Version
29+
}
30+
}

project/ProjectMatrixSyntax.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import sbt.internal.ProjectMatrix
2+
3+
/** Provides missing syntax for [[ProjectMatrix]] */
4+
object ProjectMatrixSyntax {
5+
implicit class RichProjectMatrix(val inner: ProjectMatrix) extends AnyVal {
6+
7+
/** Same as [[sbt.Project.configure]] but for [[ProjectMatrix]] */
8+
def configureMatrix(f: ProjectMatrix => ProjectMatrix): ProjectMatrix = {
9+
f(inner)
10+
}
11+
}
12+
}

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.11.4
1+
sbt.version=1.11.6

project/plugins.sbt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
addSbtPlugin("com.evolution" % "sbt-artifactory-plugin" % "0.0.2")
22
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.3.1")
33
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.15")
4-
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.4")
4+
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.5")
55
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.14.3")
66
addSbtPlugin("com.evolution" % "sbt-scalac-opts-plugin" % "0.0.9")
77
addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "3.2.1")
8-
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.1.0")
9-
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
8+
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.1.1")
9+
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.7")
1010
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.11.0")

sequentially/src/main/scala/com/evolutiongaming/concurrent/sequentially/SequentialMap.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ trait SequentialMap[K, V] {
4141
def getOrUpdate(key: K)(newValue: => V): Future[V] = {
4242
update(key) {
4343
case Some(value) => (MapDirective.ignore, value)
44-
case None =>
44+
case None =>
4545
val value = newValue
4646
(MapDirective.update(value), value)
4747
}

sequentially/src/main/scala/com/evolutiongaming/concurrent/sequentially/Sequentially.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,8 @@ object Sequentially {
4949

5050
require(substreams > 0, s"substreams is $substreams")
5151

52-
case class Task(task: () => Unit)
53-
5452
def actor() = new Actor {
55-
def receive: Receive = { case Task(task) => task() }
53+
def receive: Receive = { case TaskActorMsg(task) => task() }
5654
}
5755

5856
val promise = Promise[Map[Int, ActorRef]]()
@@ -81,7 +79,7 @@ object Sequentially {
8179
val safeTask: () => Unit = () => promise complete Try(task)
8280
val substream = Substream(key, substreams)
8381
val ref = refs(substream)
84-
ref.tell(Task(safeTask), ActorRef.noSender)
82+
ref.tell(TaskActorMsg(safeTask), ActorRef.noSender)
8583
promise.future
8684
}
8785
}
@@ -137,4 +135,6 @@ object Sequentially {
137135
class Comap[A, B](tmp: A => B, sequentially: Sequentially[B]) extends Sequentially[A] {
138136
def apply[AA <: A, T](key: AA)(f: => T): Future[T] = sequentially(tmp(key))(f)
139137
}
138+
139+
private final case class TaskActorMsg(task: () => Unit)
140140
}

0 commit comments

Comments
 (0)