mirror of https://github.com/sbt/sbt.git
API: base types with applied type parameters
Compile task: fix detection of classpath changes Aggressive compiler seems to work on scalaz now
This commit is contained in:
parent
dc7b7d5363
commit
058e28e9b1
|
|
@ -16,6 +16,22 @@ trait Tracked extends NotNull
|
|||
/** Clears the cache. If also cleaning, 'clean' should be called first as it might require information from the cache.*/
|
||||
def clear: Task[Unit]
|
||||
}
|
||||
class Timestamp(val cacheFile: File) extends Tracked
|
||||
{
|
||||
val clean = Clean(cacheFile)
|
||||
def clear = Task.empty
|
||||
def apply[T](f: Long => Task[T]): Task[T] =
|
||||
{
|
||||
val getTimestamp = Task { readTimestamp }
|
||||
getTimestamp bind f map { result =>
|
||||
FileUtilities.write(cacheFile, System.currentTimeMillis.toString)
|
||||
result
|
||||
}
|
||||
}
|
||||
def readTimestamp: Long =
|
||||
try { FileUtilities.read(cacheFile).toLong }
|
||||
catch { case _: NumberFormatException | _: java.io.FileNotFoundException => 0 }
|
||||
}
|
||||
object Clean
|
||||
{
|
||||
def apply(src: Task[Set[File]]): Task[Unit] = src map FileUtilities.delete
|
||||
|
|
|
|||
Loading…
Reference in New Issue