11package dotty .communitybuild
22
33import java .nio .file ._
4- import java .io .{PrintWriter , File }
4+ import java .io .{BufferedReader , InputStreamReader , PrintWriter , File }
55import java .nio .charset .StandardCharsets .UTF_8
6+ import scala .collection .Iterator
67
78lazy val communitybuildDir : Path = Paths .get(sys.props(" user.dir" ))
89
@@ -19,6 +20,7 @@ lazy val sbtPluginFilePath: String =
1920 communitybuildDir.resolve(" sbt-dotty-sbt" ).toAbsolutePath().toString()
2021
2122def log (msg : String ) = println(Console .GREEN + msg + Console .RESET )
23+ def error (msg : String ) = println(Console .RED + msg + Console .RESET )
2224
2325/** Executes shell command, returns false in case of error. */
2426def exec (projectDir : Path , binary : String , arguments : Seq [String ], environment : Map [String , String ]): Int =
@@ -27,8 +29,18 @@ def exec(projectDir: Path, binary: String, arguments: Seq[String], environment:
2729 log(command.mkString(" " ))
2830 val builder = new ProcessBuilder (command : _* ).directory(projectDir.toFile).inheritIO()
2931 builder.environment.putAll(environment.asJava)
32+
3033 val process = builder.start()
3134 val exitCode = process.waitFor()
35+ if (exitCode != 0 ) {
36+ val errorStream = process.getErrorStream()
37+ val isReader = new InputStreamReader (process.getErrorStream())
38+ val br = new BufferedReader (isReader)
39+ Iterator .continually(br.readLine()).takeWhile(_ != null ).foreach(error(_))
40+ br.close()
41+ isReader.close()
42+ errorStream.close()
43+ }
3244 exitCode
3345
3446
@@ -656,6 +668,12 @@ object projects:
656668 dependencies = List (scalatest, scalatestplusJunit, scalatestplusScalacheck)
657669 )
658670
671+ lazy val monocle = SbtCommunityProject (
672+ project = " Monocle" ,
673+ sbtTestCommand = " monocleJVM/test" ,
674+ dependencies = List (cats, munit, discipline, disciplineMunit)
675+ )
676+
659677 lazy val protoquill = SbtCommunityProject (
660678 project = " protoquill" ,
661679 sbtTestCommand = " test" ,
@@ -746,10 +764,12 @@ def allProjects = List(
746764 projects.izumiReflect,
747765 projects.perspective,
748766 projects.akka,
767+ projects.monocle,
749768 projects.protoquill,
750769 projects.onnxScala,
751770 projects.playJson,
752771 projects.scalatestplusTestNG,
753772)
754773
755774lazy val projectMap = allProjects.groupBy(_.project)
775+
0 commit comments