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 enabled 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 20, 2019
1 parent 5072f83 commit 647865f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
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

0 comments on commit 647865f

Please sign in to comment.