diff options
Diffstat (limited to 'project/ShaResolve.scala')
-rw-r--r-- | project/ShaResolve.scala | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/project/ShaResolve.scala b/project/ShaResolve.scala index c6034bbf01..5cc99fd9cf 100644 --- a/project/ShaResolve.scala +++ b/project/ShaResolve.scala @@ -4,7 +4,7 @@ import Build._ import Keys._ import Project.Initialize import scala.collection.{ mutable, immutable } - +import scala.collection.parallel.CompositeThrowable @@ -22,17 +22,24 @@ object ShaResolve { pullBinaryLibs in ThisBuild <<= (baseDirectory, binaryLibCache, streams) map resolveLibs ) - def resolveLibs(dir: File, cacheDir: File, s: TaskStreams): Unit = { + def resolveLibs(dir: File, cacheDir: File, s: TaskStreams): Unit = loggingParallelExceptions(s) { val files = (dir / "test" / "files" ** "*.desired.sha1") +++ (dir / "lib" ** "*.desired.sha1") for { (file, name) <- (files x relativeTo(dir)).par - uri = name.dropRight(13) + uri = name.dropRight(13).replace('\\', '/') jar = dir / uri if !jar.exists || !isValidSha(file) sha = getShaFromShafile(file) } pullFile(jar, sha + "/" + uri, cacheDir, s) } + @inline final def loggingParallelExceptions[U](s: TaskStreams)(f: => U): U = try f catch { + case t: CompositeThrowable => + s.log.error("Error during parallel execution, GET READ FOR STACK TRACES!!") + t.throwables foreach (t2 => s.log.trace(t2)) + throw t + } + def getShaFromShafile(file: File): String = (IO read file split "\\s" headOption) getOrElse error("No SHA found for " + file) |