Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scala 2.13 support #6

Merged
merged 3 commits into from
Oct 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
language: scala

jdk:
- oraclejdk8
- openjdk8

scala:
- 2.11.12
- 2.12.7
- 2.12.9
- 2.13.0
Copy link
Owner

@mdedetrich mdedetrich Oct 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use Scala 2.13.1 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately the latest version of sbt-scoverage does not work with Scala 2.13.1 (see issue scoverage/sbt-scoverage#295).

For example when building for Scala 2.13.1:

sbt ++2.13.1 clean coverage test coverageReport

result to a java.lang.NoSuchMethodError

[error] java.lang.NoSuchMethodError: scala.tools.nsc.Global.reporter()Lscala/tools/nsc/reporters/Reporter;
[error] 	at scoverage.ScoverageInstrumentationComponent$$anon$1.run(plugin.scala:119)
[error] 	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1506)
[error] 	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1490)
[error] 	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1482)
[error] 	at scala.tools.nsc.Global$Run.compile(Global.scala:1614)
[error] 	at xsbt.CachedCompiler0.run(CompilerInterface.scala:130)
[error] 	at xsbt.CachedCompiler0.run(CompilerInterface.scala:105)
[error] 	at xsbt.CompilerInterface.run(CompilerInterface.scala:31)
[error] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] 	at java.lang.reflect.Method.invoke(Method.java:498)
[error] 	at sbt.internal.inc.AnalyzingCompiler.call(AnalyzingCompiler.scala:237)
[error] 	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:111)
[error] 	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:90)
[error] 	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3(MixedAnalyzingCompiler.scala:82)
[error] 	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] 	at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:133)
[error] 	at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:73)
[error] 	at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:116)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:307)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:307)
[error] 	at sbt.internal.inc.Incremental$.doCompile(Incremental.scala:106)
[error] 	at sbt.internal.inc.Incremental$.$anonfun$compile$4(Incremental.scala:87)
[error] 	at sbt.internal.inc.IncrementalCommon.recompileClasses(IncrementalCommon.scala:116)
[error] 	at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:63)
[error] 	at sbt.internal.inc.Incremental$.$anonfun$compile$3(Incremental.scala:89)
[error] 	at sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:134)
[error] 	at sbt.internal.inc.Incremental$.compile(Incremental.scala:80)
[error] 	at sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:67)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:311)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:269)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:159)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:238)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:69)
[error] 	at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:1549)
[error] 	at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:1523)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:40)
[error] 	at sbt.std.Transform$$anon$4.work(System.scala:67)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:269)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] 	at sbt.Execute.work(Execute.scala:278)
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:269)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] 	at java.lang.Thread.run(Thread.java:748)

On the other hand, for Scala 2.13.0, sbt-scoverage works fine.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okie dokie, we can update it later when they fix the problem then. Will release this PR tonight, thanks for the contribution!


cache:
directories:
Expand Down
47 changes: 29 additions & 18 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
name := "akka-streams-json"

val currentScalaVersion = "2.12.7"
val scala213Version = "2.13.1"
val scala212Version = "2.12.9"
val scala211Version = "2.11.12"
val circeVersion = "0.11.1"
val akkaVersion = "2.5.17"
val akkaHttpVersion = "10.1.5"
val jawnVersion = "0.14.1"
val scalaTestVersion = "3.0.5"

scalaVersion in ThisBuild := currentScalaVersion
crossScalaVersions in ThisBuild := Seq(currentScalaVersion, scala211Version)

val circeLatestVersion = "0.12.1" // for Scala 2.12 and 2.13
val circeOldVersion = "0.11.1" // only for scala 2.11
val akkaVersion = "2.5.25"
val akkaHttpVersion = "10.1.9"
val jawnVersion = "0.14.2"
val scalaTestVersion = "3.0.8"

// helper function to choose the appropriate version of circer
def circeVersion(scalaVer: String): String =
if(scalaVer.startsWith("2.11") ) circeOldVersion else circeLatestVersion

scalaVersion in ThisBuild := scala213Version
crossScalaVersions in ThisBuild := Seq(scala211Version, scala212Version, scala213Version)
organization in ThisBuild := "org.mdedetrich"

lazy val streamJson = project.in(file("stream-json")) settings (
Expand All @@ -28,7 +35,7 @@ lazy val httpJson = project.in(file("http-json")) settings (
lazy val streamCirce = project.in(file("support") / "stream-circe") settings (
name := "akka-stream-circe",
libraryDependencies ++= Seq("com.typesafe.akka" %% "akka-stream" % akkaVersion % Provided,
"io.circe" %% "circe-jawn" % circeVersion)
"io.circe" %% "circe-jawn" % circeVersion(scalaVersion.value))
) dependsOn streamJson

lazy val httpCirce = project.in(file("support") / "http-circe") settings (
Expand All @@ -45,7 +52,7 @@ lazy val tests = project.in(file("tests")) dependsOn (streamJson, httpJson, stre
List(
"com.typesafe.akka" %% "akka-http" % akkaHttpVersion % Test,
"org.scalatest" %% "scalatest" % scalaTestVersion % Test,
"io.circe" %% "circe-generic" % circeVersion % "test"
"io.circe" %% "circe-generic" % circeVersion(scalaVersion.value) % "test"
),
skip in publish := true
)
Expand All @@ -59,9 +66,7 @@ scalacOptions in ThisBuild ++= Seq(
"-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-adapted-args", // Warn if an argument list is modified to match the receiver
"-Ywarn-value-discard", // Warn when non-Unit expression results are unused
"-Ywarn-inaccessible",
"-Ywarn-dead-code",
"-language:postfixOps"
)
Expand All @@ -70,10 +75,6 @@ Defaults.itSettings

configs(IntegrationTest)

val enumeratumVersion = "1.5.12"
val enumeratumCirceVersion = "1.5.14"
val akkaStreamJson = "3.4.0"

homepage in ThisBuild := Some(url("https://github.com/mdedetrich/akka-streams-json"))

scmInfo in ThisBuild := Some(
Expand Down Expand Up @@ -129,12 +130,22 @@ val flagsFor11 = Seq(
val flagsFor12 = Seq(
"-Xlint:_",
"-Ywarn-infer-any",
"-Ywarn-adapted-args", // Warn if an argument list is modified to match the receiver
"-Ywarn-inaccessible",
"-Ywarn-infer-any",
"-opt-inline-from:<sources>"
)

val flagsFor13 = Seq(
"-Xlint:_",
"-opt-inline-from:<sources>"
)

scalacOptions in ThisBuild ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n >= 12 =>
case Some((2, n)) if n == 13 =>
flagsFor13
case Some((2, n)) if n == 12 =>
flagsFor12
case Some((2, n)) if n == 11 =>
flagsFor11
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.1.4
sbt.version=1.2.8
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.9")

addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.5.1")

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0")

addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.3.0")
2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version in ThisBuild := "0.3.0"
version in ThisBuild := "0.4.0"