diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2017-12-16 21:50:39 -0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2017-12-16 21:50:39 -0800 |
commit | 01a85f6aa485cb7c4626886ee588209fd7b23a52 (patch) | |
tree | e825498d2a21da8e4b386be6b545e8d19ad7644a /core/src/main/scala | |
parent | 5f441a4f990f2b9a4e9fa0ed47824ccbae1728f4 (diff) | |
download | mill-01a85f6aa485cb7c4626886ee588209fd7b23a52.tar.gz mill-01a85f6aa485cb7c4626886ee588209fd7b23a52.tar.bz2 mill-01a85f6aa485cb7c4626886ee588209fd7b23a52.zip |
upgrade to new version of uPickle/Ammonite
Diffstat (limited to 'core/src/main/scala')
-rw-r--r-- | core/src/main/scala/mill/discover/Mirror.scala | 5 | ||||
-rw-r--r-- | core/src/main/scala/mill/eval/PathRef.scala | 6 | ||||
-rw-r--r-- | core/src/main/scala/mill/util/JsonFormatters.scala | 25 |
3 files changed, 17 insertions, 19 deletions
diff --git a/core/src/main/scala/mill/discover/Mirror.scala b/core/src/main/scala/mill/discover/Mirror.scala index 6293e599..41b3a0fe 100644 --- a/core/src/main/scala/mill/discover/Mirror.scala +++ b/core/src/main/scala/mill/discover/Mirror.scala @@ -76,7 +76,10 @@ object Mirror{ } def makeTargetPoint[T, V](label: String, func: T => Target[V]) - (implicit f: upickle.default.ReadWriter[V]) = { + (implicit f1: upickle.default.Reader[V], + f2: upickle.default.Writer[V]) = { + + val f = upickle.default.ReadWriter(f2.write, f1.read) TargetPoint(label, f, func) } } diff --git a/core/src/main/scala/mill/eval/PathRef.scala b/core/src/main/scala/mill/eval/PathRef.scala index 433e9f5c..784d9ad4 100644 --- a/core/src/main/scala/mill/eval/PathRef.scala +++ b/core/src/main/scala/mill/eval/PathRef.scala @@ -5,7 +5,7 @@ import java.nio.file.attribute.BasicFileAttributes import java.nio.file.{FileVisitResult, FileVisitor} import java.nio.{file => jnio} import java.security.MessageDigest - +import upickle.default.{ReadWriter => RW} import ammonite.ops.Path import mill.util.JsonFormatters @@ -63,6 +63,6 @@ case class PathRef(path: ammonite.ops.Path, quick: Boolean = false){ } object PathRef{ - private implicit val pathFormat: upickle.default.ReadWriter[Path] = JsonFormatters.pathReadWrite - implicit def jsonFormatter: upickle.default.ReadWriter[PathRef] = upickle.default.macroRW + private implicit val pathFormat: RW[Path] = JsonFormatters.pathReadWrite + implicit def jsonFormatter: RW[PathRef] = upickle.default.macroRW } diff --git a/core/src/main/scala/mill/util/JsonFormatters.scala b/core/src/main/scala/mill/util/JsonFormatters.scala index bce23468..d8125ff2 100644 --- a/core/src/main/scala/mill/util/JsonFormatters.scala +++ b/core/src/main/scala/mill/util/JsonFormatters.scala @@ -1,28 +1,23 @@ package mill.util import ammonite.ops.{Bytes, Path} - +import upickle.default.{ReadWriter => RW} object JsonFormatters extends JsonFormatters trait JsonFormatters { - implicit def readWriter[T: upickle.default.Reader: upickle.default.Writer] = - upickle.default.ReadWriter( - implicitly[upickle.default.Writer[T]].write, - implicitly[upickle.default.Reader[T]].read, - ) - implicit val pathReadWrite = upickle.default.ReadWriter[ammonite.ops.Path]( + implicit val pathReadWrite: RW[ammonite.ops.Path] = RW[ammonite.ops.Path]( o => upickle.Js.Str(o.toString()), - {case upickle.Js.Str(json) => Path(json)}, + {case upickle.Js.Str(json) => Path(json.toString)}, ) - implicit val bytesReadWrite = upickle.default.ReadWriter[Bytes]( + implicit val bytesReadWrite: RW[Bytes] = RW[Bytes]( o => upickle.Js.Str(javax.xml.bind.DatatypeConverter.printBase64Binary(o.array)), - {case upickle.Js.Str(json) => new Bytes(javax.xml.bind.DatatypeConverter.parseBase64Binary(json))} + {case upickle.Js.Str(json) => new Bytes(javax.xml.bind.DatatypeConverter.parseBase64Binary(json.toString))} ) - implicit lazy val crFormat: upickle.default.ReadWriter[ammonite.ops.CommandResult] = - upickle.default.macroRW - implicit lazy val modFormat: upickle.default.ReadWriter[coursier.Module] = upickle.default.macroRW - implicit lazy val depFormat: upickle.default.ReadWriter[coursier.Dependency]= upickle.default.macroRW - implicit lazy val attrFormat: upickle.default.ReadWriter[coursier.Attributes] = upickle.default.macroRW + implicit lazy val crFormat: RW[ammonite.ops.CommandResult] = upickle.default.macroRW + + implicit lazy val modFormat: RW[coursier.Module] = upickle.default.macroRW + implicit lazy val depFormat: RW[coursier.Dependency]= upickle.default.macroRW + implicit lazy val attrFormat: RW[coursier.Attributes] = upickle.default.macroRW } |