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,14 +20,25 @@ 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 : String * ): Int =
2527 val command = binary +: arguments
2628 log(command.mkString(" " ))
2729 val builder = new ProcessBuilder (command : _* ).directory(projectDir.toFile).inheritIO()
30+
2831 val process = builder.start()
2932 val exitCode = process.waitFor()
33+ if (exitCode != 0 ) {
34+ val errorStream = process.getErrorStream()
35+ val isReader = new InputStreamReader (process.getErrorStream())
36+ val br = new BufferedReader (isReader)
37+ Iterator .continually(br.readLine()).takeWhile(_ != null ).foreach(error(_))
38+ br.close()
39+ isReader.close()
40+ errorStream.close()
41+ }
3042 exitCode
3143
3244
@@ -639,6 +651,12 @@ object projects:
639651 dependencies = List (scalatest, scalatestplusJunit, scalatestplusScalacheck)
640652 )
641653
654+ lazy val monocle = SbtCommunityProject (
655+ project = " Monocle" ,
656+ sbtTestCommand = " monocleJVM/test" ,
657+ dependencies = List (cats, munit, discipline, disciplineMunit)
658+ )
659+
642660 lazy val protoquill = SbtCommunityProject (
643661 project = " protoquill" ,
644662 sbtTestCommand = " test" ,
@@ -722,8 +740,10 @@ def allProjects = List(
722740 projects.izumiReflect,
723741 projects.perspective,
724742 projects.akka,
743+ projects.monocle,
725744 projects.protoquill,
726745 projects.onnxScala,
727746)
728747
729748lazy val projectMap = allProjects.groupBy(_.project)
749+
0 commit comments