From ffde1c7145ceab9966b3594718a2586f99101405 Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Mon, 15 Aug 2016 16:49:20 +0200 Subject: [PATCH] Try to fix Windows build --- .../src/main/scala-2.10/coursier/Tasks.scala | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/plugin/src/main/scala-2.10/coursier/Tasks.scala b/plugin/src/main/scala-2.10/coursier/Tasks.scala index f5052524d..eb7765d18 100644 --- a/plugin/src/main/scala-2.10/coursier/Tasks.scala +++ b/plugin/src/main/scala-2.10/coursier/Tasks.scala @@ -19,6 +19,7 @@ import sbt.Keys._ import scala.collection.mutable import scala.collection.JavaConverters._ +import scala.collection.mutable.ArrayBuffer import scala.util.Try import scalaz.{ \/-, -\/ } @@ -259,8 +260,22 @@ object Tasks { private def createLogger() = new TermDisplay(new OutputStreamWriter(System.err)) private lazy val globalPluginPattern = { + + val props = sys.props.toMap + + val extraProps = new ArrayBuffer[(String, String)] + + def addUriProp(key: String): Unit = + for (b <- props.get(key)) { + val uri = new File(b).toURI.toString + extraProps += s"$key.uri" -> uri + } + + addUriProp("sbt.global.base") + addUriProp("user.home") + // FIXME get the 0.13 automatically? - val s = s"file:$${sbt.global.base-$${user.home}/.sbt/0.13}/plugins/target/resolution-cache/" + + val s = s"$${sbt.global.base.uri-$${user.home.uri}/.sbt/0.13}/plugins/target/resolution-cache/" + "[organization]/[module](/scala_[scalaVersion])(/sbt_[sbtVersion])/[revision]/resolved.xml.[ext]" val p = PropertiesPattern.parse(s) match { @@ -270,7 +285,7 @@ object Tasks { p } - p.substituteProperties(sys.props.toMap) match { + p.substituteProperties(props ++ extraProps) match { case -\/(err) => throw new Exception(err) case \/-(p) =>