mirror of https://github.com/sbt/sbt.git
minor updates for p2
This commit is contained in:
parent
62691e6681
commit
0c59e9d5a6
|
|
@ -97,7 +97,7 @@ trait TaskSetup
|
|||
final case class Input(line: String, cursor: Option[Int])
|
||||
{
|
||||
lazy val (name, arguments) = line match { case Input.NameRegex(n, a) => (n, a); case _ => (line, "") }
|
||||
lazy val splitSpace = (arguments split """\s+""").toSeq
|
||||
lazy val splitArgs = (arguments split """\s+""").toSeq
|
||||
}
|
||||
object Input
|
||||
{
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ object Commands
|
|||
}
|
||||
|
||||
def read = Command.simple(ReadCommand, ReadBrief, ReadDetailed) { (in, s) =>
|
||||
val from = in.splitSpace map { p => new File(s.baseDir, p) }
|
||||
val from = in.splitArgs map { p => new File(s.baseDir, p) }
|
||||
val notFound = notReadable(from)
|
||||
if(notFound.isEmpty)
|
||||
readLines(from) ::: s // this means that all commands from all files are loaded, parsed, and inserted before any are executed
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ import scala.collection.{mutable, JavaConversions}
|
|||
|
||||
import java.io.File
|
||||
|
||||
trait SingleProject extends Tasked
|
||||
trait SingleProject extends Tasked with PrintTask with TaskExtra with Types
|
||||
{
|
||||
def base: File
|
||||
def base = new File(".")
|
||||
def streamBase = base / "streams"
|
||||
|
||||
implicit def streams = Dummy.Streams
|
||||
|
|
@ -44,6 +44,22 @@ object Dummy
|
|||
val Streams = dummy[TaskStreams](StreamsName)
|
||||
}
|
||||
|
||||
trait PrintTask
|
||||
{
|
||||
def input: Task[Input]
|
||||
lazy val show = input flatMap { in =>
|
||||
val m = ReflectUtilities.allVals[Task[_]](this)
|
||||
val taskStrings = in.splitArgs map { name =>
|
||||
m(name).merge.map {
|
||||
case Seq() => "No result for " + name
|
||||
case Seq( (conf, v) ) => name + ": " + v.toString
|
||||
case confs => confs map { case (conf, v) => conf + ": " + v } mkString(name + ":\n\t", "\n\t", "\n")
|
||||
}
|
||||
}
|
||||
taskStrings.join.map { _ foreach println }
|
||||
}
|
||||
}
|
||||
|
||||
object ReflectiveContext
|
||||
{
|
||||
import Transform.Context
|
||||
|
|
|
|||
|
|
@ -7,10 +7,19 @@ package sbt
|
|||
|
||||
/** Result of completely evaluating a task.*/
|
||||
sealed trait Result[+T]
|
||||
{
|
||||
def toEither: Either[Incomplete, T]
|
||||
}
|
||||
/** Indicates the task did not complete normally and so it does not have a value.*/
|
||||
final case class Inc(cause: Incomplete) extends Result[Nothing]
|
||||
{
|
||||
def toEither: Either[Incomplete, Nothing] = Left(cause)
|
||||
}
|
||||
/** Indicates the task completed normally and produced the given `value`.*/
|
||||
final case class Value[+T](value: T) extends Result[T]
|
||||
{
|
||||
def toEither: Either[Incomplete, T] = Right(value)
|
||||
}
|
||||
|
||||
object Result
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,13 +3,16 @@
|
|||
*/
|
||||
package sbt
|
||||
|
||||
object Types extends TypeFunctions
|
||||
object Types extends Types
|
||||
{
|
||||
val :^: = KCons
|
||||
val :+: = HCons
|
||||
type :+:[H, T <: HList] = HCons[H,T]
|
||||
|
||||
implicit def hconsToK[M[_], H, T <: HList](h: M[H] :+: T)(implicit mt: T => KList[M, T]): KList[M, H :+: T] =
|
||||
KCons[H, T, M](h.head, mt(h.tail) )
|
||||
implicit def hnilToK(hnil: HNil): KNil = KNil
|
||||
}
|
||||
|
||||
trait Types extends TypeFunctions
|
||||
{
|
||||
val :^: = KCons
|
||||
val :+: = HCons
|
||||
type :+:[H, T <: HList] = HCons[H,T]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue