From f8d67d68374922a8660357e095651e05db501b6c Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Wed, 21 Jun 2017 14:41:23 +0100 Subject: [PATCH] Move HListFormats to collection to drop cache->collection dep Looks like the reason that util-cache depended on util-collection was to define the sjson-new formats (HListFormats) for util-collection's HList. Given that util-collection already depends on sjsonnew, HListFormats can also be defined in util-collection. All that was left then was (a) HListFormatSpec requires sjsonnewScalaJson, so that was added in test scope, and (b) HListFormats had to be dropped from sbt.util.CacheImplicits - HListFormats will have to be imported and/or mixed-in where required downstream. For importing convenience I defined a companion object. --- build.sbt | 4 ++-- .../src/main/scala/sbt/internal/util/HListFormats.scala | 2 ++ .../src/test/scala/HListFormatSpec.scala | 9 +++++---- util-cache/src/main/scala/sbt/util/CacheImplicits.scala | 2 -- 4 files changed, 9 insertions(+), 8 deletions(-) rename {util-cache => internal/util-collection}/src/main/scala/sbt/internal/util/HListFormats.scala (98%) rename {util-cache => internal/util-collection}/src/test/scala/HListFormatSpec.scala (86%) diff --git a/build.sbt b/build.sbt index 5f53fdb2c..6ba8ecec3 100644 --- a/build.sbt +++ b/build.sbt @@ -83,7 +83,7 @@ lazy val utilCollection = (project in internalPath / "util-collection"). crossScalaVersions := Seq(scala210, scala211, scala212), Util.keywordsSettings, name := "Util Collection", - libraryDependencies ++= Seq(sjsonnew.value) + libraryDependencies ++= Seq(sjsonnew.value, sjsonnewScalaJson.value % Test) ) lazy val utilApplyMacro = (project in internalPath / "util-appmacro"). @@ -140,7 +140,7 @@ lazy val utilLogic = (project in internalPath / "util-logic"). // Persisted caching based on sjson-new lazy val utilCache = (project in file("util-cache")). - dependsOn(utilCollection, utilTesting % Test). + dependsOn(utilTesting % Test). settings( commonSettings, name := "Util Cache", diff --git a/util-cache/src/main/scala/sbt/internal/util/HListFormats.scala b/internal/util-collection/src/main/scala/sbt/internal/util/HListFormats.scala similarity index 98% rename from util-cache/src/main/scala/sbt/internal/util/HListFormats.scala rename to internal/util-collection/src/main/scala/sbt/internal/util/HListFormats.scala index bf69b4db8..6abae921c 100644 --- a/util-cache/src/main/scala/sbt/internal/util/HListFormats.scala +++ b/internal/util-collection/src/main/scala/sbt/internal/util/HListFormats.scala @@ -66,3 +66,5 @@ trait HListFormats { def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]) = hnil } } + +object HListFormats extends HListFormats diff --git a/util-cache/src/test/scala/HListFormatSpec.scala b/internal/util-collection/src/test/scala/HListFormatSpec.scala similarity index 86% rename from util-cache/src/test/scala/HListFormatSpec.scala rename to internal/util-collection/src/test/scala/HListFormatSpec.scala index a0922d02f..8f6e9a73b 100644 --- a/util-cache/src/test/scala/HListFormatSpec.scala +++ b/internal/util-collection/src/test/scala/HListFormatSpec.scala @@ -1,9 +1,10 @@ -package sbt.util +package sbt +package internal +package util import scalajson.ast.unsafe._ -import sjsonnew._, support.scalajson.unsafe._ -import CacheImplicits._ -import sbt.internal.util.{ UnitSpec, HNil } +import sjsonnew._, BasicJsonProtocol._, support.scalajson.unsafe._ +import HListFormats._ class HListFormatSpec extends UnitSpec { val quux = 23 :+: "quux" :+: true :+: HNil diff --git a/util-cache/src/main/scala/sbt/util/CacheImplicits.scala b/util-cache/src/main/scala/sbt/util/CacheImplicits.scala index 2eb1639cd..74cd51f68 100644 --- a/util-cache/src/main/scala/sbt/util/CacheImplicits.scala +++ b/util-cache/src/main/scala/sbt/util/CacheImplicits.scala @@ -1,9 +1,7 @@ package sbt.util import sjsonnew.BasicJsonProtocol -import sbt.internal.util.HListFormats object CacheImplicits extends CacheImplicits trait CacheImplicits extends BasicCacheImplicits with BasicJsonProtocol - with HListFormats