From d414d9f9b9a73cda216f00f802ca6721a0b9bf7c Mon Sep 17 00:00:00 2001 From: Naftoli Gugenheim Date: Fri, 7 May 2021 18:30:07 -0400 Subject: [PATCH] Add scala 3.0.0-RC3 Use scalac-options library --- .github/workflows/ci.yml | 14 ++++++- .mergify.yml | 1 + .../asterisk/AgiIvrCommandInterpreter.scala | 2 + build.sbt | 42 +++++++++++-------- .../simpleivr/Text2waveSpeakGenerator.scala | 1 + project/plugins.sbt | 1 + .../testing/InteractionTestBase.scala | 6 +-- 7 files changed, 44 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 870ea25..1d1eb14 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - scala: [2.12.13, 2.13.5] + scala: [2.12.13, 2.13.5, 3.0.0-RC3] java: [adopt@1.8] runs-on: ${{ matrix.os }} steps: @@ -71,7 +71,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - scala: [2.13.5] + scala: [3.0.0-RC3] java: [adopt@1.8] runs-on: ${{ matrix.os }} steps: @@ -117,6 +117,16 @@ jobs: tar xf targets.tar rm targets.tar + - name: Download target directories (3.0.0-RC3) + uses: actions/download-artifact@v2 + with: + name: target-${{ matrix.os }}-3.0.0-RC3-${{ matrix.java }} + + - name: Inflate target directories (3.0.0-RC3) + run: | + tar xf targets.tar + rm targets.tar + - env: PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} PGP_SECRET: ${{ secrets.PGP_SECRET }} diff --git a/.mergify.yml b/.mergify.yml index 0c7db39..f2bed27 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -5,6 +5,7 @@ pull_request_rules: - author=scala-steward - check-success=Build and Test (ubuntu-latest, 2.12.13, adopt@1.8) - check-success=Build and Test (ubuntu-latest, 2.13.5, adopt@1.8) + - check-success=Build and Test (ubuntu-latest, 3.0.0-RC3, adopt@1.8) actions: merge: strict: true diff --git a/asterisk/src/main/scala/simpleivr/asterisk/AgiIvrCommandInterpreter.scala b/asterisk/src/main/scala/simpleivr/asterisk/AgiIvrCommandInterpreter.scala index f8dd05c..1619148 100644 --- a/asterisk/src/main/scala/simpleivr/asterisk/AgiIvrCommandInterpreter.scala +++ b/asterisk/src/main/scala/simpleivr/asterisk/AgiIvrCommandInterpreter.scala @@ -48,11 +48,13 @@ trait AgiIvrCommandInterpreter extends IOIvrCommandInterpreter { override def waitForSilence(ms: Int, repeat: Int = 1, timeoutSec: Option[Int] = None) = IO { channel.exec("WaitForSilence", s"$ms,$repeat" + timeoutSec.map("," + _).getOrElse("")) + () } override def monitor(file: File) = IO { channel.exec("System", s"mkdir -p ${file.getParentFile.getAbsolutePath}") channel.exec("MixMonitor", file.getAbsolutePath) + () } override def hangup = IO { diff --git a/build.sbt b/build.sbt index 82b5d4e..e7ffdf3 100644 --- a/build.sbt +++ b/build.sbt @@ -1,27 +1,33 @@ -ThisBuild / crossScalaVersions := Seq("2.12.13", "2.13.5") +import _root_.io.github.nafg.scalacoptions.{ScalacOptions, options} + +ThisBuild / crossScalaVersions := Seq("2.12.13", "2.13.5", "3.0.0-RC3") ThisBuild / scalaVersion := (ThisBuild / crossScalaVersions).value.last ThisBuild / organization := "io.github.nafg.simpleivr" def ScalaTest = "org.scalatest" %% "scalatest" % "3.2.8" -ThisBuild / scalacOptions ++= Seq( - "-deprecation", - "-feature", - "-unchecked", - "-explaintypes", - "-Xlint:_", - "-Ywarn-dead-code", - "-Ywarn-extra-implicit", - "-Ywarn-numeric-widen", - "-Ywarn-unused:_", - "-Ywarn-value-discard" -) - ThisBuild / scalacOptions ++= - (if (scalaVersion.value.startsWith("2.12.")) - List("-language:higherKinds", "-Xfuture", "-Ypartial-unification") - else - Nil) + ScalacOptions.all(scalaVersion.value)( + (o: options.Common) => + o.deprecation ++ + o.feature ++ + o.unchecked, + (o: options.V2) => + o.explaintypes ++ Seq( + "-Xlint:_", + "-Ywarn-dead-code", + "-Ywarn-extra-implicit", + "-Ywarn-numeric-widen", + "-Ywarn-unused:_", + "-Ywarn-value-discard" + ), + (o: options.V2_12) => + o.language("higherKinds") ++ + o.Xfuture ++ + o.YpartialUnification, + (o: options.V3) => + o.explainTypes + ) lazy val core = project .settings( diff --git a/core/src/main/scala/simpleivr/Text2waveSpeakGenerator.scala b/core/src/main/scala/simpleivr/Text2waveSpeakGenerator.scala index f5812f1..79abc71 100644 --- a/core/src/main/scala/simpleivr/Text2waveSpeakGenerator.scala +++ b/core/src/main/scala/simpleivr/Text2waveSpeakGenerator.scala @@ -26,6 +26,7 @@ object Text2waveSpeakGenerator extends SpeakGenerator { text2wave.waitFor() Source.fromInputStream(text2wave.getErrorStream).getLines() foreach println Files.copy(tmpFile, Channels.newOutputStream(writeChan)) + () } } .flatMap { either => diff --git a/project/plugins.sbt b/project/plugins.sbt index 6aa7036..69d2880 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,4 @@ addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7") addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.10.1") libraryDependencies += "io.github.nafg.mergify" %% "mergify-writer" % "0.2.1" +libraryDependencies += "io.github.nafg.scalac-options" %% "scalac-options" % "0.1.4" diff --git a/testing/src/main/scala/simpleivr/testing/InteractionTestBase.scala b/testing/src/main/scala/simpleivr/testing/InteractionTestBase.scala index bee8854..ce1f807 100644 --- a/testing/src/main/scala/simpleivr/testing/InteractionTestBase.scala +++ b/testing/src/main/scala/simpleivr/testing/InteractionTestBase.scala @@ -1,10 +1,10 @@ package simpleivr.testing -import scala.io.AnsiColor - -import cats.Id +import cats.{Id, catsInstancesForId} import simpleivr.{IvrCommand, IvrStep} +import scala.io.AnsiColor + trait InteractionTestBase { case class RunWithConfig(error: String => Nothing, logIvrCommand: (IvrCommand[_], Any) => Unit = (_, _) => ()) {