Skip to content

Commit ffa58d2

Browse files
committed
[no-master] Enable Scala 2.13.0 in the tools and all the other artifacts.
Partest is not yet enabled in this commit, because a dependency of `partest` 2.13.0, namely `testkit`, was not published. See scala/bug#11529 upstream.
1 parent 1169011 commit ffa58d2

File tree

4 files changed

+26
-8
lines changed

4 files changed

+26
-8
lines changed

js-envs-test-kit/src/main/scala/org/scalajs/jsenv/test/TimeoutTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ trait TimeoutTests extends JSEnvTest {
140140
if (c >= 10)
141141
clearInterval(i);
142142
}, 10);
143-
""" hasOutput (1 to 10).map(_ + "\n").mkString
143+
""" hasOutput (1 to 10).mkString("", "\n", "\n")
144144

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

js-envs/src/main/scala/org/scalajs/jsenv/ExternalJSEnv.scala

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,18 @@ abstract class ExternalJSEnv(
8181
* The default value in `ExternalJSEnv` is
8282
* `System.getenv().asScala.toMap ++ env`.
8383
*/
84-
protected def getVMEnv(): Map[String, String] =
85-
System.getenv().asScala.toMap ++ env
84+
protected def getVMEnv(): Map[String, String] = {
85+
/* We use Java's `forEach` not to depend on Scala's JavaConverters, which
86+
* are very difficult to cross-compile across 2.12- and 2.13+.
87+
*/
88+
val builder = Map.newBuilder[String, String]
89+
System.getenv().forEach(new java.util.function.BiConsumer[String, String] {
90+
def accept(key: String, value: String): Unit =
91+
builder += key -> value
92+
})
93+
builder ++= env
94+
builder.result()
95+
}
8696

8797
/** Get files that are a library (i.e. that do not run anything) */
8898
protected def getLibJSFiles(): Seq[VirtualJSFile] =

js-envs/src/main/scala/org/scalajs/jsenv/VirtualFileMaterializer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ final class VirtualFileMaterializer(singleDir: Boolean = false) {
7777
// scalastyle:on line.size.limit
7878
private def createTempDir(): File = {
7979
val baseDir = new File(System.getProperty("java.io.tmpdir"))
80-
val baseName = System.currentTimeMillis() + "-"
80+
val baseName = "" + System.currentTimeMillis() + "-"
8181

8282
@tailrec
8383
def loop(tries: Int): File = {

js-envs/src/main/scala/org/scalajs/jsenv/nodejs/AbstractNodeJSEnv.scala

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,18 @@ abstract class AbstractNodeJSEnv(
168168
val nodePath = libCache.cacheDir.getAbsolutePath +
169169
baseNodePath.fold("")(p => File.pathSeparator + p)
170170

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

0 commit comments

Comments
 (0)