summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/api/src/mill/api/BspCompileArguments.scala9
-rw-r--r--main/api/src/mill/api/BspContext.scala14
-rw-r--r--main/api/src/mill/api/TestReporter.scala10
3 files changed, 33 insertions, 0 deletions
diff --git a/main/api/src/mill/api/BspCompileArguments.scala b/main/api/src/mill/api/BspCompileArguments.scala
index 1af45a61..73586cc8 100644
--- a/main/api/src/mill/api/BspCompileArguments.scala
+++ b/main/api/src/mill/api/BspCompileArguments.scala
@@ -1,8 +1,17 @@
package mill.api
+/**
+ * Data structure to represent Bsp client-specified
+ * compilation arguments
+ */
class BspCompileArguments {
var arguments: Seq[String] = Seq.empty[String]
+ /**
+ * Return the compilation arguments specified by the
+ * Bsp client, which may or may not be found in the
+ * compiler options of any module from the build file.
+ */
def args: Seq[String] = {
arguments
}
diff --git a/main/api/src/mill/api/BspContext.scala b/main/api/src/mill/api/BspContext.scala
index c93fbca1..1281518d 100644
--- a/main/api/src/mill/api/BspContext.scala
+++ b/main/api/src/mill/api/BspContext.scala
@@ -2,10 +2,24 @@ package mill.api
import sbt.testing.Event
+/**
+ * Bsp Context with functionality for retrieving compile
+ * arguments provided by a Bsp client, as well as for logging
+ * the start and finish of a task triggered by the request of
+ * a Bsp client. Can be integrated into mill's Ctx to inject
+ * Bsp functionality into tasks like compile/run/test.
+ */
trait BspContext extends BspCompileArguments with TestReporter
+/**
+ * Dummy Bsp Context that does nothing
+ * upon starting or finishing a task, and
+ * contains no client-specified compilation
+ * arguments
+ */
object DummyBspContext extends BspContext {
override def args = Seq.empty[String]
+
override def logStart(event: Event): Unit = {
}
diff --git a/main/api/src/mill/api/TestReporter.scala b/main/api/src/mill/api/TestReporter.scala
index b3d0e432..97dec761 100644
--- a/main/api/src/mill/api/TestReporter.scala
+++ b/main/api/src/mill/api/TestReporter.scala
@@ -2,6 +2,12 @@ package mill.api
import sbt.testing._
+/**
+ * Test reporter class that can be
+ * injected into the test task and
+ * report information upon the start
+ * and the finish of testing events
+ */
trait TestReporter {
def logStart(event: Event): Unit
@@ -10,6 +16,10 @@ trait TestReporter {
}
+/**
+ * Dummy Test Reporter that doesn't report
+ * anything for any testing event.
+ */
object DummyReporter extends TestReporter {
override def logStart(event: Event): Unit = {