mirror of https://github.com/sbt/sbt.git
taking care of deprecations removed in Scala master
This commit is contained in:
parent
7099ac31fd
commit
1c1e5c4977
|
|
@ -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"))
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ final class Section(val name: String) extends Line
|
|||
object Comment extends Line
|
||||
|
||||
class ParseException(val content: String, val line: Int, val col: Int, val msg: String)
|
||||
extends BootException( "[" + (line+1) + ", " + (col+1) + "]" + msg + "\n" + content + "\n" + List.make(col," ").mkString + "^" )
|
||||
extends BootException( "[" + (line+1) + ", " + (col+1) + "]" + msg + "\n" + content + "\n" + List.fill(col)(" ").mkString + "^" )
|
||||
|
||||
object ParseLine
|
||||
{
|
||||
|
|
|
|||
|
|
@ -364,7 +364,7 @@ object BuiltinCommands
|
|||
{
|
||||
val addBase = token(Space ~> "add") ~> token(Space ~> basicUri, "<build URI>").+
|
||||
val removeBase = token(Space ~> "remove") ~> token(Space ~> Uri(Project.extraBuilds(s).toSet) ).+
|
||||
addBase.map(toAdd => (xs: List[URI]) => (toAdd.toList ::: xs).removeDuplicates) |
|
||||
addBase.map(toAdd => (xs: List[URI]) => (toAdd.toList ::: xs).distinct) |
|
||||
removeBase.map(toRemove => (xs: List[URI]) => xs.filterNot(toRemove.toSet))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ object Package
|
|||
def mergeManifests(manifest: Manifest, mergeManifest: Manifest)
|
||||
{
|
||||
mergeAttributes(manifest.getMainAttributes, mergeManifest.getMainAttributes)
|
||||
val entryMap = asScalaMap(manifest.getEntries)
|
||||
val entryMap = mapAsScalaMap(manifest.getEntries)
|
||||
for((key, value) <- mergeManifest.getEntries)
|
||||
{
|
||||
entryMap.get(key) match
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ object Execute
|
|||
trait Part1of2K[M[_[_], _], A[_]] { type Apply[T] = M[A, T] }
|
||||
type NodeT[A[_]] = Part1of2K[Node, A]
|
||||
|
||||
def idMap[A,B]: Map[A, B] = JavaConversions.asScalaMap(new java.util.IdentityHashMap[A,B])
|
||||
def idMap[A,B]: Map[A, B] = JavaConversions.mapAsScalaMap(new java.util.IdentityHashMap[A,B])
|
||||
def pMap[A[_], B[_]]: PMap[A,B] = new DelegatingPMap[A, B](idMap)
|
||||
private[sbt] def completed(p: => Unit): Completed = new Completed {
|
||||
def process() { p }
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ object IDSet
|
|||
def += (t: T) = backing.put(t, Dummy)
|
||||
def ++=(t: Iterable[T]) = t foreach +=
|
||||
def -= (t:T) = if(backing.remove(t) eq null) false else true
|
||||
def all = collection.JavaConversions.asScalaIterable(backing.keySet)
|
||||
def all = collection.JavaConversions.collectionAsScalaIterable(backing.keySet)
|
||||
def isEmpty = backing.isEmpty
|
||||
def process[S](t: T)(ifSeen: S)(ifNew: => S) = if(contains(t)) ifSeen else { this += t ; ifNew }
|
||||
override def toString = backing.toString
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ package sbt
|
|||
|
||||
object Util
|
||||
{
|
||||
def makeList[T](size: Int, value: T): List[T] = List.fill(size)(value)
|
||||
|
||||
def separateE[A,B](ps: Seq[Either[A,B]]): (Seq[A], Seq[B]) =
|
||||
separate(ps)(Types.idFun)
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ object JLineCompletion
|
|||
if(line.charAt(line.length - 1) != '\n')
|
||||
reader.printNewline()
|
||||
}
|
||||
reader.printColumns(JavaConversions.asJavaList(columns.map(_.trim)))
|
||||
reader.printColumns(JavaConversions.seqAsJavaList(columns.map(_.trim)))
|
||||
}
|
||||
def hasNewline(s: String): Boolean = s.indexOf('\n') >= 0
|
||||
def shouldPrint(cs: Seq[String], reader: ConsoleReader): Boolean =
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ package sbt.complete
|
|||
|
||||
import Parser._
|
||||
import sbt.Types.{const, left, right, some}
|
||||
import sbt.Util.separate
|
||||
import sbt.Util.{makeList,separate}
|
||||
|
||||
sealed trait Parser[+T]
|
||||
{
|
||||
|
|
@ -676,7 +676,7 @@ private final class Repeat[T](partial: Option[Parser[T]], repeated: Parser[T], m
|
|||
else
|
||||
// forced determinism
|
||||
for(value <- repeated.resultEmpty) yield
|
||||
List.make(min, value)
|
||||
makeList(min, value)
|
||||
}
|
||||
override def toString = "repeat(" + min + "," + max +"," + partial + "," + repeated + ")"
|
||||
}
|
||||
Loading…
Reference in New Issue