Skip to content

add Dotty cross-build #113

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

Merged
merged 2 commits into from
Oct 26, 2020
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ language: scala

scala:
- 2.13.3
- 0.27.0-RC1

env:
- ADOPTOPENJDK=8
Expand Down
39 changes: 34 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
Global / cancelable := true
publish / skip := true // in root

Global / scalacOptions ++= (
if (isDotty.value) Seq("-language:implicitConversions") // TODO check again on 3.0.0-M1
else Seq()
)

lazy val commonSettings: Seq[Setting[_]] =
ScalaModulePlugin.scalaModuleSettings ++ Seq(
Compile / compile / scalacOptions += "-Werror"
Compile / compile / scalacOptions --= (if (isDotty.value) Seq("-Xlint")
else Seq()),
Compile / compile / scalacOptions ++= (if (isDotty.value) Seq()
else Seq("-Werror")),
)

lazy val core = project.in(file("core"))
.settings(commonSettings)
.settings(
name := "scala-parallel-collections"
name := "scala-parallel-collections",
// don't run Dottydoc, it errors and isn't needed anyway
Compile / doc / sources := (if (isDotty.value) Seq() else (Compile / doc/ sources).value),
Compile / packageDoc / publishArtifact := !isDotty.value,
)

lazy val junit = project.in(file("junit"))
Expand All @@ -20,13 +31,22 @@ lazy val junit = project.in(file("junit"))
libraryDependencies += "javax.xml.bind" % "jaxb-api" % "2.3.1" % Test,
testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-v"),
Test / fork := true,
publish / skip := true
publish / skip := true,
// https://github.com/sbt/sbt/pull/5919 adds this to sbt itself,
// so we should revisit once sbt 1.4.1 is available
Test / unmanagedSourceDirectories += {
val major = CrossVersion.partialVersion(scalaVersion.value) match {
case Some((0 | 3, _)) => "3"
case _ => "2"
}
baseDirectory.value / "src" / "test" / s"scala-$major"
},
).dependsOn(testmacros, core)

lazy val scalacheck = project.in(file("scalacheck"))
.settings(commonSettings)
.settings(
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.14.3",
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.15.0-M1" withDottyCompat(scalaVersion.value),
Test / fork := true,
Test / testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-workers", "1", "-minSize", "0", "-maxSize", "4000", "-minSuccessfulTests", "5"),
publish / skip := true
Expand All @@ -36,5 +56,14 @@ lazy val testmacros = project.in(file("testmacros"))
.settings(commonSettings)
.settings(
libraryDependencies += scalaOrganization.value % "scala-compiler" % scalaVersion.value,
publish / skip := true
publish / skip := true,
// https://github.com/sbt/sbt/pull/5919 adds this to sbt itself,
// so we should revisit once sbt 1.4.1 is available
Compile / unmanagedSourceDirectories += {
val major = CrossVersion.partialVersion(scalaVersion.value) match {
case Some((0 | 3, _)) => "3"
case _ => "2"
}
baseDirectory.value / "src" / "main" / s"scala-$major"
},
)
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@
package scala
package collection

import parallel.Combiner

trait CustomParallelizable[+A, +ParRepr <: Parallel] extends Any with Parallelizable[A, ParRepr] {
override def par: ParRepr
override protected[this] def parCombiner: Combiner[A, ParRepr] = throw new UnsupportedOperationException("")
override protected[this] def parCombiner = throw new UnsupportedOperationException("")
}

3 changes: 2 additions & 1 deletion core/src/main/scala/scala/collection/Parallelizable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package scala
package collection

import parallel.Combiner
import scala.annotation.unchecked.uncheckedVariance

/** This trait describes collections which can be turned into parallel collections
* by invoking the method `par`. Parallelizable collections may be parameterized with
Expand Down Expand Up @@ -48,6 +49,6 @@ trait Parallelizable[+A, +ParRepr <: Parallel] extends Any {
*
* @return a combiner for the parallel collection of type `ParRepr`
*/
protected[this] def parCombiner: Combiner[A, ParRepr]
protected[this] def parCombiner: Combiner[A @uncheckedVariance, ParRepr]
}

Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,9 @@ trait GenericParTemplate[+A, +CC[X] <: ParIterable[X]]
{
def companion: GenericParCompanion[CC]

protected[this] override def newBuilder: scala.collection.mutable.Builder[A, CC[A]] = newCombiner
protected[this] override def newBuilder = newCombiner

protected[this] override def newCombiner: Combiner[A, CC[A]] = {
val cb = companion.newCombiner[A]
cb
}
protected[this] override def newCombiner = companion.newCombiner[A]

override def genericBuilder[B]: Combiner[B, CC[B]] = genericCombiner[B]

Expand All @@ -50,7 +47,7 @@ trait GenericParTemplate[+A, +CC[X] <: ParIterable[X]]

trait GenericParMapTemplate[K, +V, +CC[X, Y] <: ParMap[X, Y]] extends GenericParTemplate[(K, V), ParIterable]
{
protected[this] override def newCombiner: Combiner[(K, V), CC[K, V]] = {
protected[this] override def newCombiner: Combiner[(K, V @uncheckedVariance), CC[K, V @uncheckedVariance]] = {
val cb = mapCompanion.newCombiner[K, V]
cb
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ trait GenericTraversableTemplate[+A, +CC[X] <: ParIterable[X]] extends HasNewBui

/** The builder that builds instances of type $Coll[A]
*/
protected[this] def newBuilder: Builder[A, CC[A]] = companion.newBuilder[A]
protected[this] def newBuilder: Builder[A @uncheckedVariance, CC[A @uncheckedVariance]] = companion.newBuilder[A]

/** The generic builder that builds instances of $Coll
* at arbitrary element types.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ package collection
package generic

import mutable.Builder
import scala.annotation.unchecked.uncheckedVariance

trait HasNewBuilder[+A, +Repr] extends Any {
/** The builder that builds instances of Repr */
protected[this] def newBuilder: Builder[A, Repr]
protected[this] def newBuilder: Builder[A @uncheckedVariance, Repr]
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ package collection
package generic

import scala.collection.parallel.Combiner
import scala.annotation.unchecked.uncheckedVariance

trait HasNewCombiner[+T, +Repr] {
protected[this] def newCombiner: Combiner[T, Repr]
protected[this] def newCombiner: Combiner[T @uncheckedVariance, Repr]
}

Loading