Skip to content

Commit

Permalink
Merge pull request #213 from sangria-graphql/cross_compile_scala_3
Browse files Browse the repository at this point in the history
cross-compile to scala 3
  • Loading branch information
yanns authored Oct 6, 2022
2 parents 7d545c6 + 2e1a360 commit 52ab4e2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
14 changes: 12 additions & 2 deletions .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.8]
scala: [2.12.17, 2.13.8, 3.2.0]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.8]
scala: [3.2.0]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -127,6 +127,16 @@ jobs:
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.2.0)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-3.2.0-${{ matrix.java }}

- name: Inflate target directories (3.2.0)
run: |
tar xf targets.tar
rm targets.tar
- env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
Expand Down
15 changes: 11 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@ import com.typesafe.tools.mima.core.{DirectMissingMethodProblem, ProblemFilters}
name := "sangria-slowlog"
organization := "org.sangria-graphql"

mimaPreviousArtifacts := Set("org.sangria-graphql" %% "sangria-slowlog" % "2.0.2")
val isScala3 = Def.setting(
CrossVersion.partialVersion(scalaVersion.value).exists(_._1 == 3)
)

mimaPreviousArtifacts := {
if (isScala3.value) Set.empty else Set("org.sangria-graphql" %% "sangria-slowlog" % "2.0.2")
}

description := "Sangria middleware to log slow GraphQL queries"
homepage := Some(url("https://sangria-graphql.github.io/"))
licenses := Seq(
"Apache License, ASL Version 2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0"))

// sbt-github-actions needs configuration in `ThisBuild`
ThisBuild / crossScalaVersions := Seq("2.12.17", "2.13.8")
ThisBuild / crossScalaVersions := Seq("2.12.17", "2.13.8", "3.2.0")
ThisBuild / scalaVersion := crossScalaVersions.value.last
ThisBuild / githubWorkflowPublishTargetBranches := List()
ThisBuild / githubWorkflowBuildPreamble ++= List(
Expand All @@ -23,7 +29,7 @@ ThisBuild / mimaBinaryIssueFilters ++= Seq(
ProblemFilters.exclude[DirectMissingMethodProblem]("sangria.slowlog.SlowLog.even")
)

scalacOptions += "-target:jvm-1.8"
scalacOptions += { if (isScala3.value) "-Xtarget:8" else "-target:jvm-1.8" }
javacOptions ++= Seq("-source", "8", "-target", "8")

scalacOptions ++= Seq("-deprecation", "-feature")
Expand All @@ -32,7 +38,8 @@ libraryDependencies ++= Seq(
"org.sangria-graphql" %% "sangria" % "3.3.0",
"io.dropwizard.metrics" % "metrics-core" % "4.2.12",
"org.slf4j" % "slf4j-api" % "2.0.1",
"io.opentracing.contrib" %% "opentracing-scala-concurrent" % "0.0.6",
("io.opentracing.contrib" %% "opentracing-scala-concurrent" % "0.0.6").cross(
CrossVersion.for3Use2_13),
"io.opentracing" % "opentracing-mock" % "0.33.0" % Test,
"org.scalatest" %% "scalatest" % "3.2.13" % Test,
"org.sangria-graphql" %% "sangria-json4s-native" % "1.0.2" % Test,
Expand Down

0 comments on commit 52ab4e2

Please sign in to comment.