Skip to content
This repository was archived by the owner on Sep 18, 2025. It is now read-only.

Commit 6269592

Browse files
committed
Major maintenance update - add Scala 2.13, drop 2.12
Due to updated dependencies in this change and before that, the next release has to be 6.0.0. * Updated Scala versions, added support for Scala 3. * New dependency versions forced dropping Scala 2.12 - bye bye! * Updated sbt, plugins, dependencies. * Added bincompat checks. * Updated gitlab actions to the latest.
1 parent a7746cc commit 6269592

16 files changed

Lines changed: 129 additions & 78 deletions

File tree

.github/workflows/ci.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: CI
22

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

55
jobs:
66
test:
@@ -10,18 +10,26 @@ jobs:
1010
strategy:
1111
matrix:
1212
scala:
13-
- 2.13.15
14-
- 2.12.20
13+
- 2.13.16
14+
- 3.3.6
1515

1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v4
1818

19-
- uses: coursier/cache-action@v5
19+
- uses: coursier/cache-action@v6
2020

21-
- name: scala
22-
uses: olafurpg/setup-scala@v10
21+
- name: setup Java 17
22+
uses: actions/setup-java@v4
2323
with:
24-
java-version: openjdk@1.11
24+
java-version: '17'
25+
distribution: 'oracle'
26+
cache: 'sbt'
27+
28+
- name: setup SBT
29+
uses: sbt/setup-sbt@v1
30+
31+
- name: check code ${{ matrix.scala }}
32+
run: sbt ++${{ matrix.scala }} clean check
2533

2634
- name: build ${{ matrix.scala }}
2735
run: sbt ++${{ matrix.scala }} clean coverage test

.github/workflows/release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
name: Publish new Release
1+
name: Publish Release
22

33
on:
4-
release:
5-
types: [published]
6-
branches: [master]
4+
push:
5+
tags:
6+
- 'v*'
77

88
jobs:
99
release:
10-
uses: evolution-gaming/scala-github-actions/.github/workflows/release.yml@v1
10+
uses: evolution-gaming/scala-github-actions/.github/workflows/release.yml@v4
1111
secrets: inherit

build.sbt

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import Dependencies._
1+
import Dependencies.*
22

33
ThisBuild / versionScheme := Some("semver-spec")
4+
ThisBuild / versionPolicyIntention := Compatibility.BinaryCompatible
45

56
lazy val modules: List[ProjectReference] = List(
67
`stracer`,
@@ -15,23 +16,33 @@ lazy val root = project
1516
.settings(commonSettings)
1617
.settings(alias)
1718
.settings(publish / skip := true)
18-
.aggregate(modules: _*)
19+
.aggregate(modules *)
1920

2021
lazy val `stracer` = project
2122
.settings(commonSettings)
2223
.settings(
2324
libraryDependencies ++= Seq(
2425
zipkin,
2526
random,
26-
Scodec.core,
2727
Scodec.bits,
2828
`cats-helper`,
2929
Cats.core,
3030
CatsEffect.effect,
3131
configTools,
32-
Pureconfig.pureconfig,
3332
scalatest % Test,
3433
),
34+
libraryDependencies ++= crossSettings(
35+
scalaVersion = scalaVersion.value,
36+
if2 = Seq(
37+
Pureconfig.Scala2.pureconfig,
38+
Scodec.Scala2.core,
39+
),
40+
if3 = Seq(
41+
Pureconfig.Scala3.core,
42+
Pureconfig.Scala3.generic,
43+
Scodec.Scala3.core,
44+
),
45+
),
3546
)
3647

3748
lazy val `stracer-play-json` = project
@@ -64,15 +75,45 @@ val commonSettings = Seq(
6475
organizationName := "Evolution",
6576
organizationHomepage := Some(url("https://evolution.com")),
6677
scalaVersion := crossScalaVersions.value.head,
67-
crossScalaVersions := Seq("2.13.15", "2.12.20"),
68-
releaseCrossBuild := true,
78+
crossScalaVersions := Seq("2.13.16", "3.3.6"),
79+
scalacOptions ++= Seq(
80+
"-release:17",
81+
"-deprecation",
82+
),
83+
scalacOptions ++= crossSettings(
84+
scalaVersion = scalaVersion.value,
85+
if2 = Seq(
86+
"-Xsource:3",
87+
),
88+
// Good compiler options for Scala 2.13 are coming from com.evolution:sbt-scalac-opts-plugin:0.0.9,
89+
// but its support for Scala 3 is limited, especially what concerns linting options.
90+
//
91+
// If Scala 3 is made the primary target, good linting scalac options for it should be added first.
92+
if3 = Seq(
93+
"-Ykind-projector:underscores",
94+
95+
// disable new brace-less syntax:
96+
// https://alexn.org/blog/2022/10/24/scala-3-optional-braces/
97+
"-no-indent",
98+
99+
// improve error messages:
100+
"-explain",
101+
"-explain-types",
102+
),
103+
),
69104
licenses := Seq(("MIT", url("https://opensource.org/licenses/MIT"))),
70105
publishTo := Some(Resolver.evolutionReleases),
71106
scalacOptsFailOnWarn := Some(false),
72107
)
73108

74109
val alias: Seq[sbt.Def.Setting[?]] =
75-
// addCommandAlias("check", "all versionPolicyCheck Compile/doc") ++
76-
addCommandAlias("check", "all Compile/doc scalafmtCheckAll scalafmtSbtCheck") ++
110+
addCommandAlias("check", "all versionPolicyCheck Compile/doc scalafmtCheckAll scalafmtSbtCheck") ++
77111
addCommandAlias("build", "+all compile test") ++
78112
addCommandAlias("fmt", "+all scalafmtAll scalafmtSbt")
113+
114+
def crossSettings[T](scalaVersion: String, if3: T, if2: T): T = {
115+
scalaVersion match {
116+
case version if version.startsWith("3") => if3
117+
case _ => if2
118+
}
119+
}

project/Dependencies.scala

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,63 @@
1-
import sbt._
1+
import sbt.*
22

33
object Dependencies {
44

5-
val scalatest = "org.scalatest" %% "scalatest" % "3.2.15"
5+
val scalatest = "org.scalatest" %% "scalatest" % "3.2.19"
66
val zipkin = "io.zipkin.zipkin2" % "zipkin" % "2.21.6"
7-
val `cats-helper` = "com.evolutiongaming" %% "cats-helper" % "3.5.0"
8-
val random = "com.evolutiongaming" %% "random" % "1.0.0"
9-
val configTools = "com.evolutiongaming" %% "config-tools" % "1.0.4"
10-
val skafka = "com.evolutiongaming" %% "skafka" % "17.1.2"
7+
val `cats-helper` = "com.evolutiongaming" %% "cats-helper" % "3.12.2"
8+
val random = "com.evolution" %% "random" % "1.0.5"
9+
val configTools = "com.evolutiongaming" %% "config-tools" % "1.0.5"
10+
val skafka = "com.evolutiongaming" %% "skafka" % "17.2.0"
1111

1212
object Cats {
13-
private val version = "2.8.0"
13+
private val version = "2.13.0"
1414
val core = "org.typelevel" %% "cats-core" % version
1515
}
1616

1717
object CatsEffect {
18-
private val version = "3.5.3"
18+
private val version = "3.5.7"
1919
val effect = "org.typelevel" %% "cats-effect" % version
2020
}
2121

2222
object Scodec {
23-
val core = "org.scodec" %% "scodec-core" % "1.11.7"
24-
val bits = "org.scodec" %% "scodec-bits" % "1.1.18"
23+
val bits = "org.scodec" %% "scodec-bits" % "1.2.4"
24+
25+
// see https://github.com/scodec/scodec/issues/365
26+
object Scala2 {
27+
val core = "org.scodec" %% "scodec-core" % "1.11.11" // the last scodec-core version built for 2.13
28+
}
29+
30+
object Scala3 {
31+
val core = "org.scodec" %% "scodec-core" % "2.3.3"
32+
}
2533
}
2634

2735
object PlayJsonTools {
28-
private val version = "1.1.1"
36+
private val version = "1.2.3"
2937

3038
val tools = "com.evolution" %% "play-json-tools" % version
3139
}
3240

3341
object Circe {
34-
private val version = "0.14.9"
35-
private val versionExtras = "0.14.1"
42+
private val version = "0.14.14"
3643

3744
val core = "io.circe" %% "circe-core" % version
3845
val generic = "io.circe" %% "circe-generic" % version
3946
val parser = "io.circe" %% "circe-parser" % version
40-
val `generic-extras` = "io.circe" %% "circe-generic-extras" % versionExtras
4147

42-
val all: Seq[ModuleID] = Seq(core, generic, parser, `generic-extras`)
48+
val all: Seq[ModuleID] = Seq(core, generic, parser)
4349
}
4450

4551
object Pureconfig {
46-
private val version = "0.17.3"
47-
val pureconfig = "com.github.pureconfig" %% "pureconfig" % version
48-
val cats = "com.github.pureconfig" %% "pureconfig-cats" % version
52+
private val version = "0.17.8"
53+
54+
object Scala2 {
55+
val pureconfig = "com.github.pureconfig" %% "pureconfig" % version
56+
}
57+
58+
object Scala3 {
59+
val core = "com.github.pureconfig" %% "pureconfig-core" % version
60+
val generic = "com.github.pureconfig" %% "pureconfig-generic-scala3" % version
61+
}
4962
}
5063
}

project/build.properties

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

project/plugins.sbt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.2.1")
2-
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.1")
3-
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")
1+
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.3.1")
2+
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.15")
43
addSbtPlugin("com.evolution" % "sbt-scalac-opts-plugin" % "0.0.9")
54
addSbtPlugin("com.evolution" % "sbt-artifactory-plugin" % "0.0.2")
65
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.5")
6+
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.1.1")
7+
addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "3.2.1")

stracer-kafka/src/main/scala/com/evolutiongaming/stracer/ReportSpanRecord.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ object ReportSpanRecord {
3838
producerConfig <- config.getOpt[Config]("kafka.producer").map(ProducerConfig(_))
3939
} yield {
4040
val topic = config.getOpt[String]("topic") getOrElse "jaeger"
41-
implicit val toBytes = ToBytesOf(SpanBytesEncoder.THRIFT)
41+
implicit val toBytes: ToBytes[F, Nel[SpanRecord]] = ToBytesOf(SpanBytesEncoder.THRIFT)
4242
of[F](topic, producerConfig, enabled, producerOf)
4343
}
4444

stracer-kafka/src/main/scala/com/evolutiongaming/stracer/ToBytesOf.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ package com.evolutiongaming.stracer
33
import cats.data.{NonEmptyList => Nel}
44
import cats.effect.Sync
55
import com.evolutiongaming.skafka.{ToBytes, Topic}
6-
import com.evolutiongaming.stracer.compat.CollectionConverters._
76
import zipkin2.codec.SpanBytesEncoder
87

8+
import scala.jdk.CollectionConverters.*
9+
910
object ToBytesOf {
1011

1112
def apply[F[_]: Sync](encode: SpanBytesEncoder): ToBytes[F, Nel[SpanRecord]] = {

stracer/src/main/scala-2.12/com/evolutiongaming/stracer/compat.scala

Lines changed: 0 additions & 5 deletions
This file was deleted.

stracer/src/main/scala-2.13/com/evolutiongaming/stracer/compat.scala

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)