diff options
Diffstat (limited to 'main/api/src')
-rw-r--r-- | main/api/src/mill/api/BspCompileArguments.scala | 18 | ||||
-rw-r--r-- | main/api/src/mill/api/BspContext.scala | 30 | ||||
-rw-r--r-- | main/api/src/mill/api/Ctx.scala | 15 | ||||
-rw-r--r-- | main/api/src/mill/api/TestReporter.scala | 60 |
4 files changed, 65 insertions, 58 deletions
diff --git a/main/api/src/mill/api/BspCompileArguments.scala b/main/api/src/mill/api/BspCompileArguments.scala deleted file mode 100644 index 73586cc8..00000000 --- a/main/api/src/mill/api/BspCompileArguments.scala +++ /dev/null @@ -1,18 +0,0 @@ -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 deleted file mode 100644 index 1281518d..00000000 --- a/main/api/src/mill/api/BspContext.scala +++ /dev/null @@ -1,30 +0,0 @@ -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 = { - - } - - override def logFinish(event: Event): Unit = { - - } -}
\ No newline at end of file diff --git a/main/api/src/mill/api/Ctx.scala b/main/api/src/mill/api/Ctx.scala index 02d50b22..96da84eb 100644 --- a/main/api/src/mill/api/Ctx.scala +++ b/main/api/src/mill/api/Ctx.scala @@ -3,7 +3,6 @@ package mill.api import scala.annotation.{StaticAnnotation, compileTimeOnly} import scala.language.implicitConversions import os.Path -import sbt.internal.inc.ManagedLoggedReporter /** * Provides access to various resources in the context of a currently execution Target. @@ -56,13 +55,13 @@ object Ctx { class Ctx( - val args: IndexedSeq[_], - dest0: () => os.Path, - val log: Logger, - val home: os.Path, - val env: Map[String, String], - val reporter: Int => Option[ManagedLoggedReporter], - val bsp: BspContext + val args: IndexedSeq[_], + dest0: () => os.Path, + val log: Logger, + val home: os.Path, + val env: Map[String, String], + val reporter: Int => Option[BuildProblemReporter], + val testReporter: TestReporter ) extends Ctx.Dest with Ctx.Log diff --git a/main/api/src/mill/api/TestReporter.scala b/main/api/src/mill/api/TestReporter.scala index 97dec761..8adea687 100644 --- a/main/api/src/mill/api/TestReporter.scala +++ b/main/api/src/mill/api/TestReporter.scala @@ -1,5 +1,7 @@ package mill.api +import java.io.File + import sbt.testing._ /** @@ -20,12 +22,66 @@ trait TestReporter { * Dummy Test Reporter that doesn't report * anything for any testing event. */ -object DummyReporter extends TestReporter { +object DummyTestReporter extends TestReporter { override def logStart(event: Event): Unit = { } - override def logFinish(event: Event): Unit = { } } + +trait BuildProblemReporter { + def logError(problem: Problem): Unit + + def logWarning(problem: Problem): Unit + + def logInfo(problem: Problem): Unit + + def printSummary(): Unit +} + +trait ProblemPosition { + def line: Option[Int] + + def lineContent: String + + def offset: Option[Int] + + def pointer: Option[Int] + + def pointerSpace: Option[String] + + def sourcePath: Option[String] + + def sourceFile: Option[File] + + def startOffset: Option[Int] = Option.empty + + def endOffset: Option[Int] = Option.empty + + def startLine: Option[Int] = Option.empty + + def startColumn: Option[Int] = Option.empty + + def endLine: Option[Int] = Option.empty + + def endColumn: Option[Int] = Option.empty +} + +sealed trait Severity +case object Info extends Severity +case object Error extends Severity +case object Warn extends Severity + +trait Problem { + def category: String + + def severity: Severity + + def message: String + + def position: ProblemPosition +} + + |