From 4a050eb55e44f9fb5380f7718386e97653ac5bfa Mon Sep 17 00:00:00 2001 From: Yann Simon Date: Thu, 6 Oct 2022 18:24:24 +0200 Subject: [PATCH 1/2] cross-compile to scala 3 Fix https://github.com/sangria-graphql/sangria/issues/673 --- .github/workflows/ci.yml | 14 ++++++++++++-- build.sbt | 11 ++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 273eed7..4153d2c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: @@ -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: @@ -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 }} diff --git a/build.sbt b/build.sbt index 244c128..301334f 100644 --- a/build.sbt +++ b/build.sbt @@ -10,8 +10,12 @@ 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")) +val isScala3 = Def.setting( + CrossVersion.partialVersion(scalaVersion.value).exists(_._1 == 3) +) + // 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( @@ -23,7 +27,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") @@ -32,7 +36,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, From 2e1a3607a35050264225071997fbf38fb2b61977 Mon Sep 17 00:00:00 2001 From: Yann Simon Date: Thu, 6 Oct 2022 18:29:57 +0200 Subject: [PATCH 2/2] do not check mima for scala 3 as no scala 3 artifacts are present yet --- build.sbt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/build.sbt b/build.sbt index 301334f..81bd601 100644 --- a/build.sbt +++ b/build.sbt @@ -3,17 +3,19 @@ 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")) -val isScala3 = Def.setting( - CrossVersion.partialVersion(scalaVersion.value).exists(_._1 == 3) -) - // sbt-github-actions needs configuration in `ThisBuild` ThisBuild / crossScalaVersions := Seq("2.12.17", "2.13.8", "3.2.0") ThisBuild / scalaVersion := crossScalaVersions.value.last