summaryrefslogtreecommitdiff
path: root/main/api/src/mill/api/BuildReporter.scala
blob: f8405984544e8542d0e5fd6d9b08c85ad12638d4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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