Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Scala.js toolchain logs in server-client mode #3196

Merged
merged 2 commits into from
Jun 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import org.scalajs.linker.interface.{
ModuleSplitStyle => _,
_
}
import org.scalajs.logging.ScalaConsoleLogger
import org.scalajs.logging.{Level, Logger}
import org.scalajs.jsenv.{Input, JSEnv, RunConfig}
import org.scalajs.testing.adapter.TestAdapter
import org.scalajs.testing.adapter.{TestAdapterInitializer => TAI}
Expand Down Expand Up @@ -158,6 +158,14 @@ class ScalaJSWorkerImpl extends ScalaJSWorkerApi {
(linker, irFileCacheCache)
}
}
private val logger = new Logger {
def log(level: Level, message: => String): Unit = {
System.err.println(message)
}
def trace(t: => Throwable): Unit = {
t.printStackTrace()
}
}
def link(
runClasspath: Seq[Path],
dest: File,
Expand Down Expand Up @@ -190,7 +198,6 @@ class ScalaJSWorkerImpl extends ScalaJSWorkerApi {
dest = dest
))
val irContainersAndPathsFuture = PathIRContainer.fromClasspath(runClasspath)
val logger = new ScalaConsoleLogger
val testInitializer =
if (testBridgeInit)
ModuleInitializer.mainMethod(TAI.ModuleClassName, TAI.MainMethodName) :: Nil
Expand Down Expand Up @@ -284,7 +291,7 @@ class ScalaJSWorkerImpl extends ScalaJSWorkerApi {
def run(config: JsEnvConfig, report: Report): Unit = {
val env = jsEnv(config)
val input = jsEnvInput(report)
val runConfig0 = RunConfig().withLogger(new ScalaConsoleLogger)
val runConfig0 = RunConfig().withLogger(logger)
val runConfig =
if (mill.api.SystemStreams.isOriginal()) runConfig0
else runConfig0
Expand Down Expand Up @@ -315,7 +322,7 @@ class ScalaJSWorkerImpl extends ScalaJSWorkerApi {
): (() => Unit, sbt.testing.Framework) = {
val env = jsEnv(config)
val input = jsEnvInput(report)
val tconfig = TestAdapter.Config().withLogger(new ScalaConsoleLogger)
val tconfig = TestAdapter.Config().withLogger(logger)

val adapter = new TestAdapter(env, input, tconfig)

Expand Down