mirror of https://github.com/sbt/sbt.git
Adapt to recent changes to sbt-datatype
This commit is contained in:
parent
c395bd14a8
commit
465774b13c
|
|
@ -117,7 +117,7 @@ lazy val utilCache = (project in internalPath / "util-cache").
|
|||
settings(
|
||||
commonSettings,
|
||||
name := "Util Cache",
|
||||
libraryDependencies ++= Seq(datatypeCodecs, sbtSerialization, scalaReflect.value, sbtIO) ++ scalaXml.value,
|
||||
libraryDependencies ++= Seq(sjsonnew, scalaReflect.value, sbtIO) ++ scalaXml.value,
|
||||
libraryDependencies += sjsonnewScalaJson % Test
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,27 +1,30 @@
|
|||
package sbt.internal.util
|
||||
|
||||
import sbt.datatype.{ ArrayFormat, ByteFormat, StringFormat }
|
||||
import sbt.internal.util.Types.:+:
|
||||
|
||||
import sjsonnew.{ Builder, deserializationError, JsonFormat, Unbuilder }
|
||||
import sjsonnew.BasicJsonProtocol.{ wrap, asSingleton }
|
||||
import sjsonnew.BasicJsonProtocol, BasicJsonProtocol.asSingleton
|
||||
|
||||
import java.io.{ ByteArrayInputStream, ByteArrayOutputStream, File, InputStream, OutputStream }
|
||||
|
||||
import java.net.{ URI, URL }
|
||||
|
||||
trait URIFormat { self: StringFormat =>
|
||||
trait URIFormat { self: BasicJsonProtocol =>
|
||||
implicit def URIFormat: JsonFormat[URI] = wrap(_.toString, new URI(_: String))
|
||||
}
|
||||
|
||||
trait URLFormat { self: StringFormat =>
|
||||
trait URLFormat { self: BasicJsonProtocol =>
|
||||
implicit def URLFormat: JsonFormat[URL] = wrap(_.toString, new URL(_: String))
|
||||
}
|
||||
|
||||
trait FileFormat { self: StringFormat =>
|
||||
trait FileFormat { self: BasicJsonProtocol =>
|
||||
implicit def FileFormat: JsonFormat[File] = wrap(_.toString, new File(_: String))
|
||||
}
|
||||
|
||||
trait SetFormat { self: BasicJsonProtocol =>
|
||||
implicit def SetFormat[T: JsonFormat]: JsonFormat[Set[T]] = wrap(_.toSeq, (_: Seq[T]).toSet)
|
||||
}
|
||||
|
||||
trait HListFormat {
|
||||
implicit def HConsFormat[H: JsonFormat, T <: HList: JsonFormat]: JsonFormat[H :+: T] =
|
||||
new JsonFormat[H :+: T] {
|
||||
|
|
@ -51,7 +54,7 @@ trait HListFormat {
|
|||
|
||||
}
|
||||
|
||||
trait StreamFormat { self: ArrayFormat with ByteFormat =>
|
||||
trait StreamFormat { self: BasicJsonProtocol =>
|
||||
def streamFormat[T](write: (T, OutputStream) => Unit, read: InputStream => T): JsonFormat[T] = {
|
||||
lazy val byteArrayFormat = implicitly[JsonFormat[Array[Byte]]]
|
||||
val toBytes = (t: T) => { val bos = new ByteArrayOutputStream(); write(t, bos); bos.toByteArray }
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
package sbt.internal.util
|
||||
|
||||
import sbt.datatype.{ ArrayFormat, BooleanFormat, ByteFormat, IntFormat }
|
||||
|
||||
import java.net.{ URI, URL }
|
||||
|
||||
import sjsonnew.JsonFormat
|
||||
import sjsonnew.BasicJsonProtocol.asSingleton
|
||||
import sjsonnew.{ BasicJsonProtocol, JsonFormat }
|
||||
|
||||
trait BasicCacheImplicits { self: ArrayFormat with BooleanFormat with ByteFormat with IntFormat =>
|
||||
trait BasicCacheImplicits { self: BasicJsonProtocol =>
|
||||
|
||||
implicit def basicCache[I: JsonFormat: Equiv, O: JsonFormat]: Cache[I, O] =
|
||||
new BasicCache[I, O]()
|
||||
|
|
|
|||
|
|
@ -1,19 +1,11 @@
|
|||
package sbt.internal.util
|
||||
|
||||
import sbt.datatype.{ ArrayFormat, BooleanFormat, ByteFormat, IntFormat, LongFormat, StringFormat }
|
||||
import sjsonnew.{ CollectionFormats, TupleFormats }
|
||||
import sjsonnew.BasicJsonProtocol
|
||||
|
||||
object CacheImplicits extends BasicCacheImplicits
|
||||
with ArrayFormat
|
||||
with BooleanFormat
|
||||
with ByteFormat
|
||||
with BasicJsonProtocol
|
||||
with FileFormat
|
||||
with IntFormat
|
||||
with HListFormat
|
||||
with LongFormat
|
||||
with StringFormat
|
||||
with URIFormat
|
||||
with URLFormat
|
||||
with StreamFormat
|
||||
with TupleFormats
|
||||
with CollectionFormats
|
||||
|
|
@ -2,11 +2,9 @@ package sbt.internal.util
|
|||
|
||||
import scala.reflect.Manifest
|
||||
|
||||
import sbt.datatype.IntFormat
|
||||
import sjsonnew.{ BasicJsonProtocol, Builder, deserializationError, JsonFormat, Unbuilder }
|
||||
|
||||
import sjsonnew.{ Builder, deserializationError, JsonFormat, Unbuilder }
|
||||
|
||||
object StampedFormat extends IntFormat {
|
||||
object StampedFormat extends BasicJsonProtocol {
|
||||
|
||||
def apply[T](format: JsonFormat[T])(implicit mf: Manifest[JsonFormat[T]]): JsonFormat[T] = {
|
||||
withStamp(stamp(format))(format)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import sbt.io.syntax._
|
|||
|
||||
import CacheImplicits._
|
||||
|
||||
import sjsonnew.{ Builder, deserializationError, IsoString, JsonFormat, Unbuilder }
|
||||
import sjsonnew.IsoString
|
||||
import sjsonnew.support.scalajson.unsafe.{ CompactPrinter, Converter, FixedParser }
|
||||
|
||||
import scala.json.ast.unsafe.JValue
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import sjsonnew.JsonFormat
|
|||
|
||||
object Tracked {
|
||||
|
||||
import CacheImplicits.LongFormat
|
||||
import CacheImplicits.LongJsonFormat
|
||||
|
||||
/**
|
||||
* Creates a tracker that provides the last time it was evaluated.
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import sbt.io.syntax._
|
|||
|
||||
import CacheImplicits._
|
||||
|
||||
import sjsonnew.{ Builder, deserializationError, IsoString, JsonFormat, Unbuilder }
|
||||
import sjsonnew.IsoString
|
||||
import sjsonnew.support.scalajson.unsafe.{ CompactPrinter, Converter, FixedParser }
|
||||
|
||||
import scala.json.ast.unsafe.JValue
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ object Dependencies {
|
|||
|
||||
lazy val sbtIO = "org.scala-sbt" %% "io" % "1.0.0-M6"
|
||||
lazy val jline = "jline" % "jline" % "2.13"
|
||||
lazy val sbtSerialization = "org.scala-sbt" %% "serialization" % "0.1.2"
|
||||
|
||||
lazy val scalaCompiler = Def.setting { "org.scala-lang" % "scala-compiler" % scalaVersion.value }
|
||||
lazy val scalaReflect = Def.setting { "org.scala-lang" % "scala-reflect" % scalaVersion.value }
|
||||
|
|
@ -27,6 +26,7 @@ object Dependencies {
|
|||
|
||||
lazy val parserCombinator211 = "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.4"
|
||||
|
||||
lazy val datatypeCodecs = "org.scala-sbt" %% "datatype-codecs" % "1.0.0-SNAPSHOT"
|
||||
lazy val sjsonnewScalaJson = "com.eed3si9n" %% "sjson-new-scalajson" % "0.4.0"
|
||||
lazy val sjsonnewVersion = "0.4.0"
|
||||
lazy val sjsonnew = "com.eed3si9n" %% "sjson-new-core" % sjsonnewVersion
|
||||
lazy val sjsonnewScalaJson = "com.eed3si9n" %% "sjson-new-scalajson" % sjsonnewVersion
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue