Skip to content

Commit

Permalink
Add Scala 3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
mdedetrich committed Jun 2, 2023
1 parent 22b43b4 commit 9dd5d93
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.17, 2.13.10]
scala: [2.12.17, 2.13.10, 3.3.0]
java: [temurin@8, temurin@11, temurin@17]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -158,6 +158,16 @@ jobs:
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.3.0)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-3.3.0-${{ matrix.java }}

- name: Inflate target directories (3.3.0)
run: |
tar xf targets.tar
rm targets.tar
- name: Publish project
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
Expand Down
19 changes: 13 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name := "pekko-streams-circe"

val scala213Version = "2.13.10"
val scala212Version = "2.12.17"
val scala3Version = "3.3.0"

ThisBuild / resolvers += Resolver.ApacheMavenSnapshotsRepo

Expand All @@ -13,8 +14,8 @@ val pekkoHttpVersion = "0.0.0+4411-6fe04045-SNAPSHOT"
val jawnVersion = "1.5.0"
val scalaTestVersion = "3.2.16"

ThisBuild / crossScalaVersions := Seq(scala212Version, scala213Version)
ThisBuild / scalaVersion := (ThisBuild / crossScalaVersions).value.last
ThisBuild / crossScalaVersions := Seq(scala212Version, scala213Version, scala3Version)
ThisBuild / scalaVersion := scala213Version
ThisBuild / organization := "org.mdedetrich"
ThisBuild / mimaFailOnNoPrevious := false // Set this to true when we start caring about binary compatibility
ThisBuild / versionScheme := Some(VersionScheme.EarlySemVer)
Expand Down Expand Up @@ -94,10 +95,6 @@ ThisBuild / scalacOptions ++= Seq(
"-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
"-Xlint", // recommended additional warnings
"-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",
"-language:postfixOps"
)

Expand Down Expand Up @@ -125,26 +122,36 @@ 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 ++= {
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
}
}

Expand Down

0 comments on commit 9dd5d93

Please sign in to comment.