mirror of https://github.com/sbt/sbt.git
build sxr, api docs and use sbinary 0.4.0
This commit is contained in:
parent
c53c94c72a
commit
3cc8c52dea
|
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
package sbt
|
package sbt
|
||||||
|
|
||||||
import sbinary.{CollectionTypes, DefaultProtocol, Format, Input, JavaFormats, Output}
|
import sbinary.{CollectionTypes, DefaultProtocol, Format, Input, JavaFormats, Output => Out}
|
||||||
import java.io.{ByteArrayInputStream, ByteArrayOutputStream, File, InputStream, OutputStream}
|
import java.io.{ByteArrayInputStream, ByteArrayOutputStream, File, InputStream, OutputStream}
|
||||||
import java.net.{URI, URL}
|
import java.net.{URI, URL}
|
||||||
import Types.:+:
|
import Types.:+:
|
||||||
|
|
@ -45,7 +45,7 @@ object Cache extends CacheImplicits
|
||||||
println(label + ".read: " + v)
|
println(label + ".read: " + v)
|
||||||
v
|
v
|
||||||
}
|
}
|
||||||
def write(to: Output, v: Internal)
|
def write(to: Out, v: Internal)
|
||||||
{
|
{
|
||||||
println(label + ".write: " + v)
|
println(label + ".write: " + v)
|
||||||
c.write(to, v)
|
c.write(to, v)
|
||||||
|
|
@ -79,7 +79,7 @@ trait BasicCacheImplicits
|
||||||
val isDefined = BooleanFormat.reads(from)
|
val isDefined = BooleanFormat.reads(from)
|
||||||
if(isDefined) Some(t.read(from)) else None
|
if(isDefined) Some(t.read(from)) else None
|
||||||
}
|
}
|
||||||
def write(to: Output, j: Internal): Unit =
|
def write(to: Out, j: Internal): Unit =
|
||||||
{
|
{
|
||||||
BooleanFormat.writes(to, j.isDefined)
|
BooleanFormat.writes(to, j.isDefined)
|
||||||
j foreach { x => t.write(to, x) }
|
j foreach { x => t.write(to, x) }
|
||||||
|
|
@ -129,7 +129,7 @@ trait BasicCacheImplicits
|
||||||
if(left <= 0) acc.reverse else next(left - 1, t.read(from) :: acc)
|
if(left <= 0) acc.reverse else next(left - 1, t.read(from) :: acc)
|
||||||
next(size, Nil)
|
next(size, Nil)
|
||||||
}
|
}
|
||||||
def write(to: Output, vs: Internal)
|
def write(to: Out, vs: Internal)
|
||||||
{
|
{
|
||||||
val size = vs.length
|
val size = vs.length
|
||||||
IntFormat.writes(to, size)
|
IntFormat.writes(to, size)
|
||||||
|
|
@ -157,7 +157,7 @@ trait BasicCacheImplicits
|
||||||
type Internal = jCache.Internal
|
type Internal = jCache.Internal
|
||||||
def convert(i: I) = jCache.convert(f(i))
|
def convert(i: I) = jCache.convert(f(i))
|
||||||
def read(from: Input) = jCache.read(from)
|
def read(from: Input) = jCache.read(from)
|
||||||
def write(to: Output, j: Internal) = jCache.write(to, j)
|
def write(to: Out, j: Internal) = jCache.write(to, j)
|
||||||
def equiv = jCache.equiv
|
def equiv = jCache.equiv
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -180,7 +180,7 @@ trait HListCacheImplicits
|
||||||
val t = tail.read(from)
|
val t = tail.read(from)
|
||||||
(h, t)
|
(h, t)
|
||||||
}
|
}
|
||||||
def write(to: Output, j: Internal)
|
def write(to: Out, j: Internal)
|
||||||
{
|
{
|
||||||
head.write(to, j._1)
|
head.write(to, j._1)
|
||||||
tail.write(to, j._2)
|
tail.write(to, j._2)
|
||||||
|
|
@ -202,7 +202,7 @@ trait HListCacheImplicits
|
||||||
val t = tail.reads(from)
|
val t = tail.reads(from)
|
||||||
HCons(h, t)
|
HCons(h, t)
|
||||||
}
|
}
|
||||||
def writes(to: Output, hc: H :+: T)
|
def writes(to: Out, hc: H :+: T)
|
||||||
{
|
{
|
||||||
head.writes(to, hc.head)
|
head.writes(to, hc.head)
|
||||||
tail.writes(to, hc.tail)
|
tail.writes(to, hc.tail)
|
||||||
|
|
@ -225,7 +225,7 @@ trait UnionImplicits
|
||||||
val value = cache.read(in)
|
val value = cache.read(in)
|
||||||
new Found[cache.Internal](cache, clazz, value, index)
|
new Found[cache.Internal](cache, clazz, value, index)
|
||||||
}
|
}
|
||||||
def write(to: Output, i: Internal)
|
def write(to: Out, i: Internal)
|
||||||
{
|
{
|
||||||
def write0[I](f: Found[I])
|
def write0[I](f: Found[I])
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,8 @@
|
||||||
package sbt
|
package sbt
|
||||||
|
|
||||||
import Types.:+:
|
import Types.:+:
|
||||||
import sbinary.{DefaultProtocol, Format, Input, JavaIO, Output}
|
import sbinary.{DefaultProtocol, Format, Input, Output => Out}
|
||||||
import DefaultProtocol.ByteFormat
|
import DefaultProtocol.ByteFormat
|
||||||
import JavaIO._
|
|
||||||
import java.io.{File, InputStream, OutputStream}
|
import java.io.{File, InputStream, OutputStream}
|
||||||
|
|
||||||
trait InputCache[I]
|
trait InputCache[I]
|
||||||
|
|
@ -14,7 +13,7 @@ trait InputCache[I]
|
||||||
type Internal
|
type Internal
|
||||||
def convert(i: I): Internal
|
def convert(i: I): Internal
|
||||||
def read(from: Input): Internal
|
def read(from: Input): Internal
|
||||||
def write(to: Output, j: Internal): Unit
|
def write(to: Out, j: Internal): Unit
|
||||||
def equiv: Equiv[Internal]
|
def equiv: Equiv[Internal]
|
||||||
}
|
}
|
||||||
object InputCache
|
object InputCache
|
||||||
|
|
@ -25,7 +24,7 @@ object InputCache
|
||||||
type Internal = I
|
type Internal = I
|
||||||
def convert(i: I) = i
|
def convert(i: I) = i
|
||||||
def read(from: Input): I = fmt.reads(from)
|
def read(from: Input): I = fmt.reads(from)
|
||||||
def write(to: Output, i: I) = fmt.writes(to, i)
|
def write(to: Out, i: I) = fmt.writes(to, i)
|
||||||
def equiv = eqv
|
def equiv = eqv
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ package sbt
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import CacheIO.{fromFile, toFile}
|
import CacheIO.{fromFile, toFile}
|
||||||
import sbinary.{Format, JavaIO}
|
import sbinary.Format
|
||||||
import scala.reflect.Manifest
|
import scala.reflect.Manifest
|
||||||
import scala.collection.mutable
|
import scala.collection.mutable
|
||||||
import IO.{delete, read, write}
|
import IO.{delete, read, write}
|
||||||
|
|
@ -29,8 +29,6 @@ object Tracked
|
||||||
def diffOutputs(cache: File, style: FilesInfo.Style): Difference =
|
def diffOutputs(cache: File, style: FilesInfo.Style): Difference =
|
||||||
Difference.outputs(cache, style)
|
Difference.outputs(cache, style)
|
||||||
|
|
||||||
import sbinary.JavaIO._
|
|
||||||
|
|
||||||
def lastOutput[I,O](cacheFile: File)(f: (I,Option[O]) => O)(implicit o: Format[O], mf: Manifest[Format[O]]): I => O = in =>
|
def lastOutput[I,O](cacheFile: File)(f: (I,Option[O]) => O)(implicit o: Format[O], mf: Manifest[Format[O]]): I => O = in =>
|
||||||
{
|
{
|
||||||
val previous: Option[O] = fromFile[O](cacheFile)
|
val previous: Option[O] = fromFile[O](cacheFile)
|
||||||
|
|
@ -112,7 +110,7 @@ class Changed[O](val cacheFile: File)(implicit equiv: Equiv[O], format: Format[O
|
||||||
ifChanged(value)
|
ifChanged(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
import JavaIO._
|
|
||||||
def update(value: O): Unit = Using.fileOutputStream(false)(cacheFile)(stream => format.writes(stream, value))
|
def update(value: O): Unit = Using.fileOutputStream(false)(cacheFile)(stream => format.writes(stream, value))
|
||||||
def uptodate(value: O): Boolean =
|
def uptodate(value: O): Boolean =
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -54,16 +54,17 @@ object ConsoleLogger
|
||||||
* This logger is not thread-safe.*/
|
* This logger is not thread-safe.*/
|
||||||
class ConsoleLogger private[ConsoleLogger](val out: ConsoleOut, override val ansiCodesSupported: Boolean, val useColor: Boolean) extends BasicLogger
|
class ConsoleLogger private[ConsoleLogger](val out: ConsoleOut, override val ansiCodesSupported: Boolean, val useColor: Boolean) extends BasicLogger
|
||||||
{
|
{
|
||||||
def messageColor(level: Level.Value) = Console.RESET
|
import scala.Console.{BLUE, GREEN, RED, RESET, YELLOW}
|
||||||
|
def messageColor(level: Level.Value) = RESET
|
||||||
def labelColor(level: Level.Value) =
|
def labelColor(level: Level.Value) =
|
||||||
level match
|
level match
|
||||||
{
|
{
|
||||||
case Level.Error => Console.RED
|
case Level.Error => RED
|
||||||
case Level.Warn => Console.YELLOW
|
case Level.Warn => YELLOW
|
||||||
case _ => Console.RESET
|
case _ => RESET
|
||||||
}
|
}
|
||||||
def successLabelColor = Console.GREEN
|
def successLabelColor = GREEN
|
||||||
def successMessageColor = Console.RESET
|
def successMessageColor = RESET
|
||||||
override def success(message: => String)
|
override def success(message: => String)
|
||||||
{
|
{
|
||||||
if(successEnabled)
|
if(successEnabled)
|
||||||
|
|
@ -81,7 +82,7 @@ class ConsoleLogger private[ConsoleLogger](val out: ConsoleOut, override val ans
|
||||||
if(atLevel(level))
|
if(atLevel(level))
|
||||||
log(labelColor(level), level.toString, messageColor(level), message)
|
log(labelColor(level), level.toString, messageColor(level), message)
|
||||||
}
|
}
|
||||||
private def reset(): Unit = setColor(Console.RESET)
|
private def reset(): Unit = setColor(RESET)
|
||||||
|
|
||||||
private def setColor(color: String)
|
private def setColor(color: String)
|
||||||
{
|
{
|
||||||
|
|
@ -108,7 +109,7 @@ class ConsoleLogger private[ConsoleLogger](val out: ConsoleOut, override val ans
|
||||||
|
|
||||||
def logAll(events: Seq[LogEvent]) = out.lockObject.synchronized { events.foreach(log) }
|
def logAll(events: Seq[LogEvent]) = out.lockObject.synchronized { events.foreach(log) }
|
||||||
def control(event: ControlEvent.Value, message: => String)
|
def control(event: ControlEvent.Value, message: => String)
|
||||||
{ log(labelColor(Level.Info), Level.Info.toString, Console.BLUE, message) }
|
{ log(labelColor(Level.Info), Level.Info.toString, BLUE, message) }
|
||||||
}
|
}
|
||||||
sealed trait ConsoleOut
|
sealed trait ConsoleOut
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue