From 53671b9cdfc53c1edcba256b367e268be0b7357d Mon Sep 17 00:00:00 2001 From: Samvel Abrahamyan Date: Tue, 8 Oct 2019 12:07:25 +0200 Subject: Add short comments about build reporters. --- main/api/src/mill/api/BuildReporter.scala | 97 +++++++++++++++++++++++++++++++ main/api/src/mill/api/TestReporter.scala | 87 --------------------------- 2 files changed, 97 insertions(+), 87 deletions(-) create mode 100644 main/api/src/mill/api/BuildReporter.scala delete mode 100644 main/api/src/mill/api/TestReporter.scala diff --git a/main/api/src/mill/api/BuildReporter.scala b/main/api/src/mill/api/BuildReporter.scala new file mode 100644 index 00000000..f8405984 --- /dev/null +++ b/main/api/src/mill/api/BuildReporter.scala @@ -0,0 +1,97 @@ +package mill.api + +import java.io.File + +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 + + def logFinish(event: Event): Unit + + +} + +/** + * Dummy Test Reporter that doesn't report + * anything for any testing event. + */ +object DummyTestReporter extends TestReporter { + override def logStart(event: Event): Unit = { + + } + override def logFinish(event: Event): Unit = { + + } +} + +/** + * A listener trait for getting notified about + * build output like compiler warnings and errors + */ +trait BuildProblemReporter { + def logError(problem: Problem): Unit + + def logWarning(problem: Problem): Unit + + def logInfo(problem: Problem): Unit + + def printSummary(): Unit +} + +/** + * Contains general information about the build problem + */ +trait Problem { + def category: String + + def severity: Severity + + def message: String + + def position: ProblemPosition +} + +/** + * Indicates the exact location (source file, line, column) of the build problem + */ +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 + + diff --git a/main/api/src/mill/api/TestReporter.scala b/main/api/src/mill/api/TestReporter.scala deleted file mode 100644 index 8adea687..00000000 --- a/main/api/src/mill/api/TestReporter.scala +++ /dev/null @@ -1,87 +0,0 @@ -package mill.api - -import java.io.File - -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 - - def logFinish(event: Event): Unit - - -} - -/** - * Dummy Test Reporter that doesn't report - * anything for any testing event. - */ -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 -} - - -- cgit v1.2.3