Skip to content

Commit 566ce7f

Browse files
committed
Drop 2.12 support, add scalafmt, scalafix, MiMa
Source and binary compat preserved. The code changes: - scalafmt and scalafix formatting applied - added type annotations to public members and implicits - migrated to Scala 3 syntax for imports - since 2.12 is not supported anymore, replaced CurrentThreadExecutionContext wrapper with direct usage of ExecutionContext.parasitic. This as well leads to removal of the direct dependency on executor-tools as it is not used in the project anymore.
1 parent 9ffa9fe commit 566ce7f

29 files changed

Lines changed: 294 additions & 220 deletions

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ jobs:
1111
matrix:
1212
scala:
1313
- 2.13.14
14-
- 2.12.19
1514
- 3.3.3
1615

1716
steps:
@@ -25,7 +24,7 @@ jobs:
2524
java-version: openjdk@1.11
2625

2726
- name: build ${{ matrix.scala }}
28-
run: sbt ++${{ matrix.scala }} clean coverage test
27+
run: sbt ++${{ matrix.scala }} clean check coverage test
2928

3029
- name: test coverage
3130
if: success()

.scalafix.conf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
rules = [OrganizeImports]
2+
3+
OrganizeImports {
4+
preset = INTELLIJ_2020_3
5+
removeUnused = false # `true` is not supported in Scala 3.3.0
6+
targetDialect = Auto
7+
}

.scalafmt.conf

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
version = 3.8.3
2+
3+
runner.dialect = scala213source3
4+
5+
maxColumn = 110
6+
trailingCommas = multiple
7+
8+
align.preset = some
9+
indent.defnSite = 2
10+
indent.caseSite = 5
11+
indent.extendSite = 2
12+
indentOperator.exclude = "^(&&|\\|\\||~)$"
13+
newlines.avoidForSimpleOverflow = [punct, tooLong, slc]
14+
newlines.source = keep
15+
newlines.implicitParamListModifierForce = [after]
16+
spaces.beforeContextBoundColon = always
17+
spaces.inInterpolatedStringCurlyBraces = true
18+
verticalMultiline.atDefnSite = true
19+
verticalMultiline.arityThreshold = 3
20+
verticalMultiline.newlineAfterOpenParen = true
21+
danglingParentheses.exclude = []
22+
docstrings.oneline = fold
23+
docstrings.wrap = no
24+
importSelectors = singleLine
25+
26+
rewrite.rules = [
27+
RedundantParens,
28+
SortModifiers,
29+
]
30+
31+
rewrite.sortModifiers.order = [
32+
"override",
33+
"private",
34+
"protected",
35+
"implicit",
36+
"final",
37+
"sealed",
38+
"abstract",
39+
"lazy",
40+
]
Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
package com.evolutiongaming.concurrent.sequentially
22

3-
import java.util.concurrent.TimeUnit
3+
import org.openjdk.jmh.annotations.*
44

5-
import org.openjdk.jmh.annotations._
5+
import java.util.concurrent.TimeUnit
66

77
@State(Scope.Benchmark)
88
@Warmup(iterations = 5)
99
@Measurement(iterations = 10)
10-
@Fork(value = 1, jvmArgs = Array(
11-
"-server",
12-
"-Xms1g",
13-
"-Xmx1g",
14-
"-XX:NewSize=512m",
15-
"-XX:MaxNewSize=512m",
16-
"-XX:InitialCodeCacheSize=256m",
17-
"-XX:ReservedCodeCacheSize=256m",
18-
"-XX:-UseBiasedLocking",
19-
"-XX:+AlwaysPreTouch",
20-
"-XX:+UseParallelGC"))
10+
@Fork(
11+
value = 1,
12+
jvmArgs = Array(
13+
"-server",
14+
"-Xms1g",
15+
"-Xmx1g",
16+
"-XX:NewSize=512m",
17+
"-XX:MaxNewSize=512m",
18+
"-XX:InitialCodeCacheSize=256m",
19+
"-XX:ReservedCodeCacheSize=256m",
20+
"-XX:-UseBiasedLocking",
21+
"-XX:+AlwaysPreTouch",
22+
"-XX:+UseParallelGC",
23+
),
24+
)
2125
@BenchmarkMode(Array(Mode.Throughput))
2226
@OutputTimeUnit(TimeUnit.SECONDS)
23-
abstract class Common {
24-
25-
}
27+
abstract class Common {}

benchmark/src/main/scala/com/evolutiongaming/concurrent/sequentially/SequentiallyAsyncBenchmark.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import akka.stream.Materializer
55
import org.openjdk.jmh.annotations.{Benchmark, Level, Setup, TearDown}
66

77
import scala.concurrent.Await
8-
import scala.concurrent.duration._
8+
import scala.concurrent.duration.*
99

1010
class SequentiallyAsyncBenchmark extends Common {
1111

benchmark/src/main/scala/com/evolutiongaming/concurrent/sequentially/SequentiallyBenchmark.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package com.evolutiongaming.concurrent.sequentially
22

33
import akka.actor.ActorSystem
4-
import org.openjdk.jmh.annotations._
4+
import org.openjdk.jmh.annotations.*
55

66
import scala.concurrent.Await
7-
import scala.concurrent.duration._
8-
7+
import scala.concurrent.duration.*
98

109
class SequentiallyBenchmark extends Common {
1110

@@ -28,4 +27,4 @@ class SequentiallyBenchmark extends Common {
2827
Await.ready(system.terminate(), 15.seconds)
2928
()
3029
}
31-
}
30+
}

benchmark/src/main/scala/com/evolutiongaming/concurrent/sequentially/SequentiallyHandlerBenchmark.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import akka.stream.Materializer
55
import org.openjdk.jmh.annotations.{Benchmark, Level, Setup, TearDown}
66

77
import scala.concurrent.Await
8-
import scala.concurrent.duration._
8+
import scala.concurrent.duration.*
99

1010
class SequentiallyHandlerBenchmark extends Common {
1111

@@ -32,4 +32,3 @@ class SequentiallyHandlerBenchmark extends Common {
3232
()
3333
}
3434
}
35-

benchmark/src/main/scala/com/evolutiongaming/concurrent/sequentially/SequentiallyStreamBenchmark.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import akka.stream.Materializer
55
import org.openjdk.jmh.annotations.{Benchmark, Level, Setup, TearDown}
66

77
import scala.concurrent.Await
8-
import scala.concurrent.duration._
8+
import scala.concurrent.duration.*
99

1010
class SequentiallyStreamBenchmark extends Common {
1111

build.sbt

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,50 @@
11
lazy val commonSettings = Seq(
22
organization := "com.evolutiongaming",
3-
homepage := Some(new URL("http://github.com/evolution-gaming/sequentially")),
3+
homepage := Some(url("https://github.com/evolution-gaming/sequentially")),
44
startYear := Some(2018),
55
organizationName := "Evolution",
6-
organizationHomepage := Some(url("http://evolution.com")),
6+
organizationHomepage := Some(url("https://evolution.com")),
77
scalaVersion := crossScalaVersions.value.head,
8-
crossScalaVersions := Seq("2.13.14", "2.12.19", "3.3.3"),
8+
crossScalaVersions := Seq("2.13.14", "3.3.3"),
9+
Compile / scalacOptions ++= {
10+
if (scalaBinaryVersion.value == "2.13") {
11+
Seq(
12+
"-Xsource:3"
13+
)
14+
} else Seq.empty
15+
},
916
Compile / doc / scalacOptions += "-no-link-warnings",
1017
publishTo := Some(Resolver.evolutionReleases),
1118
licenses := Seq(("MIT", url("https://opensource.org/licenses/MIT"))),
1219
releaseCrossBuild := true,
13-
versionScheme := Some("semver-spec"))
20+
versionScheme := Some("semver-spec"),
21+
)
1422

23+
// Your next release will be binary compatible with the previous one,
24+
// but it may not be source compatible (ie, it will be a minor release).
25+
ThisBuild / versionPolicyIntention := Compatibility.BinaryAndSourceCompatible
1526

1627
lazy val root = (project
1728
in file(".")
1829
settings (name := "sequentially-root")
1930
settings commonSettings
2031
settings (publish / skip := true)
21-
aggregate(sequentially, benchmark, `sequentially-metrics`))
32+
aggregate (sequentially, benchmark, `sequentially-metrics`))
2233

2334
lazy val sequentially = (project
2435
in file("sequentially")
2536
settings (name := "sequentially")
2637
settings commonSettings
2738
settings (libraryDependencies ++= Seq(
28-
"com.typesafe.akka" %% "akka-stream" % "2.6.21",
29-
"com.typesafe.akka" %% "akka-testkit" % "2.6.21" % Test,
30-
"com.evolutiongaming" %% "executor-tools" % "1.0.4",
31-
"com.evolutiongaming" %% "future-helper" % "1.0.7",
32-
"org.scalatest" %% "scalatest" % "3.2.10" % Test)))
39+
"com.typesafe.akka" %% "akka-stream" % "2.6.21",
40+
"com.typesafe.akka" %% "akka-testkit" % "2.6.21" % Test,
41+
"com.evolutiongaming" %% "future-helper" % "1.0.7",
42+
"org.scalatest" %% "scalatest" % "3.2.10" % Test,
43+
)))
3344

3445
lazy val benchmark = (project
3546
in file("benchmark")
36-
enablePlugins(JmhPlugin)
47+
enablePlugins JmhPlugin
3748
settings (name := "benchmark")
3849
settings commonSettings
3950
dependsOn sequentially)
@@ -47,4 +58,10 @@ lazy val `sequentially-metrics` = (project
4758
"com.evolutiongaming" %% "prometheus-tools" % "1.0.8"
4859
)))
4960

50-
addCommandAlias("check", "show version")
61+
//used by evolution-gaming/scala-github-actions
62+
addCommandAlias(
63+
"check",
64+
"all versionPolicyCheck Compile/doc scalafmtCheckAll scalafmtSbtCheck; scalafixEnable; scalafixAll --check",
65+
)
66+
67+
addCommandAlias("fmtAll", "all scalafmtAll scalafmtSbt; scalafixEnable; scalafixAll")

project/plugins.sbt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
addSbtPlugin("com.evolution" % "sbt-artifactory-plugin" % "0.0.2")
2-
32
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.12")
4-
53
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.11")
6-
74
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.4.0")
8-
5+
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3")
6+
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.1")
97
addSbtPlugin("com.evolution" % "sbt-scalac-opts-plugin" % "0.0.9")
10-
11-
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
8+
addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "3.2.1")
9+
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")

0 commit comments

Comments
 (0)