diff --git a/build.sbt b/build.sbt index 5b058c56..ff2bc24b 100644 --- a/build.sbt +++ b/build.sbt @@ -3,7 +3,7 @@ import ScalaModulePlugin._ scalaVersionsByJvm in ThisBuild := { val v211 = "2.11.12" val v212 = "2.12.6" - val v213 = "2.13.0-M3" + val v213 = "2.13.0-M4" Map( 6 -> List(v211 -> true), @@ -38,7 +38,15 @@ lazy val `scala-parser-combinators` = crossProject.in(file(".")). "Scala Parser Combinators", "-doc-version", version.value - ) + ), + unmanagedSourceDirectories in Compile ++= { + (unmanagedSourceDirectories in Compile).value.map { dir => + CrossVersion.partialVersion(scalaVersion.value) match { + case Some((2, 13)) => file(dir.getPath ++ "-2.13") + case _ => file(dir.getPath ++ "-2.11-2.12") + } + } + } ). jvmSettings( OsgiKeys.exportPackage := Seq(s"scala.util.parsing.*;version=${version.value}"), diff --git a/project/plugins.sbt b/project/plugins.sbt index fdd0d207..66658960 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,3 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.14") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.23") diff --git a/shared/src/main/scala-2.11-2.12/scala/util/parsing/input/ScalaVersionSpecificPagedSeq.scala b/shared/src/main/scala-2.11-2.12/scala/util/parsing/input/ScalaVersionSpecificPagedSeq.scala new file mode 100644 index 00000000..8ddd6bf5 --- /dev/null +++ b/shared/src/main/scala-2.11-2.12/scala/util/parsing/input/ScalaVersionSpecificPagedSeq.scala @@ -0,0 +1,5 @@ +package scala.util.parsing.input + +private[input] trait ScalaVersionSpecificPagedSeq[T] { + // Nothing for 2.11 and 2.12! +} \ No newline at end of file diff --git a/shared/src/main/scala-2.13/scala/util/parsing/input/ScalaVersionSpecificPagedSeq.scala b/shared/src/main/scala-2.13/scala/util/parsing/input/ScalaVersionSpecificPagedSeq.scala new file mode 100644 index 00000000..0c1ca5a9 --- /dev/null +++ b/shared/src/main/scala-2.13/scala/util/parsing/input/ScalaVersionSpecificPagedSeq.scala @@ -0,0 +1,7 @@ +package scala.util.parsing.input + +private[input] trait ScalaVersionSpecificPagedSeq[T] { self: PagedSeq[T] => + // Members declared in scala.collection.Seq + override def iterableFactory: collection.SeqFactory[collection.IndexedSeq] = collection.IndexedSeq + +} diff --git a/shared/src/main/scala/scala/util/parsing/input/PagedSeq.scala b/shared/src/main/scala/scala/util/parsing/input/PagedSeq.scala index ba12ec28..1e775817 100644 --- a/shared/src/main/scala/scala/util/parsing/input/PagedSeq.scala +++ b/shared/src/main/scala/scala/util/parsing/input/PagedSeq.scala @@ -129,6 +129,7 @@ class PagedSeq[T: ClassTag] protected( end: Int) extends scala.collection.AbstractSeq[T] with scala.collection.IndexedSeq[T] + with ScalaVersionSpecificPagedSeq[T] { def this(more: (Array[T], Int, Int) => Int) = this(more, new Page[T](0), 0, UndeterminedEnd) diff --git a/shared/src/test/scala/scala/util/parsing/combinator/UnitTestIO.scala b/shared/src/test/scala/scala/util/parsing/combinator/UnitTestIO.scala index f754c682..10387eb4 100644 --- a/shared/src/test/scala/scala/util/parsing/combinator/UnitTestIO.scala +++ b/shared/src/test/scala/scala/util/parsing/combinator/UnitTestIO.scala @@ -25,7 +25,7 @@ class UnitTestIO { val s = "Here is a test string" val f = io.Source.fromBytes(s.getBytes("utf-8")) val b = new collection.mutable.ArrayBuffer[Char]() - f.copyToBuffer(b) + b ++= f assertEquals(new String(b.toArray), s) } }