diff options
author | Tobias Roeser <le.petit.fou@web.de> | 2019-10-16 13:07:51 +0200 |
---|---|---|
committer | Tobias Roeser <le.petit.fou@web.de> | 2019-10-16 13:07:51 +0200 |
commit | 6a19be4008426bb4edc137dd756d0a0b7347e0a5 (patch) | |
tree | 7add40a2be94061cac8767bb36e987a304077854 /main/api/src/mill/api/BuildReporter.scala | |
parent | 9354e9311118ca23a44f72e463875a2769e53716 (diff) | |
parent | 76a8dfe705cafc18836df122d45c51452d4c6de3 (diff) | |
download | mill-6a19be4008426bb4edc137dd756d0a0b7347e0a5.tar.gz mill-6a19be4008426bb4edc137dd756d0a0b7347e0a5.tar.bz2 mill-6a19be4008426bb4edc137dd756d0a0b7347e0a5.zip |
Merge pull request https://github.com/lihaoyi/mill/pull/664
Added the contrib.bsp module which contains an implementation of the BuildServer from BSP, thus alowing mill to be used by IDEs which use BSP.
The MillBuildServer supports the following BSP features:
* retrieving the build targets
* compile requests
* run requests
* test requests
* compile published diagnostics
* task start/finish notifications for compile and test requests
* progress notifications for compile
* retrieving the scala main classes, test classes and scalac options
Currently these features allow importing and compiling a mill project in IntelliJ IDEA via BSP.
Known issues, some of which are being investigated:
* can not run main classes from the IntelliJ interface
* rarely, a strange NoClassDefFoundException is being thrown upon compiling from intellij
* still tweaking the command for starting the server in order to work on all operating systems ( should be fine for linux and macOs so far )
Would be great to get feedback about this integration.
Diffstat (limited to 'main/api/src/mill/api/BuildReporter.scala')
-rw-r--r-- | main/api/src/mill/api/BuildReporter.scala | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/main/api/src/mill/api/BuildReporter.scala b/main/api/src/mill/api/BuildReporter.scala new file mode 100644 index 00000000..2b360a45 --- /dev/null +++ b/main/api/src/mill/api/BuildReporter.scala @@ -0,0 +1,97 @@ +package mill.api + +import java.io.File + +import sbt.testing.Event + +/** + * 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 + + |