@@ -4,7 +4,7 @@ import Build._
44import Keys ._
55import Project .Initialize
66import scala .collection .{ mutable , immutable }
7-
7+ import scala . collection . parallel . CompositeThrowable
88
99
1010
@@ -22,7 +22,7 @@ object ShaResolve {
2222 pullBinaryLibs in ThisBuild <<= (baseDirectory, binaryLibCache, streams) map resolveLibs
2323 )
2424
25- def resolveLibs (dir : File , cacheDir : File , s : TaskStreams ): Unit = {
25+ def resolveLibs (dir : File , cacheDir : File , s : TaskStreams ): Unit = loggingParallelExceptions(s) {
2626 val files = (dir / " test" / " files" ** " *.desired.sha1" ) +++ (dir / " lib" ** " *.desired.sha1" )
2727 for {
2828 (file, name) <- (files x relativeTo(dir)).par
@@ -33,6 +33,13 @@ object ShaResolve {
3333 } pullFile(jar, sha + " /" + uri, cacheDir, s)
3434 }
3535
36+ @ inline final def loggingParallelExceptions [U ](s : TaskStreams )(f : => U ): U = try f catch {
37+ case t : CompositeThrowable =>
38+ s.log.error(" Error during parallel execution, GET READ FOR STACK TRACES!!" )
39+ t.throwables foreach (t2 => s.log.trace(t2))
40+ throw t
41+ }
42+
3643 def getShaFromShafile (file : File ): String = (IO read file split " \\ s" headOption) getOrElse error(" No SHA found for " + file)
3744
3845
0 commit comments