taking care of deprecations removed in Scala master

This commit is contained in:
Mark Harrah 2012-11-14 09:04:29 -05:00
parent f95c45f76e
commit c6a3b352c4
4 changed files with 11 additions and 3 deletions

View File

@ -33,13 +33,14 @@ object Credentials
case Right(dc) => dc
}
}
def loadCredentials(path: File): Either[String, DirectCredentials] =
if(path.exists)
{
val properties = read(path)
def get(keys: List[String]) = keys.flatMap(properties.get).headOption.toRight(keys.head + " not specified in credentials file: " + path)
List.separate( List(RealmKeys, HostKeys, UserKeys, PasswordKeys).map(get) ) match
IvyUtil.separate( List(RealmKeys, HostKeys, UserKeys, PasswordKeys).map(get) ) match
{
case (Nil, List(realm, host, user, pass)) => Right( new DirectCredentials(realm, host, user, pass) )
case (errors, _) => Left(errors.mkString("\n"))

View File

@ -382,7 +382,7 @@ private object IvySbt
private[sbt] def javaMap(m: Map[String,String], unqualify: Boolean = false) =
{
val map = if(unqualify) m map { case (k, v) => (k.stripPrefix("e:"), v) } else m
if(map.isEmpty) null else scala.collection.JavaConversions.asJavaMap(map)
if(map.isEmpty) null else scala.collection.JavaConversions.mapAsJavaMap(map)
}
private object javaMap

7
ivy/IvyUtil.scala Normal file
View File

@ -0,0 +1,7 @@
package sbt
private[sbt] object IvyUtil
{
def separate[A,B](l: Seq[Either[A,B]]): (Seq[A], Seq[B]) =
(l.flatMap(_.left.toOption), l.flatMap(_.right.toOption))
}

View File

@ -237,7 +237,7 @@ class MakePom(val log: Logger)
def exclusions(dependency: DependencyDescriptor): NodeSeq =
{
val excl = dependency.getExcludeRules(dependency.getModuleConfigurations)
val (warns, excls) = List.separate(excl.map(makeExclusion))
val (warns, excls) = IvyUtil.separate(excl.map(makeExclusion))
if(!warns.isEmpty) log.warn(warns.mkString(IO.Newline))
if(!excls.isEmpty) <exclusions>{excls}</exclusions>
else NodeSeq.Empty