mirror of https://github.com/sbt/sbt.git
fix input tasks not being keyed & not showing up in failed task list
This commit is contained in:
parent
e965785646
commit
15f490c625
|
|
@ -337,11 +337,14 @@ object Load
|
|||
else key
|
||||
}
|
||||
def setDefining[T] = (key: ScopedKey[T], value: T) => value match {
|
||||
case tk: Task[t] if !EvaluateTask.isDummy(tk) => Task(tk.info.set(EvaluateTask.taskDefinitionKey, key), tk.work).asInstanceOf[T]
|
||||
case tk: Task[t] => setDefinitionKey(tk, key).asInstanceOf[T]
|
||||
case ik: InputTask[t] => ik.mapTask( tk => setDefinitionKey(tk, key) ).asInstanceOf[T]
|
||||
case _ => value
|
||||
}
|
||||
ss.map(s => s mapReferenced mapSpecial(s.key) mapInit setDefining )
|
||||
}
|
||||
def setDefinitionKey[T](tk: Task[T], key: ScopedKey[_]): Task[T] =
|
||||
if(EvaluateTask isDummy tk) tk else Task(tk.info.set(EvaluateTask.taskDefinitionKey, key), tk.work)
|
||||
|
||||
def structureIndex(settings: Settings[Scope]): StructureIndex =
|
||||
new StructureIndex(Index.stringToKeyMap(settings), Index.taskToKeyMap(settings), KeyIndex(settings.allKeys( (s,k) => ScopedKey(s,k))))
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ object Defaults
|
|||
crossPaths :== true,
|
||||
generatedResources :== Nil,
|
||||
classpathTypes := Set("jar", "bundle"),
|
||||
// shellPrompt :== (_ => "> "),
|
||||
aggregate :== Aggregation.Enabled,
|
||||
maxErrors :== 100,
|
||||
showTiming :== true,
|
||||
|
|
@ -138,7 +137,7 @@ object Defaults
|
|||
definedSbtPlugins <<= discoverPlugins,
|
||||
inTask(run)(runnerSetting :: Nil).head,
|
||||
selectMainClass <<= discoveredMainClasses map selectRunMain,
|
||||
mainClass in run :== selectMainClass,
|
||||
mainClass in run :== selectMainClass in run,
|
||||
mainClass <<= discoveredMainClasses map selectPackageMain,
|
||||
run <<= runTask(fullClasspath, mainClass in run, runner in run),
|
||||
runMain <<= runMainTask(fullClasspath, runner in run),
|
||||
|
|
|
|||
|
|
@ -13,13 +13,22 @@ package sbt
|
|||
import java.io.File
|
||||
import java.net.URI
|
||||
|
||||
sealed trait InputTask[T]
|
||||
private final class InputStatic[T](val parser: State => Parser[Task[T]]) extends InputTask[T]
|
||||
sealed trait InputTask[T] {
|
||||
def mapTask[S](f: Task[T] => Task[S]): InputTask[S]
|
||||
}
|
||||
private final class InputStatic[T](val parser: State => Parser[Task[T]]) extends InputTask[T] {
|
||||
def mapTask[S](f: Task[T] => Task[S]) = new InputStatic(s => parser(s) map f)
|
||||
}
|
||||
private sealed trait InputDynamic[T] extends InputTask[T]
|
||||
{
|
||||
{ outer =>
|
||||
type Result
|
||||
def parser: State => Parser[Result]
|
||||
def task: Task[T]
|
||||
def mapTask[S](f: Task[T] => Task[S]) = new InputDynamic[S] {
|
||||
type Result = outer.Result
|
||||
def parser = outer.parser
|
||||
def task = f(outer.task)
|
||||
}
|
||||
}
|
||||
object InputTask
|
||||
{
|
||||
|
|
@ -127,7 +136,7 @@ object Scoped
|
|||
protected final val scoped = ScopedKey(scope, key)
|
||||
|
||||
final def :==(value: S): Setting[S] = :=(value)
|
||||
final def :==(value: SettingKey[S]): Setting[S] = <<=(value(identity))
|
||||
final def :==(value: ScopedSetting[S]): Setting[S] = <<=(value(identity))
|
||||
final def := (value: => S): Setting[S] = setting(scoped, Project.value(value))
|
||||
final def ~= (f: S => S): Setting[S] = Project.update(scoped)(f)
|
||||
final def <<= (app: Initialize[S]): Setting[S] = setting(scoped, app)
|
||||
|
|
@ -148,8 +157,8 @@ object Scoped
|
|||
def :==(value: S): ScS = :=(value)
|
||||
def ::=(value: Task[S]): ScS = Project.setting(scoped, Project.value( value ))
|
||||
def := (value: => S): ScS = ::=(task(value))
|
||||
def :== (v: TaskKey[S]): ScS = Project.setting(scoped, Project.app(ScopedKey(scope, v.key) :^: KNil)(_.head) )
|
||||
def :== (v: SettingKey[S]): ScS = <<=( v(const))
|
||||
def :== (v: ScopedTask[S]): ScS = Project.setting(scoped, Project.app(ScopedKey(v.scope, v.key) :^: KNil)(_.head) )
|
||||
def :== (v: ScopedSetting[S]): ScS = <<=( v(const))
|
||||
def ~= (f: S => S): ScS = Project.update(scoped)( _ map f )
|
||||
|
||||
def <<= (app: App[S]): ScS = Project.setting(scoped, app)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import Types._
|
|||
import Task._
|
||||
import Execute._
|
||||
|
||||
object System
|
||||
object Transform
|
||||
{
|
||||
def fromDummy[T](original: Task[T])(action: => T): Task[T] = Task(original.info, Pure(action _))
|
||||
def fromDummyStrict[T](original: Task[T], value: T): Task[T] = fromDummy(original)( value)
|
||||
|
|
@ -34,19 +34,13 @@ object System
|
|||
new (Task ~> Task) {
|
||||
def apply[T](in: Task[T]): Task[T] = map(in).getOrElse(in)
|
||||
}
|
||||
}
|
||||
object Transform
|
||||
{
|
||||
final class Dummies[HL <: HList](val direct: KList[Task, HL])
|
||||
|
||||
def apply[HL <: HList, Key](dummies: KList[Task, HL], injected: HL) =
|
||||
{
|
||||
import System._
|
||||
Convert.taskToNode ∙ getOrId(dummyMap(dummies)(injected))
|
||||
taskToNode ∙ getOrId(dummyMap(dummies)(injected))
|
||||
}
|
||||
}
|
||||
object Convert
|
||||
{
|
||||
|
||||
def taskToNode = new (Task ~> NodeT[Task]#Apply) {
|
||||
def apply[T](t: Task[T]): Node[Task, T] = t.work match {
|
||||
case Pure(eval) => toNode(KNil)( _ => Right(eval()) )
|
||||
|
|
|
|||
Loading…
Reference in New Issue