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,6 +20,7 @@ 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 : Seq [String ], environment : Map [String , String ]): Int =
@@ -27,8 +29,18 @@ def exec(projectDir: Path, binary: String, arguments: Seq[String], environment:
27
29
log(command.mkString(" " ))
28
30
val builder = new ProcessBuilder (command : _* ).directory(projectDir.toFile).inheritIO()
29
31
builder.environment.putAll(environment.asJava)
32
+
30
33
val process = builder.start()
31
34
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
+ }
32
44
exitCode
33
45
34
46
@@ -656,6 +668,12 @@ object projects:
656
668
dependencies = List (scalatest, scalatestplusJunit, scalatestplusScalacheck)
657
669
)
658
670
671
+ lazy val monocle = SbtCommunityProject (
672
+ project = " Monocle" ,
673
+ sbtTestCommand = " monocleJVM/test" ,
674
+ dependencies = List (cats, munit, discipline, disciplineMunit)
675
+ )
676
+
659
677
lazy val protoquill = SbtCommunityProject (
660
678
project = " protoquill" ,
661
679
sbtTestCommand = " test" ,
@@ -746,10 +764,12 @@ def allProjects = List(
746
764
projects.izumiReflect,
747
765
projects.perspective,
748
766
projects.akka,
767
+ projects.monocle,
749
768
projects.protoquill,
750
769
projects.onnxScala,
751
770
projects.playJson,
752
771
projects.scalatestplusTestNG,
753
772
)
754
773
755
774
lazy val projectMap = allProjects.groupBy(_.project)
775
+
0 commit comments