Skip to content

Commit

Permalink
[no-master] Enable Scala 2.13.0 in the tools and all the other artifa…
Browse files Browse the repository at this point in the history
…cts.

Partest is not yet unabled in this commit, because a dependency of
`partest` 2.13.0, namely `testkit`, was not published. See
scala/bug#11529 upstream.
  • Loading branch information
sjrd committed Jun 19, 2019
1 parent c4d5070 commit 6eccbef
Show file tree
Hide file tree
Showing 41 changed files with 502 additions and 200 deletions.
8 changes: 1 addition & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ def allJavaVersions = otherJavaVersions.clone()
allJavaVersions << mainJavaVersion

def mainScalaVersion = "2.12.8"
def mainScalaVersions = ["2.10.2", "2.11.12", "2.12.8"]
def mainScalaVersions = ["2.10.2", "2.11.12", "2.12.8", "2.13.0"]
def otherScalaVersions = [
"2.10.3",
"2.10.4",
Expand All @@ -460,7 +460,6 @@ def otherScalaVersions = [
"2.12.6",
"2.12.7"
]
def noToolsScalaVersions = ["2.13.0"]

// The 'quick' matrix
def quickMatrix = []
Expand All @@ -479,11 +478,6 @@ mainScalaVersions.each { scalaVersion ->
quickMatrix.add([task: "partest-fastopt", scala: scalaVersion, java: mainJavaVersion])
}
}
noToolsScalaVersions.each { scalaVersion ->
quickMatrix.add([task: "main", scala: scalaVersion, java: mainJavaVersion])
quickMatrix.add([task: "test-suite-ecma-script5", scala: scalaVersion, java: mainJavaVersion, testSuite: "testSuite"])
quickMatrix.add([task: "test-suite-ecma-script6", scala: scalaVersion, java: mainJavaVersion, testSuite: "testSuite"])
}
allJavaVersions.each { javaVersion ->
quickMatrix.add([task: "tools-cli-stubs-sbtplugin", scala: "2.12.8", sbt_version_override: "", java: javaVersion])
}
Expand Down
8 changes: 7 additions & 1 deletion ir/src/main/scala/org/scalajs/core/ir/Infos.scala
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ object Infos {
this
}

def addInterfaces(interfaces: List[String]): this.type = {
this.interfaces ++= interfaces
this
}

@deprecated("Use the overload with a List.", "0.6.29")
def addInterfaces(interfaces: TraversableOnce[String]): this.type = {
this.interfaces ++= interfaces
this
Expand Down Expand Up @@ -276,7 +282,7 @@ object Infos {
def result(): MethodInfo = {
def toMapOfLists(
m: mutable.Map[String, mutable.Set[String]]): Map[String, List[String]] = {
m.mapValues(_.toList).toMap
m.map(kv => kv._1 -> kv._2.toList).toMap
}

MethodInfo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ trait TimeoutTests extends JSEnvTest {
if (c >= 10)
clearInterval(i);
}, 10);
""" hasOutput (1 to 10).map(_ + "\n").mkString
""" hasOutput (1 to 10).mkString("", "\n", "\n")

assertTrue("Execution took too little time", deadline.isOverdue())

Expand Down
14 changes: 12 additions & 2 deletions js-envs/src/main/scala/org/scalajs/jsenv/ExternalJSEnv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,18 @@ abstract class ExternalJSEnv(
* The default value in `ExternalJSEnv` is
* `System.getenv().asScala.toMap ++ env`.
*/
protected def getVMEnv(): Map[String, String] =
System.getenv().asScala.toMap ++ env
protected def getVMEnv(): Map[String, String] = {
/* We use Java's `forEach` not to depend on Scala's JavaConverters, which
* are very difficult to cross-compile across 2.12- and 2.13+.
*/
val builder = Map.newBuilder[String, String]
System.getenv().forEach(new java.util.function.BiConsumer[String, String] {
def accept(key: String, value: String): Unit =
builder += key -> value
})
builder ++= env
builder.result()
}

/** Get files that are a library (i.e. that do not run anything) */
protected def getLibJSFiles(): Seq[VirtualJSFile] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ final class VirtualFileMaterializer(singleDir: Boolean = false) {
// scalastyle:on line.size.limit
private def createTempDir(): File = {
val baseDir = new File(System.getProperty("java.io.tmpdir"))
val baseName = System.currentTimeMillis() + "-"
val baseName = "" + System.currentTimeMillis() + "-"

@tailrec
def loop(tries: Int): File = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,18 @@ abstract class AbstractNodeJSEnv(
val nodePath = libCache.cacheDir.getAbsolutePath +
baseNodePath.fold("")(p => File.pathSeparator + p)

System.getenv().asScala.toMap ++ Seq(
"NODE_MODULE_CONTEXTS" -> "0",
"NODE_PATH" -> nodePath
) ++ env
/* We use Java's `forEach` not to depend on Scala's JavaConverters, which
* are very difficult to cross-compile across 2.12- and 2.13+.
*/
val builder = Map.newBuilder[String, String]
System.getenv().forEach(new java.util.function.BiConsumer[String, String] {
def accept(key: String, value: String): Unit =
builder += key -> value
})
builder += "NODE_MODULE_CONTEXTS" -> "0"
builder += "NODE_PATH" -> nodePath
builder ++= env
builder.result()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class JSDOMNodeJSEnv private[jsenv] (
case file => libCache.materialize(file)
}
val scriptsURIsAsJSStrings = scriptsFiles.map { file =>
'"' + escapeJS(file.toURI.toASCIIString) + '"'
"\"" + escapeJS(file.toURI.toASCIIString) + "\""
}
val scriptsURIsJSArray = scriptsURIsAsJSStrings.mkString("[", ", ", "]")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ class PhantomJSEnv(config: PhantomJSEnv.Config)
case '>' => "&gt;"
case '"' => "&quot;"
case '&' => "&amp;"
case c => c :: Nil
case c => c.toString()
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class MainGenericRunner {
val opt = Option(System.getProperty("scalajs.partest.compliantSems"))
opt.fold(Semantics.Defaults) { str =>
val sems = str.split(',')
Semantics.compliantTo(sems.toList)
Semantics.compliantTo(sems.toSet)
}
}

Expand Down
12 changes: 12 additions & 0 deletions project/BinaryIncompatibilities.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ object BinaryIncompatibilities {
)

val Tools = Seq(
// private[optimizer], not an issue
ProblemFilters.exclude[IncompatibleMethTypeProblem]("org.scalajs.core.tools.linker.frontend.optimizer.GenIncOptimizer#Class.subclasses_="),
ProblemFilters.exclude[IncompatibleResultTypeProblem]("org.scalajs.core.tools.linker.frontend.optimizer.GenIncOptimizer#Class.subclasses"),
ProblemFilters.exclude[IncompatibleResultTypeProblem]("org.scalajs.core.tools.linker.frontend.optimizer.GenIncOptimizer#AbsCollOps.*"),
ProblemFilters.exclude[IncompatibleMethTypeProblem]("org.scalajs.core.tools.linker.frontend.optimizer.GenIncOptimizer#AbsCollOps.*"),
ProblemFilters.exclude[ReversedMissingMethodProblem]("org.scalajs.core.tools.linker.frontend.optimizer.GenIncOptimizer#AbsCollOps.*"),
ProblemFilters.exclude[IncompatibleResultTypeProblem]("org.scalajs.core.tools.linker.frontend.optimizer.IncOptimizer#CollOps.*"),
ProblemFilters.exclude[IncompatibleResultTypeProblem]("org.scalajs.core.tools.linker.frontend.optimizer.ParIncOptimizer#CollOps.*"),

// private, not an issue
ProblemFilters.exclude[IncompatibleMethTypeProblem]("org.scalajs.core.tools.linker.checker.InfoChecker.this"),
ProblemFilters.exclude[IncompatibleMethTypeProblem]("org.scalajs.core.tools.linker.checker.IRChecker#CheckedClass.this")
)

val JSEnvs = Seq(
Expand Down
16 changes: 15 additions & 1 deletion project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ object Build {
scalaVersion: String): Seq[ModuleID] = {
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, n)) if n >= 13 =>
Seq("org.scala-lang.modules" %% "scala-parallel-collections" % "0.1.2")
Seq("org.scala-lang.modules" %% "scala-parallel-collections" % "0.2.0")

case _ => Nil
}
Expand Down Expand Up @@ -605,6 +605,8 @@ object Build {

unmanagedSourceDirectories in Compile +=
baseDirectory.value.getParentFile / "shared/src/main/scala",
unmanagedSourceDirectories in Compile +=
collectionsEraDependentDirectory(scalaVersion.value, baseDirectory.value.getParentFile / "shared/src/main"),
unmanagedSourceDirectories in Test +=
baseDirectory.value.getParentFile / "shared/src/test/scala",

Expand Down Expand Up @@ -2051,6 +2053,18 @@ object Build {

testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-s"),

unmanagedSources in Compile ++= {
val scalaV = scalaVersion.value
val upstreamSrcDir = (fetchScalaSource in partest).value

if (scalaV.startsWith("2.10.") || scalaV.startsWith("2.11.") ||
scalaV.startsWith("2.12.")) {
Nil
} else {
List(upstreamSrcDir / "src/testkit/scala/tools/testkit/AssertUtil.scala")
}
},

unmanagedSources in Test ++= {
assert(scalaBinaryVersion.value != "2.10",
"scalaTestSuite is not supported on Scala 2.10")
Expand Down
1 change: 1 addition & 0 deletions project/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ unmanagedSourceDirectories in Compile ++= {
Seq(
root / "ir/src/main/scala",
root / "tools/shared/src/main/scala",
root / "tools/shared/src/main/scala-old-collections",
root / "tools/jvm/src/main/scala",
root / "js-envs/src/main/scala",
root / "test-adapter/src/main/scala",
Expand Down
45 changes: 0 additions & 45 deletions scala-test-suite/src/test/resources/2.13.0-M3/WhitelistedTests.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
## Do not compile
scala/ExtractorTest.scala
scala/OptionTest.scala
scala/SerializationStabilityTest.scala
scala/StringTest.scala
scala/collection/FactoriesTest.scala
scala/collection/LazyZipOpsTest.scala
scala/collection/immutable/IndexedSeqTest.scala
scala/lang/annotations/BytecodeTest.scala
scala/lang/annotations/RunTest.scala
scala/lang/traits/BytecodeTest.scala
scala/lang/traits/RunTest.scala
scala/lang/primitives/NaNTest.scala
scala/lang/primitives/BoxUnboxTest.scala
scala/reflect/ClassOfTest.scala
scala/reflect/QTest.scala
scala/reflect/io/ZipArchiveTest.scala
Expand All @@ -20,6 +25,12 @@ scala/reflect/internal/TypesTest.scala
scala/reflect/internal/util/WeakHashSetTest.scala
scala/reflect/internal/MirrorsTest.scala
scala/reflect/internal/NamesTest.scala
scala/reflect/FieldAccessTest.scala
scala/reflect/internal/LongNamesTest.scala
scala/reflect/internal/PositionsTest.scala
scala/reflect/internal/util/FileUtilsTest.scala
scala/reflect/io/AbstractFileTest.scala
scala/tools/cmd/CommandLineParserTest.scala
scala/tools/nsc/backend/jvm/BTypesTest.scala
scala/tools/nsc/backend/jvm/BytecodeTest.scala
scala/tools/nsc/backend/jvm/DefaultMethodTest.scala
Expand Down Expand Up @@ -77,36 +88,75 @@ scala/tools/nsc/transform/patmat/SolvingTest.scala
scala/tools/nsc/transform/patmat/PatmatBytecodeTest.scala
scala/tools/nsc/typechecker/Implicits.scala
scala/tools/nsc/util/StackTraceTest.scala
scala/tools/nsc/backend/jvm/analysis/TypeFlowAnalyzerTest.scala
scala/tools/nsc/classpath/MultiReleaseJarTest.scala
scala/tools/nsc/DeterminismTest.scala
scala/tools/nsc/doc/html/StringLiteralTest.scala
scala/tools/nsc/GlobalCustomizeClassloaderTest.scala
scala/tools/nsc/parser/ParserTest.scala
scala/tools/nsc/reporters/PositionFilterTest.scala
scala/tools/nsc/symtab/classfile/PicklerTest.scala
scala/tools/nsc/transform/ErasureTest.scala
scala/tools/nsc/transform/MixinTest.scala
scala/tools/nsc/transform/ReleaseFenceTest.scala
scala/tools/nsc/transform/SpecializationTest.scala
scala/tools/nsc/typechecker/Infer.scala
scala/tools/nsc/typechecker/NamerTest.scala
scala/tools/nsc/typechecker/OverridingPairsTest.scala
scala/tools/nsc/typechecker/ParamAliasTest.scala
scala/tools/nsc/typechecker/TypedTreeTest.scala
scala/tools/testing/BytecodeTesting.scala
scala/tools/testing/RunTesting.scala
scala/tools/testing/VirtualCompilerTesting.scala
scala/util/ChainingOpsTest.scala

## Do not link
scala/CollectTest.scala
scala/MatchErrorSerializationTest.scala
scala/PartialFunctionSerializationTest.scala
scala/lang/stringinterpol/StringContextTest.scala
scala/collection/IterableTest.scala
scala/collection/IteratorTest.scala
scala/collection/NewBuilderTest.scala
scala/collection/SeqViewTest.scala
scala/collection/SetMapConsistencyTest.scala
scala/collection/SetMapRulesTest.scala
scala/collection/concurrent/TrieMapTest.scala
scala/collection/convert/WrapperSerializationTest.scala
scala/collection/immutable/ChampMapSmokeTest.scala
scala/collection/immutable/ChampSetSmokeTest.scala
scala/collection/immutable/LazyListGCTest.scala
scala/collection/immutable/LazyListLazinessTest.scala
scala/collection/immutable/ListTest.scala
scala/collection/immutable/SerializationTest.scala
scala/collection/immutable/StreamTest.scala
scala/collection/immutable/StringLikeTest.scala
scala/collection/immutable/VectorTest.scala
scala/collection/mutable/ArrayBufferTest.scala
scala/collection/mutable/MutableListTest.scala
scala/collection/mutable/OpenHashMapTest.scala
scala/collection/mutable/PriorityQueueTest.scala
scala/collection/mutable/SerializationTest.scala
scala/concurrent/FutureTest.scala
scala/concurrent/duration/SerializationTest.scala
scala/concurrent/impl/DefaultPromiseTest.scala
scala/io/SourceTest.scala
scala/jdk/AccumulatorTest.scala
scala/jdk/DurationConvertersTest.scala
scala/jdk/FunctionConvertersTest.scala
scala/jdk/OptionConvertersTest.scala
scala/jdk/StepperConversionTest.scala
scala/jdk/StepperTest.scala
scala/jdk/StreamConvertersTest.scala
scala/jdk/StreamConvertersTypingTest.scala
scala/math/OrderingTest.scala
scala/runtime/ScalaRunTimeTest.scala
scala/sys/process/ParserTest.scala
scala/sys/process/PipedProcessTest.scala
scala/sys/process/ProcessBuilderTest.scala
scala/sys/process/ProcessTest.scala
scala/tools/testing/AssertUtilTest.scala
scala/tools/testing/AssertThrowsTest.scala
scala/util/PropertiesTest.scala
scala/util/SpecVersionTest.scala
scala/util/SystemPropertiesTest.scala

Expand All @@ -122,12 +172,20 @@ scala/util/matching/RegexTest.scala
# Require strict-floats
scala/math/BigDecimalTest.scala

# Difference of getClass() on primitive values
scala/collection/immutable/RangeTest.scala

# Bugs
scala/collection/convert/MapWrapperTest.scala
# Fails for a BigDecimal range with augmented precision (might be an actual bug)
scala/collection/immutable/NumericRangeTest.scala

# Tests passed but are too slow (timeouts)
scala/collection/immutable/ListSetTest.scala
scala/util/SortingTest.scala

# Relies on undefined behavior
scala/collection/StringOpsTest.scala
scala/collection/StringParsersTest.scala
scala/collection/convert/MapWrapperTest.scala

## Buglisted
# 3704
scala/collection/convert/JSetWrapperTest.scala
# 3705
scala/collection/ArrayOpsTest.scala
Loading

0 comments on commit 6eccbef

Please sign in to comment.