summaryrefslogtreecommitdiff
path: root/scalalib/src
diff options
context:
space:
mode:
authorAlexandra Dima <alexandra.dima@jetbrains.com>2019-07-12 17:52:57 +0200
committerSamvel Abrahamyan <samvel1024@gmail.com>2019-10-12 14:33:03 +0200
commit2be400138fb32a63a3bb05e6fdec31508673331b (patch)
tree643b58b6b810f28509fdc4fbbcfa9495bc826164 /scalalib/src
parent9c39dd6776944b15433f44c5c4fba994cdd7d152 (diff)
downloadmill-2be400138fb32a63a3bb05e6fdec31508673331b.tar.gz
mill-2be400138fb32a63a3bb05e6fdec31508673331b.tar.bz2
mill-2be400138fb32a63a3bb05e6fdec31508673331b.zip
Partially fixed test request by implementing a test reporter, adding it to each task context and sending it to the test task. Implemented BspContext to hold information about the test reporter and the additional bsp compiler arguments. Made a common data structure for different bsp parameters - TaskParameters.
Diffstat (limited to 'scalalib/src')
-rw-r--r--scalalib/src/JavaModule.scala5
-rw-r--r--scalalib/src/ScalaModule.scala2
-rw-r--r--scalalib/src/TestRunner.scala13
3 files changed, 14 insertions, 6 deletions
diff --git a/scalalib/src/JavaModule.scala b/scalalib/src/JavaModule.scala
index 941f82e7..d7a0eb2c 100644
--- a/scalalib/src/JavaModule.scala
+++ b/scalalib/src/JavaModule.scala
@@ -221,7 +221,7 @@ trait JavaModule extends mill.Module with TaskModule with GenIdeaModule { outer
upstreamCompileOutput(),
allSourceFiles().map(_.path),
compileClasspath().map(_.path),
- javacOptions() ++ T.ctx.compileArguments,
+ javacOptions() ++ T.ctx.bsp.args,
T.ctx().reporter
)
}
@@ -612,7 +612,8 @@ trait TestModule extends JavaModule with TaskModule {
TestRunner.frameworks(testFrameworks()),
runClasspath().map(_.path),
Agg(compile().classes.path),
- args
+ args,
+ T.ctx.bsp
)
TestModule.handleResults(doneMsg, results)
diff --git a/scalalib/src/ScalaModule.scala b/scalalib/src/ScalaModule.scala
index 0c3684c6..85f1b6db 100644
--- a/scalalib/src/ScalaModule.scala
+++ b/scalalib/src/ScalaModule.scala
@@ -140,7 +140,7 @@ trait ScalaModule extends JavaModule { outer =>
javacOptions(),
scalaVersion(),
scalaOrganization(),
- scalacOptions() ++ T.ctx.compileArguments,
+ scalacOptions() ++ T.ctx.bsp.args,
scalaCompilerClasspath().map(_.path),
scalacPluginClasspath().map(_.path),
T.ctx().reporter
diff --git a/scalalib/src/TestRunner.scala b/scalalib/src/TestRunner.scala
index 42e65d63..c2017c77 100644
--- a/scalalib/src/TestRunner.scala
+++ b/scalalib/src/TestRunner.scala
@@ -1,11 +1,13 @@
package mill.scalalib
import ammonite.util.Colors
import mill.Agg
+import mill.api.{DummyReporter, TestReporter}
import mill.modules.Jvm
import mill.scalalib.Lib.discoverTests
import mill.util.{Ctx, PrintLogger}
import mill.util.JsonFormatters._
import sbt.testing._
+import mill.scalalib.api._
import scala.collection.mutable
object TestRunner {
@@ -45,7 +47,8 @@ object TestRunner {
frameworkInstances = TestRunner.frameworks(frameworks),
entireClasspath = Agg.from(classpath.map(os.Path(_))),
testClassfilePath = Agg(os.Path(testCp)),
- args = arguments
+ args = arguments,
+ DummyReporter
)(ctx)
// Clear interrupted state in case some badly-behaved test suite
@@ -66,7 +69,8 @@ object TestRunner {
def runTests(frameworkInstances: ClassLoader => Seq[sbt.testing.Framework],
entireClasspath: Agg[os.Path],
testClassfilePath: Agg[os.Path],
- args: Seq[String])
+ args: Seq[String],
+ testReporter: TestReporter)
(implicit ctx: Ctx.Log with Ctx.Home): (String, Seq[mill.scalalib.TestRunner.Result]) = {
//Leave the context class loader set and open so that shutdown hooks can access it
Jvm.inprocess(entireClasspath, classLoaderOverrideSbtTesting = true, isolated = true, closeContextClassLoaderWhenDone = false, cl => {
@@ -88,7 +92,10 @@ object TestRunner {
while (taskQueue.nonEmpty){
val next = taskQueue.dequeue().execute(
new EventHandler {
- def handle(event: Event) = events.append(event)
+ def handle(event: Event) = {
+ testReporter.logStart(event)
+ events.append(event)
+ }
},
Array(
new Logger {