From 9069d8eb89cd6f9be3c164d5d8e82d70e0fd6c49 Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Thu, 2 Aug 2018 12:34:56 +0900 Subject: [PATCH] Scala 2.13.0-M4 --- .travis.yml | 4 +++ build.sbt | 26 +++++++++++++------ .../main/scala/algebra/ring/Additive.scala | 2 +- .../scala/algebra/ring/Multiplicative.scala | 2 +- project/plugins.sbt | 3 ++- 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index d820fb43..96121bcc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,10 @@ matrix: - scala: 2.12.3 jdk: oraclejdk8 env: DEPLOY=true + - scala: 2.13.0-M4 + script: + # TODO https://github.com/scoverage/scalac-scoverage-plugin/issues/225 + - ./sbt "++${TRAVIS_SCALA_VERSION}!" coreJS/test lawsJS/test coreJVM/test lawsJVM/test before_install: - export PATH=${PATH}:./vendor/bundle diff --git a/build.sbt b/build.sbt index 58190b01..554e3965 100644 --- a/build.sbt +++ b/build.sbt @@ -1,17 +1,18 @@ import sbtrelease.Utilities._ import ReleaseTransformations._ import microsites.ExtraMdFileConfig +import sbtcrossproject.{crossProject, CrossType} -lazy val scalaCheckVersion = "1.13.5" -lazy val scalaTestVersion = "3.0.4" +lazy val scalaCheckVersion = "1.14.0" +lazy val scalaTestVersion = "3.0.6-SNAP1" lazy val disciplineVersion = "0.8" -lazy val catsVersion = "1.0.1" +lazy val catsVersion = "1.2.0" lazy val catalystsVersion = "0.0.5" lazy val buildSettings = Seq( organization := "org.typelevel", scalaVersion := "2.12.4", - crossScalaVersions := Seq("2.10.7", "2.11.12", "2.12.4") + crossScalaVersions := Seq("2.10.7", "2.11.12", "2.12.4", "2.13.0-M4") ) lazy val commonSettings = Seq( @@ -23,9 +24,7 @@ lazy val commonSettings = Seq( "-language:higherKinds", "-language:implicitConversions", "-unchecked", - "-Xfatal-warnings", "-Xlint", - "-Yno-adapted-args", "-Ywarn-dead-code", "-Ywarn-numeric-widen", //"-Ywarn-value-discard", // fails with @sp on Unit @@ -34,6 +33,17 @@ lazy val commonSettings = Seq( case Some((2, 10)) => Seq.empty case _ => Seq("-Ywarn-unused-import") }), + scalacOptions ++= { + CrossVersion.partialVersion(scalaVersion.value) match { + case Some((2, v)) if v <= 12 => + Seq( + "-Xfatal-warnings", + "-Yno-adapted-args" + ) + case _ => + Nil + } + }, resolvers += Resolver.sonatypeRepo("public"), scalacOptions in (Compile, console) ~= (_ filterNot (_ == "-Ywarn-unused-import")), scalacOptions in (Test, console) := (scalacOptions in (Compile, console)).value, @@ -111,7 +121,7 @@ val ignoredABIProblems = { ) } -lazy val core = crossProject +lazy val core = crossProject(JSPlatform, JVMPlatform) .crossType(CrossType.Pure) .enablePlugins(MimaPlugin) .settings(moduleName := "algebra") @@ -129,7 +139,7 @@ lazy val core = crossProject lazy val coreJVM = core.jvm lazy val coreJS = core.js -lazy val laws = crossProject +lazy val laws = crossProject(JSPlatform, JVMPlatform) .crossType(CrossType.Pure) .enablePlugins(MimaPlugin) .dependsOn(core) diff --git a/core/src/main/scala/algebra/ring/Additive.scala b/core/src/main/scala/algebra/ring/Additive.scala index 45e66d3e..2f2e4d6c 100644 --- a/core/src/main/scala/algebra/ring/Additive.scala +++ b/core/src/main/scala/algebra/ring/Additive.scala @@ -31,7 +31,7 @@ trait AdditiveSemigroup[@sp(Int, Long, Float, Double) A] extends Any with Serial * If the sequence is empty, returns None. Otherwise, returns Some(total). */ def trySum(as: TraversableOnce[A]): Option[A] = - as.reduceOption(plus) + as.toIterator.reduceOption(plus) } trait AdditiveCommutativeSemigroup[@sp(Int, Long, Float, Double) A] extends Any with AdditiveSemigroup[A] { diff --git a/core/src/main/scala/algebra/ring/Multiplicative.scala b/core/src/main/scala/algebra/ring/Multiplicative.scala index a27e04cb..841caadb 100644 --- a/core/src/main/scala/algebra/ring/Multiplicative.scala +++ b/core/src/main/scala/algebra/ring/Multiplicative.scala @@ -31,7 +31,7 @@ trait MultiplicativeSemigroup[@sp(Int, Long, Float, Double) A] extends Any with * If the sequence is empty, returns None. Otherwise, returns Some(total). */ def tryProduct(as: TraversableOnce[A]): Option[A] = - as.reduceOption(times) + as.toIterator.reduceOption(times) } trait MultiplicativeCommutativeSemigroup[@sp(Int, Long, Float, Double) A] extends Any with MultiplicativeSemigroup[A] { diff --git a/project/plugins.sbt b/project/plugins.sbt index 8e332311..9ac39615 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,7 +4,8 @@ addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.7") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3") addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.2") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.24") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.18") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.3") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.5.0")