Skip to content
This repository
Browse code

API documentation

  • Loading branch information...
commit 96d51da6514ae339239fa12e16abecdfcce90c59 1 parent 47a19dc
Mark Harrah authored
8 tasks/Incomplete.scala
@@ -4,6 +4,14 @@
4 4 package sbt
5 5
6 6 import Incomplete.{Error, Value => IValue}
  7 +
  8 +/** Describes why a task did not complete.
  9 +*
  10 +* @param node the task that did not complete that is described by this Incomplete instance
  11 +* @param tpe whether the task was incomplete because of an error or because it was skipped. Only Error is actually used and Skipped may be removed in the future.
  12 +* @param message an optional error message describing this incompletion
  13 +* @param causes a list of incompletions that prevented `node` from completing
  14 +* @param directCause the exception that caused `node` to not complete */
7 15 final case class Incomplete(node: Option[AnyRef], tpe: IValue = Error, message: Option[String] = None, causes: Seq[Incomplete] = Nil, directCause: Option[Throwable] = None)
8 16 extends Exception(message.orNull, directCause.orNull) {
9 17 override def toString = "Incomplete(node=" + node + ", tpe=" + tpe + ", msg=" + message + ", causes=" + causes + ", directCause=" + directCause +")"
6 tasks/Node.scala
@@ -5,6 +5,11 @@ package sbt
5 5
6 6 import Types._
7 7
  8 +/** Represents a task node in a format understood by the task evaluation engine Execute.
  9 +* Heterogenous inputs (Mixed, tuple) and homogoneous (Uniform, sequence) and defined and consumed separately.
  10 +*
  11 +* @tparam A the task type
  12 +* @tparam T the type computed by this node */
8 13 trait Node[A[_], T]
9 14 {
10 15 type Mixed <: HList
@@ -13,5 +18,6 @@ trait Node[A[_], T]
13 18 val mixedIn: KList[A, Mixed]
14 19 val uniformIn: Seq[A[Uniform]]
15 20
  21 + /** Computes the result of this task given the results from the inputs. */
16 22 def work(mixed: KList[Result, Mixed], uniform: Seq[Result[Uniform]]): Either[A[T], T]
17 23 }
11 tasks/standard/Action.scala
@@ -9,11 +9,18 @@ package sbt
9 9 // Action, Task, and Info are intentionally invariant in their type parameter.
10 10 // Various natural transformations used, such as PMap, require invariant type constructors for correctness
11 11
  12 +/** Defines a task compuation*/
12 13 sealed trait Action[T]
  14 +/** A direct computation of a value. */
13 15 final case class Pure[T](f: () => T) extends Action[T]
  16 +/** Applies a function to the result of evaluating a heterogeneous list of other tasks.*/
14 17 final case class Mapped[T, In <: HList](in: Tasks[In], f: Results[In] => T) extends Action[T]
  18 +/** Computes another task to evaluate based on results from evaluating other tasks.*/
15 19 final case class FlatMapped[T, In <: HList](in: Tasks[In], f: Results[In] => Task[T]) extends Action[T]
  20 +/** A computation `in` that requires other tasks `deps` to be evaluated first.*/
16 21 final case class DependsOn[T](in: Task[T], deps: Seq[Task[_]]) extends Action[T]
  22 +/** A computation that operates on the results of a homogeneous list of other tasks.
  23 +* It can either return another task to be evaluated or the final value.*/
17 24 final case class Join[T, U](in: Seq[Task[U]], f: Seq[Result[U]] => Either[Task[T], T]) extends Action[T]
18 25
19 26 object Task
@@ -22,11 +29,15 @@ object Task
22 29 type Results[HL <: HList] = KList[Result, HL]
23 30 }
24 31
  32 +/** Combines metadata `info` and a computation `work` to define a task. */
25 33 final case class Task[T](info: Info[T], work: Action[T])
26 34 {
27 35 override def toString = info.name getOrElse ("Task(" + info + ")")
28 36 override def hashCode = info.hashCode
29 37 }
  38 +/** Used to provide information about a task, such as the name, description, and tags for controlling concurrent execution.
  39 +* @param attributes Arbitrary user-defined key/value pairs describing this task
  40 +* @param post a transformation that takes the result of evaluating this task and produces user-defined key/value pairs. */
30 41 final case class Info[T](attributes: AttributeMap = AttributeMap.empty, post: T => AttributeMap = const(AttributeMap.empty))
31 42 {
32 43 import Info._

0 comments on commit 96d51da

Please sign in to comment.
Something went wrong with that request. Please try again.