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.
This commit is contained in:
Dale Wijnand 2017-06-21 14:41:23 +01:00
parent e1c0e5c045
commit f8d67d6837
No known key found for this signature in database
GPG Key ID: 4F256E3D151DF5EF
4 changed files with 9 additions and 8 deletions

View File

@ -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",

View File

@ -66,3 +66,5 @@ trait HListFormats {
def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]) = hnil
}
}
object HListFormats extends HListFormats

View File

@ -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

View File

@ -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