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
@@ -655,6 +667,12 @@ object projects:
655
667
dependencies = List (scalatest, scalatestplusJunit, scalatestplusScalacheck)
656
668
)
657
669
670
+ lazy val monocle = SbtCommunityProject (
671
+ project = " Monocle" ,
672
+ sbtTestCommand = " monocleJVM/test" ,
673
+ dependencies = List (cats, munit, discipline, disciplineMunit)
674
+ )
675
+
658
676
end projects
659
677
660
678
def allProjects = List (
@@ -720,6 +738,7 @@ def allProjects = List(
720
738
projects.izumiReflect,
721
739
projects.perspective,
722
740
projects.akka,
741
+ projects.monocle,
723
742
)
724
743
725
744
lazy val projectMap = allProjects.groupBy(_.project)
0 commit comments