From a6f75a75adb1ba44b7e44b6045666eb78429de5e Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Sat, 15 Jun 2013 23:55:05 -0400 Subject: [PATCH] Fully implement StaticScopes subclass of Initialize in order to support use in Task flatMap. Fixes #784. --- sbt/src/sbt-test/actions/all/build.sbt | 9 +++++++++ sbt/src/sbt-test/actions/all/test | 1 + util/collection/src/main/scala/sbt/Settings.scala | 10 +++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 sbt/src/sbt-test/actions/all/build.sbt create mode 100644 sbt/src/sbt-test/actions/all/test diff --git a/sbt/src/sbt-test/actions/all/build.sbt b/sbt/src/sbt-test/actions/all/build.sbt new file mode 100644 index 000000000..21a4f4a7f --- /dev/null +++ b/sbt/src/sbt-test/actions/all/build.sbt @@ -0,0 +1,9 @@ +val confFilter = settingKey[ScopeFilter.ConfigurationFilter]("ConfigurationFilter") + +confFilter := inConfigurations(Compile, Test) + +val updateReports = Def.taskDyn { updateClassifiers.all(ScopeFilter(configurations = confFilter.value)) } + +val newTask = taskKey[Unit]("") + +newTask := updateReports.value diff --git a/sbt/src/sbt-test/actions/all/test b/sbt/src/sbt-test/actions/all/test new file mode 100644 index 000000000..50d83095d --- /dev/null +++ b/sbt/src/sbt-test/actions/all/test @@ -0,0 +1 @@ +> newTask diff --git a/util/collection/src/main/scala/sbt/Settings.scala b/util/collection/src/main/scala/sbt/Settings.scala index 569a0275c..2b040f18b 100644 --- a/util/collection/src/main/scala/sbt/Settings.scala +++ b/util/collection/src/main/scala/sbt/Settings.scala @@ -504,7 +504,15 @@ trait Init[Scope] def mapConstant(g: MapConstant) = this def evaluate(map: Settings[Scope]): T = value() } - private[sbt] final val StaticScopes: Initialize[Set[Scope]] = new Value(() => error("internal sbt error: GetScopes not substituted")) + private[sbt] final object StaticScopes extends Initialize[Set[Scope]] + { + def dependencies = Nil + def mapReferenced(g: MapScoped) = this + def validateReferenced(g: ValidateRef) = Right(this) + def apply[S](g: Set[Scope] => S) = map(this)(g) + def mapConstant(g: MapConstant) = this + def evaluate(map: Settings[Scope]) = map.scopes + } private[sbt] final class Apply[K[L[x]], T](val f: K[Id] => T, val inputs: K[Initialize], val alist: AList[K]) extends Initialize[T] { def dependencies = deps(alist.toList(inputs))