1
1
package dotty .communitybuild
2
2
3
3
import java .nio .file ._
4
- import java .io .{PrintWriter , File }
4
+ import java .io .{BufferedReader , InputStreamReader , PrintWriter , File }
5
5
import java .nio .charset .StandardCharsets .UTF_8
6
+ import scala .collection .Iterator
6
7
7
8
lazy val communitybuildDir : Path = Paths .get(sys.props(" user.dir" ))
8
9
@@ -16,14 +17,25 @@ lazy val sbtPluginFilePath: String =
16
17
communitybuildDir.resolve(" sbt-dotty-sbt" ).toAbsolutePath().toString()
17
18
18
19
def log (msg : String ) = println(Console .GREEN + msg + Console .RESET )
20
+ def error (msg : String ) = println(Console .RED + msg + Console .RESET )
19
21
20
22
/** Executes shell command, returns false in case of error. */
21
23
def exec (projectDir : Path , binary : String , arguments : String * ): Int =
22
24
val command = binary +: arguments
23
25
log(command.mkString(" " ))
24
26
val builder = new ProcessBuilder (command : _* ).directory(projectDir.toFile).inheritIO()
27
+
25
28
val process = builder.start()
26
29
val exitCode = process.waitFor()
30
+ if (exitCode != 0 ) {
31
+ val errorStream = process.getErrorStream()
32
+ val isReader = new InputStreamReader (process.getErrorStream())
33
+ val br = new BufferedReader (isReader)
34
+ Iterator .continually(br.readLine()).takeWhile(_ != null ).foreach(error(_))
35
+ br.close()
36
+ isReader.close()
37
+ errorStream.close()
38
+ }
27
39
exitCode
28
40
29
41
@@ -660,6 +672,13 @@ object projects:
660
672
dependencies = List (scalatest, scalatestplusJunit, scalatestplusScalacheck)
661
673
)
662
674
675
+ lazy val monocle = SbtCommunityProject (
676
+ project = " Monocle" ,
677
+ sbtTestCommand = " monocleJVM/test" ,
678
+ dependencies = List (cats, shapeless, munit, discipline, disciplineMunit)
679
+ )
680
+
681
+
663
682
end projects
664
683
665
684
def allProjects = List (
@@ -725,6 +744,7 @@ def allProjects = List(
725
744
projects.izumiReflect,
726
745
projects.perspective,
727
746
projects.akka,
747
+ projects.monocle,
728
748
)
729
749
730
750
lazy val projectMap = allProjects.groupBy(_.project)
0 commit comments