mirror of https://github.com/sbt/sbt.git
Cleanup stdTaskProj
This commit is contained in:
parent
824df04699
commit
168d3aa267
|
|
@ -71,9 +71,9 @@ final case class Info[T](attributes: AttributeMap = AttributeMap.empty, post: T
|
|||
def description = attributes.get(Description)
|
||||
def setName(n: String) = set(Name, n)
|
||||
def setDescription(d: String) = set(Description, d)
|
||||
def set[T](key: AttributeKey[T], value: T) = copy(attributes = this.attributes.put(key, value))
|
||||
def get[T](key: AttributeKey[T]) = attributes.get(key)
|
||||
def postTransform[A](f: (T, AttributeMap) => AttributeMap) = copy(post = (t: T) => f(t, post(t)))
|
||||
def set[A](key: AttributeKey[A], value: A) = copy(attributes = this.attributes.put(key, value))
|
||||
def get[A](key: AttributeKey[A]) = attributes.get(key)
|
||||
def postTransform(f: (T, AttributeMap) => AttributeMap) = copy(post = (t: T) => f(t, post(t)))
|
||||
|
||||
override def toString = if (attributes.isEmpty) "_" else attributes.toString
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,8 +65,8 @@ sealed trait TaskStreams[Key] {
|
|||
private[this] def getID(s: Option[String]) = s getOrElse default
|
||||
}
|
||||
sealed trait ManagedStreams[Key] extends TaskStreams[Key] {
|
||||
def open()
|
||||
def close()
|
||||
def open(): Unit
|
||||
def close(): Unit
|
||||
def isClosed: Boolean
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ trait TaskExtra {
|
|||
def mapFailure[T](f: Incomplete => T): Task[T] = mapR(f compose failM)
|
||||
|
||||
def andFinally(fin: => Unit): Task[S] = mapR(x => Result.tryValue[S]({ fin; x }))
|
||||
def doFinally(t: Task[Unit]): Task[S] = flatMapR(x => t.mapR { tx => Result.tryValues[S](tx :: Nil, x) })
|
||||
def doFinally(t: Task[Unit]): Task[S] = flatMapR(x => t.result.map { tx => Result.tryValues[S](tx :: Nil, x) })
|
||||
def ||[T >: S](alt: Task[T]): Task[T] = flatMapR { case Value(v) => task(v); case Inc(i) => alt }
|
||||
def &&[T](alt: Task[T]): Task[T] = flatMap(_ => alt)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,5 +34,5 @@ object TaskRunnerCircularTest extends Properties("TaskRunner Circular") {
|
|||
try { tryRun(top, true, workers); false }
|
||||
catch { case i: Incomplete => cyclic(i) }
|
||||
}
|
||||
def cyclic(i: Incomplete) = Incomplete.allExceptions(i).exists(_.isInstanceOf[Execute[Task]#CyclicException[_]])
|
||||
def cyclic(i: Incomplete) = Incomplete.allExceptions(i).exists(_.isInstanceOf[Execute[({ type A[_] <: AnyRef})#A]#CyclicException[_]])
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@ import java.util.concurrent.{ CountDownLatch, TimeUnit }
|
|||
|
||||
object TaskSerial extends Properties("task serial") {
|
||||
val checkCycles = true
|
||||
val Timeout = 100 // in milliseconds
|
||||
val Timeout = 100L // in milliseconds
|
||||
|
||||
def eval[T](t: Task[T]): T = tryRun(t, checkCycles, limitTotal(MaxWorkers))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue