|
| 1 | +import org.scalajs.core.tools.io._ |
1 | 2 | import org.scalajs.core.tools.jsdep.ManifestFilters
|
2 | 3 | import org.scalajs.jsenv.nodejs.JSDOMNodeJSEnv
|
| 4 | +import org.scalajs.sbtplugin.ScalaJSPluginInternal._ |
| 5 | +import org.scalajs.sbtplugin.Loggers.sbtLogger2ToolsLogger |
| 6 | + |
| 7 | +lazy val concurrentFakeFullOptJS = taskKey[Any]("") |
| 8 | +lazy val concurrentUseOfLinkerTest = taskKey[Any]("") |
3 | 9 |
|
4 | 10 | name := "Scala.js sbt test"
|
5 | 11 |
|
@@ -56,7 +62,32 @@ lazy val noDOM = project.settings(baseSettings: _*).
|
56 | 62 | /* This hopefully exposes concurrent uses of the linker. If it fails/gets
|
57 | 63 | * flaky, there is a bug somewhere - #2202
|
58 | 64 | */
|
59 |
| - settings(inConfig(Compile)(run <<= run.dependsOn(fastOptJS, loadedJSEnv)): _*) |
| 65 | + settings(inConfig(Compile)(Seq( |
| 66 | + // A fake fullOptJS that we will run concurrently with the true fullOptJS |
| 67 | + concurrentFakeFullOptJS := Def.taskDyn { |
| 68 | + val s = (streams in fullOptJS).value |
| 69 | + val log = s.log |
| 70 | + val ir = (scalaJSIR in fullOptJS).value.data |
| 71 | + val moduleInitializers = scalaJSModuleInitializers.value |
| 72 | + |
| 73 | + Def.task { |
| 74 | + log.info("Fake full optimizing") |
| 75 | + val linker = (scalaJSLinker in fullOptJS).value |
| 76 | + linker.link(ir, moduleInitializers, |
| 77 | + WritableMemVirtualJSFile("fake-fastopt.js"), |
| 78 | + sbtLogger2ToolsLogger(log)) |
| 79 | + }.tag((usesScalaJSLinkerTag in fullOptJS).value) |
| 80 | + }.value, |
| 81 | + |
| 82 | + /* Depend on both fullOptJS and concurrentFakeFullOptJS, so that they |
| 83 | + * are hopefully executed in parallel (potentially, but they should be |
| 84 | + * blocked from actually doing so by the concurrent restrictions on |
| 85 | + * usesScalaJSLinkerTag). |
| 86 | + */ |
| 87 | + concurrentUseOfLinkerTest := { |
| 88 | + (fullOptJS.value, concurrentFakeFullOptJS.value) |
| 89 | + } |
| 90 | + ))) |
60 | 91 |
|
61 | 92 | lazy val withDOM = project.settings(baseSettings: _*).
|
62 | 93 | enablePlugins(ScalaJSPlugin).
|
|
0 commit comments