Skip to content

Commit 8c129ac

Browse files
authored
Merge pull request #113 from SethTisue/add-dotty
add Dotty cross-build
2 parents 52d2c9c + 4040ee3 commit 8c129ac

18 files changed

+302
-166
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ language: scala
66

77
scala:
88
- 2.13.3
9+
- 0.27.0-RC1
910

1011
env:
1112
- ADOPTOPENJDK=8

build.sbt

+34-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
Global / cancelable := true
22
publish / skip := true // in root
33

4+
Global / scalacOptions ++= (
5+
if (isDotty.value) Seq("-language:implicitConversions") // TODO check again on 3.0.0-M1
6+
else Seq()
7+
)
8+
49
lazy val commonSettings: Seq[Setting[_]] =
510
ScalaModulePlugin.scalaModuleSettings ++ Seq(
6-
Compile / compile / scalacOptions += "-Werror"
11+
Compile / compile / scalacOptions --= (if (isDotty.value) Seq("-Xlint")
12+
else Seq()),
13+
Compile / compile / scalacOptions ++= (if (isDotty.value) Seq()
14+
else Seq("-Werror")),
715
)
816

917
lazy val core = project.in(file("core"))
1018
.settings(commonSettings)
1119
.settings(
12-
name := "scala-parallel-collections"
20+
name := "scala-parallel-collections",
21+
// don't run Dottydoc, it errors and isn't needed anyway
22+
Compile / doc / sources := (if (isDotty.value) Seq() else (Compile / doc/ sources).value),
23+
Compile / packageDoc / publishArtifact := !isDotty.value,
1324
)
1425

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

2646
lazy val scalacheck = project.in(file("scalacheck"))
2747
.settings(commonSettings)
2848
.settings(
29-
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.14.3",
49+
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.15.0-M1" withDottyCompat(scalaVersion.value),
3050
Test / fork := true,
3151
Test / testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-workers", "1", "-minSize", "0", "-maxSize", "4000", "-minSuccessfulTests", "5"),
3252
publish / skip := true
@@ -36,5 +56,14 @@ lazy val testmacros = project.in(file("testmacros"))
3656
.settings(commonSettings)
3757
.settings(
3858
libraryDependencies += scalaOrganization.value % "scala-compiler" % scalaVersion.value,
39-
publish / skip := true
59+
publish / skip := true,
60+
// https://github.com/sbt/sbt/pull/5919 adds this to sbt itself,
61+
// so we should revisit once sbt 1.4.1 is available
62+
Compile / unmanagedSourceDirectories += {
63+
val major = CrossVersion.partialVersion(scalaVersion.value) match {
64+
case Some((0 | 3, _)) => "3"
65+
case _ => "2"
66+
}
67+
baseDirectory.value / "src" / "main" / s"scala-$major"
68+
},
4069
)

core/src/main/scala/scala/collection/CustomParallelizable.scala

+1-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@
1313
package scala
1414
package collection
1515

16-
import parallel.Combiner
17-
1816
trait CustomParallelizable[+A, +ParRepr <: Parallel] extends Any with Parallelizable[A, ParRepr] {
1917
override def par: ParRepr
20-
override protected[this] def parCombiner: Combiner[A, ParRepr] = throw new UnsupportedOperationException("")
18+
override protected[this] def parCombiner = throw new UnsupportedOperationException("")
2119
}
2220

core/src/main/scala/scala/collection/Parallelizable.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ package scala
1414
package collection
1515

1616
import parallel.Combiner
17+
import scala.annotation.unchecked.uncheckedVariance
1718

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

core/src/main/scala/scala/collection/generic/GenericParTemplate.scala

+3-6
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,9 @@ trait GenericParTemplate[+A, +CC[X] <: ParIterable[X]]
3131
{
3232
def companion: GenericParCompanion[CC]
3333

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

36-
protected[this] override def newCombiner: Combiner[A, CC[A]] = {
37-
val cb = companion.newCombiner[A]
38-
cb
39-
}
36+
protected[this] override def newCombiner = companion.newCombiner[A]
4037

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

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

5148
trait GenericParMapTemplate[K, +V, +CC[X, Y] <: ParMap[X, Y]] extends GenericParTemplate[(K, V), ParIterable]
5249
{
53-
protected[this] override def newCombiner: Combiner[(K, V), CC[K, V]] = {
50+
protected[this] override def newCombiner: Combiner[(K, V @uncheckedVariance), CC[K, V @uncheckedVariance]] = {
5451
val cb = mapCompanion.newCombiner[K, V]
5552
cb
5653
}

core/src/main/scala/scala/collection/generic/GenericTraversableTemplate.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ trait GenericTraversableTemplate[+A, +CC[X] <: ParIterable[X]] extends HasNewBui
6363

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

6868
/** The generic builder that builds instances of $Coll
6969
* at arbitrary element types.

core/src/main/scala/scala/collection/generic/HasNewBuilder.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ package collection
1515
package generic
1616

1717
import mutable.Builder
18+
import scala.annotation.unchecked.uncheckedVariance
1819

1920
trait HasNewBuilder[+A, +Repr] extends Any {
2021
/** The builder that builds instances of Repr */
21-
protected[this] def newBuilder: Builder[A, Repr]
22+
protected[this] def newBuilder: Builder[A @uncheckedVariance, Repr]
2223
}

core/src/main/scala/scala/collection/generic/HasNewCombiner.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ package collection
1515
package generic
1616

1717
import scala.collection.parallel.Combiner
18+
import scala.annotation.unchecked.uncheckedVariance
1819

1920
trait HasNewCombiner[+T, +Repr] {
20-
protected[this] def newCombiner: Combiner[T, Repr]
21+
protected[this] def newCombiner: Combiner[T @uncheckedVariance, Repr]
2122
}
2223

0 commit comments

Comments
 (0)