summaryrefslogtreecommitdiff
path: root/scalaplugin
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2017-11-15 14:03:38 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2017-11-15 14:03:38 -0800
commit28c099486199c8fbf1c1f5247278a0484e8a747b (patch)
tree9de10743b6cbecf32cffae78fa77ed5646e7ff8c /scalaplugin
parent51a433c8acff390a0109d92de222c9f8361b0bcf (diff)
downloadmill-28c099486199c8fbf1c1f5247278a0484e8a747b.tar.gz
mill-28c099486199c8fbf1c1f5247278a0484e8a747b.tar.bz2
mill-28c099486199c8fbf1c1f5247278a0484e8a747b.zip
Strip out `play-json` dependency in favor of `upickle`, which we are forced to use anyway due to Ammonite. Saves us from classloading play-json and Jackson, shaving off a few hundred ms from the cold no-op runtime
Diffstat (limited to 'scalaplugin')
-rw-r--r--scalaplugin/src/main/scala/mill/scalaplugin/Dep.scala24
1 files changed, 2 insertions, 22 deletions
diff --git a/scalaplugin/src/main/scala/mill/scalaplugin/Dep.scala b/scalaplugin/src/main/scala/mill/scalaplugin/Dep.scala
index 57c881c8..9ccb9da7 100644
--- a/scalaplugin/src/main/scala/mill/scalaplugin/Dep.scala
+++ b/scalaplugin/src/main/scala/mill/scalaplugin/Dep.scala
@@ -1,7 +1,6 @@
package mill.scalaplugin
-import play.api.libs.json._
-import mill.util.JsonFormatters._
+
sealed trait Dep
object Dep{
def apply(org: String, name: String, version: String): Dep = {
@@ -27,24 +26,5 @@ object Dep{
Point(coursier.Dependency(coursier.Module(org, name), version))
}
}
- implicit def formatter: Format[Dep] = new Format[Dep]{
- def writes(o: Dep) = o match{
- case Java(dep) => Json.obj("Java" -> Json.toJson(dep))
- case Scala(dep) => Json.obj("Scala" -> Json.toJson(dep))
- case Point(dep) => Json.obj("PointScala" -> Json.toJson(dep))
- }
-
- def reads(json: JsValue) = json match{
- case obj: JsObject =>
- obj.fields match{
- case Seq(("Java", dep)) => Json.fromJson[coursier.Dependency](dep).map(Java(_))
- case Seq(("Scala", dep)) => Json.fromJson[coursier.Dependency](dep).map(Scala(_))
- case Seq(("PointScala", dep)) => Json.fromJson[coursier.Dependency](dep).map(Point(_))
- case _ => JsError("Invalid JSON object to parse ScalaDep")
- }
-
-
- case _ => JsError("Expected JSON object to parse ScalaDep")
- }
- }
+ implicit def formatter = upickle.default.macroRW[Dep]
} \ No newline at end of file