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
|
||||
|
||||
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.net.{URI, URL}
|
||||
import Types.:+:
|
||||
|
|
@ -45,7 +45,7 @@ object Cache extends CacheImplicits
|
|||
println(label + ".read: " + v)
|
||||
v
|
||||
}
|
||||
def write(to: Output, v: Internal)
|
||||
def write(to: Out, v: Internal)
|
||||
{
|
||||
println(label + ".write: " + v)
|
||||
c.write(to, v)
|
||||
|
|
@ -79,7 +79,7 @@ trait BasicCacheImplicits
|
|||
val isDefined = BooleanFormat.reads(from)
|
||||
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)
|
||||
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)
|
||||
next(size, Nil)
|
||||
}
|
||||
def write(to: Output, vs: Internal)
|
||||
def write(to: Out, vs: Internal)
|
||||
{
|
||||
val size = vs.length
|
||||
IntFormat.writes(to, size)
|
||||
|
|
@ -157,7 +157,7 @@ trait BasicCacheImplicits
|
|||
type Internal = jCache.Internal
|
||||
def convert(i: I) = jCache.convert(f(i))
|
||||
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
|
||||
}
|
||||
|
||||
|
|
@ -180,7 +180,7 @@ trait HListCacheImplicits
|
|||
val t = tail.read(from)
|
||||
(h, t)
|
||||
}
|
||||
def write(to: Output, j: Internal)
|
||||
def write(to: Out, j: Internal)
|
||||
{
|
||||
head.write(to, j._1)
|
||||
tail.write(to, j._2)
|
||||
|
|
@ -202,7 +202,7 @@ trait HListCacheImplicits
|
|||
val t = tail.reads(from)
|
||||
HCons(h, t)
|
||||
}
|
||||
def writes(to: Output, hc: H :+: T)
|
||||
def writes(to: Out, hc: H :+: T)
|
||||
{
|
||||
head.writes(to, hc.head)
|
||||
tail.writes(to, hc.tail)
|
||||
|
|
@ -225,7 +225,7 @@ trait UnionImplicits
|
|||
val value = cache.read(in)
|
||||
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])
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,9 +4,8 @@
|
|||
package sbt
|
||||
|
||||
import Types.:+:
|
||||
import sbinary.{DefaultProtocol, Format, Input, JavaIO, Output}
|
||||
import sbinary.{DefaultProtocol, Format, Input, Output => Out}
|
||||
import DefaultProtocol.ByteFormat
|
||||
import JavaIO._
|
||||
import java.io.{File, InputStream, OutputStream}
|
||||
|
||||
trait InputCache[I]
|
||||
|
|
@ -14,7 +13,7 @@ trait InputCache[I]
|
|||
type Internal
|
||||
def convert(i: I): Internal
|
||||
def read(from: Input): Internal
|
||||
def write(to: Output, j: Internal): Unit
|
||||
def write(to: Out, j: Internal): Unit
|
||||
def equiv: Equiv[Internal]
|
||||
}
|
||||
object InputCache
|
||||
|
|
@ -25,7 +24,7 @@ object InputCache
|
|||
type Internal = I
|
||||
def convert(i: I) = i
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ package sbt
|
|||
|
||||
import java.io.File
|
||||
import CacheIO.{fromFile, toFile}
|
||||
import sbinary.{Format, JavaIO}
|
||||
import sbinary.Format
|
||||
import scala.reflect.Manifest
|
||||
import scala.collection.mutable
|
||||
import IO.{delete, read, write}
|
||||
|
|
@ -29,8 +29,6 @@ object Tracked
|
|||
def diffOutputs(cache: File, style: FilesInfo.Style): Difference =
|
||||
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 =>
|
||||
{
|
||||
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)
|
||||
}
|
||||
}
|
||||
import JavaIO._
|
||||
|
||||
def update(value: O): Unit = Using.fileOutputStream(false)(cacheFile)(stream => format.writes(stream, value))
|
||||
def uptodate(value: O): Boolean =
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -54,16 +54,17 @@ object ConsoleLogger
|
|||
* This logger is not thread-safe.*/
|
||||
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) =
|
||||
level match
|
||||
{
|
||||
case Level.Error => Console.RED
|
||||
case Level.Warn => Console.YELLOW
|
||||
case _ => Console.RESET
|
||||
case Level.Error => RED
|
||||
case Level.Warn => YELLOW
|
||||
case _ => RESET
|
||||
}
|
||||
def successLabelColor = Console.GREEN
|
||||
def successMessageColor = Console.RESET
|
||||
def successLabelColor = GREEN
|
||||
def successMessageColor = RESET
|
||||
override def success(message: => String)
|
||||
{
|
||||
if(successEnabled)
|
||||
|
|
@ -81,7 +82,7 @@ class ConsoleLogger private[ConsoleLogger](val out: ConsoleOut, override val ans
|
|||
if(atLevel(level))
|
||||
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)
|
||||
{
|
||||
|
|
@ -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 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
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue