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
@@ -19,14 +20,25 @@ lazy val sbtPluginFilePath: String =
19
20
communitybuildDir.resolve(" sbt-dotty-sbt" ).toAbsolutePath().toString()
20
21
21
22
def log (msg : String ) = println(Console .GREEN + msg + Console .RESET )
23
+ def error (msg : String ) = println(Console .RED + msg + Console .RESET )
22
24
23
25
/** Executes shell command, returns false in case of error. */
24
26
def exec (projectDir : Path , binary : String , arguments : String * ): Int =
25
27
val command = binary +: arguments
26
28
log(command.mkString(" " ))
27
29
val builder = new ProcessBuilder (command : _* ).directory(projectDir.toFile).inheritIO()
30
+
28
31
val process = builder.start()
29
32
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
+ }
30
42
exitCode
31
43
32
44
@@ -639,6 +651,12 @@ object projects:
639
651
dependencies = List (scalatest, scalatestplusJunit, scalatestplusScalacheck)
640
652
)
641
653
654
+ lazy val monocle = SbtCommunityProject (
655
+ project = " Monocle" ,
656
+ sbtTestCommand = " monocleJVM/test" ,
657
+ dependencies = List (cats, munit, discipline, disciplineMunit)
658
+ )
659
+
642
660
lazy val protoquill = SbtCommunityProject (
643
661
project = " protoquill" ,
644
662
sbtTestCommand = " test" ,
@@ -722,8 +740,10 @@ def allProjects = List(
722
740
projects.izumiReflect,
723
741
projects.perspective,
724
742
projects.akka,
743
+ projects.monocle,
725
744
projects.protoquill,
726
745
projects.onnxScala,
727
746
)
728
747
729
748
lazy val projectMap = allProjects.groupBy(_.project)
749
+
0 commit comments