From bb75b74eb6f66d598c11416a1beeb40727dafff2 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Fri, 5 Aug 2011 13:16:49 +0530 Subject: [PATCH] Remove some deprecations and redundant code --- ivy/Credentials.scala | 2 +- main/Build.scala | 2 +- project/Proguard.scala | 2 +- project/Status.scala | 11 +---------- scripted/sbt/ScriptedTests.scala | 2 +- testing/impl/TestStatusReporter.scala | 2 +- 6 files changed, 6 insertions(+), 15 deletions(-) diff --git a/ivy/Credentials.scala b/ivy/Credentials.scala index a097596ed..4ca13d7a3 100644 --- a/ivy/Credentials.scala +++ b/ivy/Credentials.scala @@ -37,7 +37,7 @@ object Credentials if(path.exists) { val properties = read(path) - def get(keys: List[String]) = keys.flatMap(properties.get).firstOption.toRight(keys.head + " not specified in credentials file: " + 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 { diff --git a/main/Build.scala b/main/Build.scala index cf77e5512..f3aa99b37 100644 --- a/main/Build.scala +++ b/main/Build.scala @@ -126,7 +126,7 @@ object EvaluateConfigurations } loader => result.getValue(loader).asInstanceOf[Project.SettingsDefinition].settings } - private[this] def isSpace = (c: Char) => Character isSpace c + private[this] def isSpace = (c: Char) => Character isWhitespace c private[this] def fstS(f: String => Boolean): ((String,Int)) => Boolean = { case (s,i) => f(s) } private[this] def firstNonSpaceIs(lit: String) = (_: String).view.dropWhile(isSpace).startsWith(lit) private[this] def or[A](a: A => Boolean, b: A => Boolean): A => Boolean = in => a(in) || b(in) diff --git a/project/Proguard.scala b/project/Proguard.scala index 1ea30d08b..079c1a350 100644 --- a/project/Proguard.scala +++ b/project/Proguard.scala @@ -128,7 +128,7 @@ object LaunchProguard private def jlineFilter = "(!META-INF/**)" private def generalFilter = "(!META-INF/**,!*.properties)" - private def withJar[T](files: Seq[File], name: String) = mkpath(files.firstOption getOrElse error(name + " not present") ) + private def withJar[T](files: Seq[File], name: String) = mkpath(files.headOption getOrElse error(name + " not present") ) private def isJarX(x: String)(file: File) = { val name = file.getName diff --git a/project/Status.scala b/project/Status.scala index 5672b70df..48f8f1301 100644 --- a/project/Status.scala +++ b/project/Status.scala @@ -12,16 +12,7 @@ object Status commands += stampVersion ) def stampVersion = Command.command("stamp-version") { state => - append((version in ThisBuild ~= stamp) :: Nil, state) - } - // TODO: replace with extracted.append from 0.10.1 - def append(settings: Seq[Setting[_]], state: State): State = - { - val extracted = Project.extract(state) - import extracted._ - val append = Load.transformSettings(Load.projectScope(currentRef), currentRef.build, rootProject, settings) - val newStructure = Load.reapply(session.original ++ append, structure) - Project.setProject(session, newStructure, state) + Project.extract(state).append((version in ThisBuild ~= stamp) :: Nil, state) } def stamp(v: String): String = if(v endsWith Snapshot) diff --git a/scripted/sbt/ScriptedTests.scala b/scripted/sbt/ScriptedTests.scala index 7fd0e4200..63a9345ce 100644 --- a/scripted/sbt/ScriptedTests.scala +++ b/scripted/sbt/ScriptedTests.scala @@ -24,7 +24,7 @@ final class ScriptedTests(resourceBaseDirectory: File, bufferLog: Boolean, sbtVe import Path._ import GlobFilter._ var failed = false - for(groupDir <- (resourceBaseDirectory * group).getFiles; nme <- (groupDir * name).getFiles ) { + for(groupDir <- (resourceBaseDirectory * group).get; nme <- (groupDir * name).get ) { val g = groupDir.getName val n = nme.getName println("Running " + g + " / " + n) diff --git a/testing/impl/TestStatusReporter.scala b/testing/impl/TestStatusReporter.scala index 8debd2c90..0b83989a7 100644 --- a/testing/impl/TestStatusReporter.scala +++ b/testing/impl/TestStatusReporter.scala @@ -13,7 +13,7 @@ private[sbt] class TestStatusReporter(path: Path, log: Logger) extends TestsList private lazy val succeeded: Map[String, Long] = TestStatus.read(path, log) def doInit {} - def startGroup(name: String) { succeeded removeKey name } + def startGroup(name: String) { succeeded remove name } def testEvent(event: TestEvent) {} def endGroup(name: String, t: Throwable) {} def endGroup(name: String, result: Result.Value)