Created
November 15, 2017 16:53
-
-
Save sjrd/80b9144be7f4a290562be2683064c4f4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --cc ci/checksizes.sh | |
index c964864,429b3bd..0000000 | |
--- a/ci/checksizes.sh | |
+++ b/ci/checksizes.sh | |
@@@ -17,7 -17,7 +17,7 @@@ case $FULLVER i | |
2.13.0-M2) | |
VER=2.13.0-M2 | |
;; | |
- 2.10.3|2.10.4|2.10.5|2.10.6|2.11.0|2.11.1|2.11.2|2.11.4|2.11.5|2.11.6|2.11.7|2.11.8|2.12.1|2.12.2) | |
- 2.10.3|2.10.4|2.10.5|2.10.6|2.10.7|2.11.0|2.11.1|2.11.2|2.11.4|2.11.5|2.11.6|2.11.7|2.11.8|2.11.11|2.12.0|2.12.1|2.12.2|2.12.3) | |
++ 2.10.3|2.10.4|2.10.5|2.10.6|2.10.7|2.11.0|2.11.1|2.11.2|2.11.4|2.11.5|2.11.6|2.11.7|2.11.8|2.11.11|2.12.1|2.12.2|2.12.3) | |
echo "Ignoring checksizes for Scala $FULLVER" | |
exit 0 | |
;; | |
@@@ -37,28 -37,28 +37,28 @@@ REVERSI_OPT_GZ_SIZE=$(stat '-c%s' "$REV | |
case $FULLVER in | |
2.10.2) | |
- REVERSI_PREOPT_EXPECTEDSIZE=532000 | |
- REVERSI_OPT_EXPECTEDSIZE=122000 | |
- REVERSI_PREOPT_GZ_EXPECTEDSIZE=71000 | |
- REVERSI_OPT_GZ_EXPECTEDSIZE=31000 | |
+ REVERSI_PREOPT_EXPECTEDSIZE=509000 | |
+ REVERSI_OPT_EXPECTEDSIZE=115000 | |
+ REVERSI_PREOPT_GZ_EXPECTEDSIZE=69000 | |
+ REVERSI_OPT_GZ_EXPECTEDSIZE=30000 | |
;; | |
- 2.11.11) | |
+ 2.11.12) | |
- REVERSI_PREOPT_EXPECTEDSIZE=529000 | |
- REVERSI_OPT_EXPECTEDSIZE=124000 | |
- REVERSI_PREOPT_GZ_EXPECTEDSIZE=71000 | |
- REVERSI_OPT_GZ_EXPECTEDSIZE=32000 | |
+ REVERSI_PREOPT_EXPECTEDSIZE=505000 | |
+ REVERSI_OPT_EXPECTEDSIZE=116000 | |
+ REVERSI_PREOPT_GZ_EXPECTEDSIZE=69000 | |
+ REVERSI_OPT_GZ_EXPECTEDSIZE=30000 | |
;; | |
- 2.12.3) | |
+ 2.12.4) | |
- REVERSI_PREOPT_EXPECTEDSIZE=630000 | |
- REVERSI_OPT_EXPECTEDSIZE=147000 | |
- REVERSI_PREOPT_GZ_EXPECTEDSIZE=76000 | |
- REVERSI_OPT_GZ_EXPECTEDSIZE=33000 | |
+ REVERSI_PREOPT_EXPECTEDSIZE=604000 | |
+ REVERSI_OPT_EXPECTEDSIZE=138000 | |
+ REVERSI_PREOPT_GZ_EXPECTEDSIZE=74000 | |
+ REVERSI_OPT_GZ_EXPECTEDSIZE=32000 | |
;; | |
2.13.0-M2) | |
- REVERSI_PREOPT_EXPECTEDSIZE=628000 | |
- REVERSI_OPT_EXPECTEDSIZE=147000 | |
- REVERSI_PREOPT_GZ_EXPECTEDSIZE=77000 | |
- REVERSI_OPT_GZ_EXPECTEDSIZE=33000 | |
+ REVERSI_PREOPT_EXPECTEDSIZE=602000 | |
+ REVERSI_OPT_EXPECTEDSIZE=138000 | |
+ REVERSI_PREOPT_GZ_EXPECTEDSIZE=74000 | |
+ REVERSI_OPT_GZ_EXPECTEDSIZE=32000 | |
;; | |
esac | |
diff --cc ci/matrix.xml | |
index 8017d56,da0cab4..0000000 | |
--- a/ci/matrix.xml | |
+++ b/ci/matrix.xml | |
@@@ -201,8 -264,7 +201,8 @@@ | |
SBT_VER_OVERRIDE=$sbt_version_override | |
# Publish Scala.js artifacts locally | |
# Then go into standalone project and test | |
- sbt ++2.11.12 compiler/publishLocal library/publishLocal javalibEx/publishLocal \ | |
+ npm install && | |
- sbt ++2.11.11 compiler/publishLocal library/publishLocal \ | |
++ sbt ++2.11.12 compiler/publishLocal library/publishLocal \ | |
testInterface/publishLocal stubs/publishLocal \ | |
jUnitPlugin/publishLocal jUnitRuntime/publishLocal && | |
sbt ++$toolsscala ${SBT_VER_OVERRIDE:+^^$SBT_VER_OVERRIDE} \ | |
@@@ -483,6 -548,14 +487,10 @@@ | |
<v n="java">1.8</v> | |
</run> | |
<run task="main"> | |
+ <v n="scala">2.11.11</v> | |
+ <v n="java">1.8</v> | |
+ </run> | |
+ <run task="main"> | |
- <v n="scala">2.12.0</v> | |
- <v n="java">1.8</v> | |
- </run> | |
- <run task="main"> | |
<v n="scala">2.12.1</v> | |
<v n="java">1.8</v> | |
</run> | |
@@@ -675,6 -752,30 +687,18 @@@ | |
<v n="java">1.8</v> | |
</run> | |
<run task="partest-noopt"> | |
+ <v n="scala">2.11.12</v> | |
+ <v n="java">1.8</v> | |
+ </run> | |
+ <run task="partest-fastopt"> | |
+ <v n="scala">2.11.12</v> | |
+ <v n="java">1.8</v> | |
+ </run> | |
+ <run task="partest-fullopt"> | |
+ <v n="scala">2.11.12</v> | |
+ <v n="java">1.8</v> | |
+ </run> | |
+ <run task="partest-noopt"> | |
- <v n="scala">2.12.0</v> | |
- <v n="java">1.8</v> | |
- </run> | |
- <run task="partest-fastopt"> | |
- <v n="scala">2.12.0</v> | |
- <v n="java">1.8</v> | |
- </run> | |
- <run task="partest-fullopt"> | |
- <v n="scala">2.12.0</v> | |
- <v n="java">1.8</v> | |
- </run> | |
- <run task="partest-noopt"> | |
<v n="scala">2.12.1</v> | |
<v n="java">1.8</v> | |
</run> | |
diff --cc ir/src/main/scala/org/scalajs/core/ir/ScalaJSVersions.scala | |
index f7c6b68,a9431d7..0000000 | |
--- a/ir/src/main/scala/org/scalajs/core/ir/ScalaJSVersions.scala | |
+++ b/ir/src/main/scala/org/scalajs/core/ir/ScalaJSVersions.scala | |
diff --cc project/Build.scala | |
index b23cb2f,3a13d3b..0000000 | |
--- a/project/Build.scala | |
+++ b/project/Build.scala | |
@@@ -109,18 -58,16 +109,18 @@@ object Build | |
val shouldPartest = settingKey[Boolean]( | |
"Whether we should partest the current scala version (and fail if we can't)") | |
+ /* MiMa configuration -- irrelevant while in 1.0.0-SNAPSHOT. | |
- val previousVersion = "0.6.20" | |
+ val previousVersion = "0.6.21" | |
val previousSJSBinaryVersion = | |
ScalaJSCrossVersion.binaryScalaJSVersion(previousVersion) | |
val previousBinaryCrossVersion = | |
CrossVersion.binaryMapped(v => s"sjs${previousSJSBinaryVersion}_$v") | |
val scalaVersionsUsedForPublishing: Set[String] = | |
- Set("2.10.6", "2.11.11", "2.12.3", "2.13.0-M2") | |
+ Set("2.10.7", "2.11.12", "2.12.4", "2.13.0-M2") | |
val newScalaBinaryVersionsInThisRelease: Set[String] = | |
Set() | |
+ */ | |
val javaVersion = settingKey[Int]( | |
"The major Java SDK version that should be assumed for compatibility. " + | |
@@@ -454,28 -425,9 +454,7 @@@ | |
} | |
} | |
- val thisBuildSettings = ( | |
- inScope(Global)(ScalaJSPlugin.globalSettings) | |
- ) ++ Seq( | |
+ val thisBuildSettings = Def.settings( | |
- // Most of the projects cross-compile | |
- crossScalaVersions := Seq( | |
- "2.10.2", | |
- "2.10.3", | |
- "2.10.4", | |
- "2.10.5", | |
- "2.10.6", | |
- "2.11.0", | |
- "2.11.1", | |
- "2.11.2", | |
- "2.11.4", | |
- "2.11.5", | |
- "2.11.6", | |
- "2.11.7", | |
- "2.11.8", | |
- "2.11.11", | |
- "2.12.1", | |
- "2.12.2", | |
- "2.12.3", | |
- "2.13.0-M2" | |
- ), | |
// JDK version we are running with | |
javaVersion in Global := { | |
val fullVersion = System.getProperty("java.version") | |
diff --cc sbt-plugin/src/main/scala/org/scalajs/sbtplugin/ScalaJSPluginInternal.scala | |
index 3bc9db6,b6af444..0000000 | |
--- a/sbt-plugin/src/main/scala/org/scalajs/sbtplugin/ScalaJSPluginInternal.scala | |
+++ b/sbt-plugin/src/main/scala/org/scalajs/sbtplugin/ScalaJSPluginInternal.scala | |
@@@ -17,23 -23,28 +17,23 @@@ import org.scalajs.core.tools.linker. | |
import org.scalajs.core.tools.linker.standard._ | |
import org.scalajs.jsenv._ | |
-import org.scalajs.jsenv.phantomjs.PhantomJettyClassLoader | |
+import org.scalajs.jsenv.nodejs.NodeJSEnv | |
-import org.scalajs.core.ir | |
import org.scalajs.core.ir.Utils.escapeJS | |
-import org.scalajs.core.ir.ScalaJSVersions | |
-import org.scalajs.core.ir.Printers.{InfoPrinter, IRTreePrinter} | |
- | |
-import org.scalajs.testadapter.TestAdapter | |
+import org.scalajs.core.ir.Printers.IRTreePrinter | |
- import org.scalajs.testadapter.{FrameworkDetector, HTMLRunnerBuilder} | |
-import scala.util.Try | |
-import scala.collection.mutable | |
++import org.scalajs.testadapter.{TestAdapter, HTMLRunnerBuilder} | |
-import java.io.FileNotFoundException | |
-import java.nio.charset.Charset | |
-import java.net.URLClassLoader | |
+import Loggers._ | |
+import SBTCompat._ | |
+import SBTCompat.formatImplicits._ | |
+import SBTCompat.formatImplicits.seqFormat | |
-/** Contains settings used by ScalaJSPlugin that should not be automatically | |
- * be in the *.sbt file's scope. | |
- */ | |
-object ScalaJSPluginInternal { | |
+/** Implementation details of `ScalaJSPlugin`. */ | |
+private[sbtplugin] object ScalaJSPluginInternal { | |
import ScalaJSPlugin.autoImport.{ModuleKind => _, _} | |
+ import ScalaJSPlugin.logIRCacheStats | |
/** The global Scala.js IR cache */ | |
val globalIRCache: IRFileCache = new IRFileCache() | |
@@@ -46,52 -65,101 +54,50 @@@ | |
* The allocated IR cache will automatically be freed when the build is | |
* unloaded. | |
*/ | |
- private def newIRCache: globalIRCache.Cache = { | |
- val cache = globalIRCache.newCache | |
+ private def newIRCache: globalIRCache.Cache = | |
+ registerResource(allocatedIRCaches, globalIRCache.newCache) | |
- @tailrec | |
- def registerLoop(): Unit = { | |
- val prevValue = allocatedIRCaches.get() | |
- if (!allocatedIRCaches.compareAndSet(prevValue, cache :: prevValue)) | |
- registerLoop() | |
- } | |
- registerLoop() | |
+ private[sbtplugin] def freeAllIRCaches(): Unit = | |
+ allocatedIRCaches.getAndSet(Nil).foreach(_.free()) | |
- cache | |
- } | |
+ private val createdTestAdapters = | |
+ new AtomicReference[List[TestAdapter]](Nil) | |
- private[sbtplugin] def freeAllIRCaches(): Unit = { | |
- val allCaches = allocatedIRCaches.getAndSet(Nil) | |
- for (cache <- allCaches) | |
- cache.free() | |
- private def newTestAdapter(jsEnv: ComJSEnv, config: TestAdapter.Config): TestAdapter = | |
- registerResource(createdTestAdapters, new TestAdapter(jsEnv, config)) | |
++ private def newTestAdapter(jsEnv: ComJSEnv, jsFiles: Seq[VirtualJSFile], | |
++ config: TestAdapter.Config): TestAdapter = { | |
++ registerResource(createdTestAdapters, | |
++ new TestAdapter(jsEnv, jsFiles, config)) | |
+ } | |
+ private[sbtplugin] def closeAllTestAdapters(): Unit = | |
+ createdTestAdapters.getAndSet(Nil).foreach(_.close()) | |
+ | |
- /** Non-deprecated alias of `scalaJSClearCacheStats` for internal use. */ | |
- private[sbtplugin] val scalaJSClearCacheStatsInternal = TaskKey[Unit]( | |
- "scalaJSClearCacheStats", | |
- "Scala.js internal: Clear the global IR cache's statistics. Used to " + | |
- "implement cache statistics.", KeyRanks.Invisible) | |
- | |
- @deprecated("Not used anymore.", "0.6.20") | |
- val scalaJSClearCacheStats = scalaJSClearCacheStatsInternal | |
- | |
- /** Dummy setting to ensure we do not fork in Scala.js run & test. */ | |
- val scalaJSEnsureUnforked = SettingKey[Boolean]("ensureUnforked", | |
- "Scala.js internal: Fails if fork is true.", KeyRanks.Invisible) | |
- | |
- val scalaJSLinker: SettingKey[ClearableLinker] = | |
- ScalaJSPlugin.autoImport.scalaJSLinker | |
- | |
- val usesScalaJSLinkerTag: SettingKey[Tags.Tag] = | |
- ScalaJSPlugin.autoImport.usesScalaJSLinkerTag | |
- | |
- /** Non-deprecated alias of `scalaJSIRCacheHolder` for internal use. */ | |
- private[sbtplugin] val scalaJSIRCacheHolderInternal = SettingKey[globalIRCache.Cache]( | |
- "scalaJSIRCacheHolder", | |
- "Scala.js internal: Setting to persist a cache. Do NOT use this directly. " + | |
- "Use scalaJSIRCache instead.", KeyRanks.Invisible) | |
- | |
- @deprecated("Use scalaJSIRCache instead", "0.6.20") | |
- val scalaJSIRCacheHolder = scalaJSIRCacheHolderInternal | |
- | |
- val scalaJSIRCache: TaskKey[globalIRCache.Cache] = | |
- ScalaJSPlugin.autoImport.scalaJSIRCache | |
- | |
- /** Non-deprecated alias of `scalaJSRequestsDOM` for internal use. */ | |
- private[sbtplugin] val scalaJSRequestsDOMInternal = TaskKey[Boolean]( | |
- "scalaJSRequestsDOM", | |
- "Scala.js internal: Whether a project really wants the DOM. " + | |
- "Calculated using requiresDOM and jsDependencies", KeyRanks.Invisible) | |
- | |
- /** Internal task to calculate whether a project requests the DOM | |
- * (through jsDependencies or requiresDOM) */ | |
- @deprecated( | |
- "`scalaJSRequestsDOM` will always be false in new builds, because " + | |
- "`jsDependencies += RuntimeDOM` and `requiresDOM := true` are " + | |
- "deprecated. A better alternative to reading `scalaJSRequestsDOM` is " + | |
- "to detect whether `resolvedJSEnv` is a DOM-enabled JS env, or to use " + | |
- "your own setting key.", | |
- "0.6.20") | |
- val scalaJSRequestsDOM = scalaJSRequestsDOMInternal | |
- | |
- /** All .sjsir files on the fullClasspath, used by scalajsp. */ | |
- val sjsirFilesOnClasspath: TaskKey[Seq[String]] = | |
- ScalaJSPlugin.autoImport.sjsirFilesOnClasspath | |
- | |
- /** Internal task to map discovered main classes to whether they are in the | |
- * "new" style (true, standard main method) or the "old" style (false, | |
- * `js.JSApp` or `main(): Unit` method). | |
+ /* #2798 -- On Java 9+, the parallel collections on 2.10 die with a | |
+ * `NumberFormatException` and prevent the linker from working. | |
+ * | |
+ * By default, we therefore pre-emptively disable the parallel optimizer in | |
+ * case the parallel collections cannot deal with the current version of | |
+ * Java. | |
+ * | |
+ * TODO This will automatically "fix itself" once we upgrade to sbt 1.x, | |
+ * which uses Scala 2.12. We should get rid of that workaround at that point | |
+ * for tidiness, though. | |
*/ | |
- val scalaJSDiscoveredMainClasses = TaskKey[Map[String, Boolean]]( | |
- "scalaJSDiscoveredMainClasses", | |
- "Discovered main classes and whether they use the \"new\" style", | |
- KeyRanks.Invisible) | |
- | |
- val scalaJSModuleIdentifier = TaskKey[Option[String]]( | |
- "scalaJSModuleIdentifier", | |
- "An identifier for the module which contains the exports of Scala.js", | |
- KeyRanks.Invisible) | |
- | |
- val scalaJSSourceFiles: AttributeKey[Seq[File]] = | |
- ScalaJSPlugin.autoImport.scalaJSSourceFiles | |
- | |
- val stageKeys: Map[Stage, TaskKey[Attributed[File]]] = | |
- ScalaJSPlugin.stageKeys | |
- | |
- /** A JS expression that detects the global scope just like Scala.js */ | |
- val jsGlobalExpr: String = { | |
- """((typeof global === "object" && global && | |
- global["Object"] === Object) ? global : this)""" | |
+ private val DefaultParallelLinker: Boolean = { | |
+ try { | |
+ scala.util.Properties.isJavaAtLeast("1.8") | |
+ true | |
+ } catch { | |
+ case _: NumberFormatException => false | |
+ } | |
} | |
- def logIRCacheStats(logger: Logger): Unit = | |
- ScalaJSPlugin.logIRCacheStats(logger) | |
+ private val scalajspParser = { | |
+ loadForParser(sjsirFilesOnClasspath) { (_, relPaths) => | |
+ val examples = ScalajspUtils.relPathsExamples(relPaths.getOrElse(Nil)) | |
+ OptSpace ~> StringBasic.examples(examples) | |
+ } | |
+ } | |
/** Patches the IncOptions so that .sjsir files are pruned as needed. */ | |
def scalaJSPatchIncOptions(incOptions: IncOptions): IncOptions = | |
@@@ -343,43 -975,44 +349,51 @@@ | |
} | |
) | |
- val scalaJSCompileSettings = ( | |
- scalaJSConfigSettings ++ | |
- scalaJSRunSettings | |
+ val scalaJSCompileSettings: Seq[Setting[_]] = ( | |
+ scalaJSConfigSettings | |
) | |
- val scalaJSTestFrameworkSettings = Seq( | |
+ private val scalaJSTestFrameworkSettings = Seq( | |
loadedTestFrameworks := { | |
- // use assert to prevent warning about pure expr in stat pos | |
- assert(scalaJSEnsureUnforked.value) | |
+ if (fork.value) { | |
+ throw new MessageOnlyException( | |
+ "`test` tasks in a Scala.js project require " + | |
+ "`fork in Test := false`.") | |
+ } | |
- val console = scalaJSConsole.value | |
- val logger = streams.value.log | |
+ val frameworks = testFrameworks.value | |
+ | |
- val jsEnv = loadedJSEnv.value match { | |
- case jsEnv: ComJSEnv => jsEnv | |
+ val env = jsEnv.value match { | |
+ case env: ComJSEnv => env | |
- case jsEnv => | |
+ case env => | |
throw new MessageOnlyException( | |
- s"You need a ComJSEnv to test (found ${jsEnv.name})") | |
+ s"You need a ComJSEnv to test (found ${env.name})") | |
+ } | |
+ | |
+ val files = jsExecutionFiles.value | |
+ | |
+ val moduleKind = scalaJSLinkerConfig.value.moduleKind | |
+ val moduleIdentifier = moduleKind match { | |
+ case ModuleKind.NoModule => None | |
+ case ModuleKind.CommonJSModule => Some(scalaJSLinkedFile.value.data.getPath) | |
} | |
- val frameworksAndTheirImplNames = | |
- testFrameworks.value.map(f => f -> f.implClassNames.toList) | |
- val moduleKind = scalaJSModuleKind.value | |
- val moduleIdentifier = scalaJSModuleIdentifier.value | |
+ val frameworkNames = frameworks.map(_.implClassNames.toList).toList | |
+ val logger = sbtLogger2ToolsLogger(streams.value.log) | |
+ val config = TestAdapter.Config() | |
- .withLogger(sbtLogger2ToolsLogger(logger)) | |
- .withJSConsole(console) | |
++ .withLogger(logger) | |
+ .withModuleSettings(moduleKind, moduleIdentifier) | |
- FrameworkDetector.detectFrameworks(env, files, moduleKind, | |
- moduleIdentifier, frameworksAndTheirImplNames, logger) | |
- val adapter = newTestAdapter(jsEnv, config) | |
++ val adapter = newTestAdapter(env, files, config) | |
+ val frameworkAdapters = adapter.loadFrameworks(frameworkNames) | |
+ | |
+ frameworks.zip(frameworkAdapters).collect { | |
+ case (tf, Some(adapter)) => (tf, adapter) | |
+ }.toMap | |
}, | |
+ | |
// Override default to avoid triggering a test:fastOptJS in a test:compile | |
// without loosing autocompletion. | |
definedTestNames := { | |
diff --cc scripts/assemble-cli.sh | |
index f2cce08,e4daf4e..0000000 | |
--- a/scripts/assemble-cli.sh | |
+++ b/scripts/assemble-cli.sh | |
@@@ -12,16 -12,16 +12,16 @@@ f | |
BINVER=$1 | |
case $BINVER in | |
2.10) | |
- FULLVERS="2.10.2 2.10.3 2.10.4 2.10.5 2.10.6" | |
- BASEVER="2.10.6" | |
+ FULLVERS="2.10.2 2.10.3 2.10.4 2.10.5 2.10.6 2.10.7" | |
+ BASEVER="2.10.7" | |
;; | |
2.11) | |
- FULLVERS="2.11.0 2.11.1 2.11.2 2.11.4 2.11.5 2.11.6 2.11.7 2.11.8 2.11.11" | |
- BASEVER="2.11.11" | |
+ FULLVERS="2.11.0 2.11.1 2.11.2 2.11.4 2.11.5 2.11.6 2.11.7 2.11.8 2.11.11 2.11.12" | |
+ BASEVER="2.11.12" | |
;; | |
2.12) | |
- FULLVERS="2.12.1 2.12.2 2.12.3" | |
- BASEVER="2.12.3" | |
- FULLVERS="2.12.0 2.12.1 2.12.2 2.12.3 2.12.4" | |
++ FULLVERS="2.12.1 2.12.2 2.12.3 2.12.4" | |
+ BASEVER="2.12.4" | |
;; | |
*) | |
echo "Invalid Scala version $BINVER" >&2 | |
diff --cc scripts/publish.sh | |
index 90a4995,42d8ec5..0000000 | |
--- a/scripts/publish.sh | |
+++ b/scripts/publish.sh | |
@@@ -7,11 -7,11 +7,11 @@@ els | |
CMD="echo sbt" | |
fi | |
- FULL_VERSIONS="2.10.2 2.10.3 2.10.4 2.10.5 2.10.6 2.11.0 2.11.1 2.11.2 2.11.4 2.11.5 2.11.6 2.11.7 2.11.8 2.11.11 2.12.1 2.12.2 2.12.3 2.13.0-M2" | |
- BIN_VERSIONS="2.10.6 2.11.11 2.12.3 2.13.0-M2" | |
- CLI_VERSIONS="2.10.6 2.11.11 2.12.3" | |
- SBT_VERSION="2.10.6" | |
- SBT1_VERSION="2.12.3" | |
-FULL_VERSIONS="2.10.2 2.10.3 2.10.4 2.10.5 2.10.6 2.10.7 2.11.0 2.11.1 2.11.2 2.11.4 2.11.5 2.11.6 2.11.7 2.11.8 2.11.11 2.11.12 2.12.0 2.12.1 2.12.2 2.12.3 2.12.4 2.13.0-M2" | |
++FULL_VERSIONS="2.10.2 2.10.3 2.10.4 2.10.5 2.10.6 2.10.7 2.11.0 2.11.1 2.11.2 2.11.4 2.11.5 2.11.6 2.11.7 2.11.8 2.11.11 2.11.12 2.12.1 2.12.2 2.12.3 2.12.4 2.13.0-M2" | |
+ BIN_VERSIONS="2.10.7 2.11.12 2.12.4 2.13.0-M2" | |
+ CLI_VERSIONS="2.10.7 2.11.12 2.12.4" | |
+ SBT_VERSION="2.10.7" | |
+ SBT1_VERSION="2.12.4" | |
SBT1_SBTVERSION="1.0.0" | |
COMPILER="compiler jUnitPlugin" | |
diff --cc test-adapter/src/main/scala/org/scalajs/testadapter/ScalaJSFramework.scala | |
index a1bc922,7f19b80..0000000 | |
--- a/test-adapter/src/main/scala/org/scalajs/testadapter/ScalaJSFramework.scala | |
+++ b/test-adapter/src/main/scala/org/scalajs/testadapter/ScalaJSFramework.scala | |
@@@ -21,86 -21,42 +21,41 @@@ import org.scalajs.testcommon. | |
import sbt.testing.{Logger => _, _} | |
+ /** A shim over [[TestAdapter]] for compatiblity. */ | |
+ @deprecated("Use TestAdapter instead.", "0.6.22") | |
final class ScalaJSFramework( | |
- private[testadapter] val frameworkName: String, | |
- private val jsEnv: ComJSEnv, | |
- private val jsFiles: Seq[VirtualJSFile], | |
- private[testadapter] val moduleKind: ModuleKind, | |
- private[testadapter] val moduleIdentifier: Option[String], | |
- private[testadapter] val logger: Logger | |
+ frameworkName: String, | |
- libEnv: ComJSEnv, | |
++ jsEnv: ComJSEnv, | |
++ jsFiles: Seq[VirtualJSFile], | |
+ moduleKind: ModuleKind, | |
+ moduleIdentifier: Option[String], | |
- logger: Logger, | |
- jsConsole: JSConsole | |
++ logger: Logger | |
) extends Framework { | |
- def this(frameworkName: String, libEnv: ComJSEnv, logger: Logger, | |
- jsConsole: JSConsole) = { | |
- this(frameworkName, libEnv, ModuleKind.NoModule, None, logger, jsConsole) | |
+ def this(frameworkName: String, jsEnv: ComJSEnv, jsFiles: Seq[VirtualJSFile], | |
+ logger: Logger) = { | |
+ this(frameworkName, jsEnv, jsFiles, ModuleKind.NoModule, None, logger) | |
} | |
- private[this] val frameworkInfo = fetchFrameworkInfo() | |
+ private[this] val adapter = { | |
+ val config = TestAdapter.Config() | |
+ .withLogger(logger) | |
- .withJSConsole(jsConsole) | |
+ .withModuleSettings(moduleKind, moduleIdentifier) | |
- private[this] var _isRunning = false | |
- | |
- val name: String = frameworkInfo.name | |
- | |
- def fingerprints: Array[Fingerprint] = frameworkInfo.fingerprints.toArray | |
- | |
- def runner(args: Array[String], remoteArgs: Array[String], | |
- testClassLoader: ClassLoader): Runner = synchronized { | |
- | |
- if (_isRunning) { | |
- throw new IllegalStateException( | |
- "Scala.js test frameworks do not support concurrent runs") | |
- new TestAdapter(libEnv, config) | |
++ new TestAdapter(jsEnv, jsFiles, config) | |
} | |
- _isRunning = true | |
+ private[this] val realFramework = | |
+ adapter.loadFrameworks(List(List(frameworkName))).head.get | |
- new ScalaJSRunner(this, args, remoteArgs) | |
- } | |
- | |
- private[testadapter] def runDone(): Unit = synchronized(_isRunning = false) | |
- | |
- private[testadapter] def newComRunner(files: Seq[VirtualJSFile]): ComJSRunner = | |
- jsEnv.comRunner(jsFiles ++ files) | |
+ def name: String = realFramework.name | |
- private def fetchFrameworkInfo() = { | |
- val runner = newComRunner(frameworkInfoLauncher :: Nil) | |
- runner.start(logger, ConsoleJSConsole) | |
+ def fingerprints: Array[Fingerprint] = realFramework.fingerprints | |
- try { | |
- Serializer.deserialize[FrameworkInfo](runner.receive()) | |
- } finally { | |
- runner.close() | |
- runner.await(VMTermTimeout) | |
- } | |
- } | |
- | |
- private def frameworkInfoLauncher = { | |
- val prefix = optionalExportsNamespacePrefix | |
- val name = jsonToString(frameworkName.toJSON) | |
- val code = s""" | |
- new ${prefix}org.scalajs.testinterface.internal.InfoSender($name).initAndSend(); | |
- """ | |
- new MemVirtualJSFile(s"testFrameworkInfo.js").withContent(code) | |
- } | |
- | |
- private[testadapter] def optionalExportsNamespacePrefix: String = { | |
- ScalaJSFramework.optionalExportsNamespacePrefix(moduleKind, | |
- moduleIdentifier) | |
- } | |
+ def runner(args: Array[String], remoteArgs: Array[String], | |
+ testClassLoader: ClassLoader): Runner = { | |
+ realFramework.runner(args, remoteArgs, testClassLoader) | |
} | |
- private[testadapter] object ScalaJSFramework { | |
- private[testadapter] def optionalExportsNamespacePrefix( | |
- moduleKind: ModuleKind, moduleIdentifier: Option[String]): String = { | |
- moduleKind match { | |
- case ModuleKind.NoModule => | |
- "" | |
- | |
- case ModuleKind.CommonJSModule => | |
- val moduleIdent = moduleIdentifier.getOrElse { | |
- throw new IllegalArgumentException( | |
- "The module identifier must be specified for CommonJS modules") | |
- } | |
- s"""require("${escapeJS(moduleIdent)}").""" // note the final '.' | |
- } | |
- } | |
+ override protected def finalize(): Unit = adapter.close() | |
} | |
diff --cc test-adapter/src/main/scala/org/scalajs/testadapter/ScalaJSRunner.scala | |
index 3cc9ddd,781d034..0000000 | |
--- a/test-adapter/src/main/scala/org/scalajs/testadapter/ScalaJSRunner.scala | |
+++ b/test-adapter/src/main/scala/org/scalajs/testadapter/ScalaJSRunner.scala | |
diff --cc test-adapter/src/main/scala/org/scalajs/testadapter/ScalaJSTask.scala | |
index 40c2068,60f7cd5..0000000 | |
--- a/test-adapter/src/main/scala/org/scalajs/testadapter/ScalaJSTask.scala | |
+++ b/test-adapter/src/main/scala/org/scalajs/testadapter/ScalaJSTask.scala | |
diff --git a/test-adapter/src/main/scala/org/scalajs/testadapter/TestAdapter.scala b/test-adapter/src/main/scala/org/scalajs/testadapter/TestAdapter.scala | |
index 6056fc4..62860c5 100644 | |
--- a/test-adapter/src/main/scala/org/scalajs/testadapter/TestAdapter.scala | |
+++ b/test-adapter/src/main/scala/org/scalajs/testadapter/TestAdapter.scala | |
@@ -26,7 +26,8 @@ import org.scalajs.testcommon._ | |
import sbt.testing.Framework | |
-final class TestAdapter(jsEnv: ComJSEnv, config: TestAdapter.Config) { | |
+final class TestAdapter(jsEnv: ComJSEnv, jsFiles: Seq[VirtualJSFile], | |
+ config: TestAdapter.Config) { | |
import TestAdapter.ManagedRunner | |
@@ -134,7 +135,7 @@ final class TestAdapter(jsEnv: ComJSEnv, config: TestAdapter.Config) { | |
""" | |
val launcher = new MemVirtualJSFile("startTestBridge.js").withContent(code) | |
- val runner = jsEnv.comRunner(launcher) | |
+ val runner = jsEnv.comRunner(jsFiles :+ launcher) | |
runner.start(config.logger, config.console) | |
new ManagedRunner(threadId, runner) | |
} | |
diff --git a/test-interface/src/main/scala/org/scalajs/testinterface/internal/Bridge.scala b/test-interface/src/main/scala/org/scalajs/testinterface/internal/Bridge.scala | |
index daec33d..22b7d35 100644 | |
--- a/test-interface/src/main/scala/org/scalajs/testinterface/internal/Bridge.scala | |
+++ b/test-interface/src/main/scala/org/scalajs/testinterface/internal/Bridge.scala | |
@@ -37,8 +37,7 @@ private object Bridge { | |
private def createRunnerFun(isMaster: Boolean) = { args: RunnerArgs => | |
val framework = FrameworkLoader.loadFramework(args.frameworkImpl) | |
- val loader = new ScalaJSClassLoader( | |
- scala.scalajs.runtime.environmentInfo.exportsNamespace) | |
+ val loader = new ScalaJSClassLoader() | |
val runID = args.runID | |
diff --git a/test-interface/src/main/scala/org/scalajs/testinterface/internal/FrameworkLoader.scala b/test-interface/src/main/scala/org/scalajs/testinterface/internal/FrameworkLoader.scala | |
index a73193b..47ec713 100644 | |
--- a/test-interface/src/main/scala/org/scalajs/testinterface/internal/FrameworkLoader.scala | |
+++ b/test-interface/src/main/scala/org/scalajs/testinterface/internal/FrameworkLoader.scala | |
@@ -15,29 +15,12 @@ private[internal] object FrameworkLoader { | |
} | |
def detectFrameworkNames(names: List[List[String]]): List[Option[String]] = { | |
- def frameworkExistsInReflect(name: String): Boolean = { | |
+ def frameworkExists(name: String): Boolean = { | |
Reflect.lookupInstantiatableClass(name).exists { clazz => | |
classOf[sbt.testing.Framework].isAssignableFrom(clazz.runtimeClass) | |
} | |
} | |
- def frameworkExistsInExportsNamespace(name: String): Boolean = { | |
- /* This happens for testing frameworks developed before 0.6.15 that have | |
- * not yet updated to using reflective instantiation, and are still | |
- * using exports. | |
- * Note that here, we have to assume that whatever we find is indeed a | |
- * proper class export for a class extending sbt.testing.Framework. | |
- */ | |
- val exportsNamespace = | |
- scala.scalajs.runtime.environmentInfo.exportsNamespace | |
- name.split('.').foldLeft[js.UndefOr[js.Dynamic]](exportsNamespace) { | |
- (prev, part) => prev.map(_.selectDynamic(part)) | |
- }.isDefined | |
- } | |
- | |
- def frameworkExists(name: String): Boolean = | |
- frameworkExistsInReflect(name) || frameworkExistsInExportsNamespace(name) | |
- | |
for (frameworkNames <- names) | |
yield frameworkNames.find(frameworkExists(_)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment