From 2efacb8c46657e2bb6f3707808be55522ce34146 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Fri, 10 Feb 2017 18:10:49 +0000 Subject: [PATCH] Delete SettingQuery instances we don't need .. now that there's a copy in the git history --- .../sbt/internal/server/NetworkChannel.scala | 85 +------------------ 1 file changed, 1 insertion(+), 84 deletions(-) diff --git a/main/src/main/scala/sbt/internal/server/NetworkChannel.scala b/main/src/main/scala/sbt/internal/server/NetworkChannel.scala index 9cf2698ed..a564e5044 100644 --- a/main/src/main/scala/sbt/internal/server/NetworkChannel.scala +++ b/main/src/main/scala/sbt/internal/server/NetworkChannel.scala @@ -9,7 +9,7 @@ import java.net.{ Socket, SocketTimeoutException } import java.util.concurrent.atomic.AtomicBoolean import scala.util.{ Left, Right } import sbt.protocol._ -import sjsonnew._, LList.:*: +import sjsonnew._ final class NetworkChannel(val name: String, connection: Socket, state: State) extends CommandChannel { private val running = new AtomicBoolean(true) @@ -122,86 +122,3 @@ final class NetworkChannel(val name: String, connection: Socket, state: State) e out.close() } } - -trait SettingQueryInstances { - import BasicJsonProtocol._ - - type SettingQueryRepr = String :*: LNil - implicit def settingQueryIso: IsoLList.Aux[SettingQuery, SettingQueryRepr] = LList.iso( - (x => "settingKey" -> x.setting :*: LNil), - (x => SettingQuery(x.head)) - ) - - import sbt.internal.util._ - - type AttrKeyRepr[A] = String :*: Manifest[A] :*: Option[String] :*: Vector[AttributeKey[_]] :*: Boolean :*: Int :*: LNil - - // FIXME: Can't go this IsoLList way because AttributeKey depends on AttributeKey (extend) - implicit def attrKeyIso[A]: IsoLList.Aux[AttributeKey[A], AttrKeyRepr[A]] = ??? - // LList.iso[AttributeKey[A], AttrKeyRepr[A]](attrKeyToRepr, attrKeyFromRepr) - - // def attrKeyToRepr[A](x: AttributeKey[A]): AttrKeyRepr[A] = ( - // /* */ "label" -> x.label /* */ :*: - // /**/ "manifest" -> x.manifest /* */ :*: - // /* */ "desc" -> x.description /* */ :*: - // /* */ "extend" -> x.extend.toVector /**/ :*: - // /* */ "isLocal" -> x.isLocal /* */ :*: - // /* */ "rank" -> x.rank /* */ :*: - // LNil - // ) - - def attrKeyFromRepr[A](x: AttrKeyRepr[A]): AttributeKey[A] = { - val LCons("label", label, - LCons("manifest", manifest, - LCons("desc", desc, - LCons("extend", extend, - LCons("isLabel", isLocal, - LCons("rank", rank, LNil) - ))))) = x - if (isLocal) AttributeKey.local[A](manifest) - else desc match { - case Some(desc) => AttributeKey(label, desc, extend, rank)(manifest) - case None => extend match { - case Seq() => AttributeKey(label, rank)(manifest) - case _ => - // With the given API it's not possible to create an AttributeKey - // which extends other attribute keys without having a description - // But that's not enforced in the data types. So default description to "" - AttributeKey(label, "", extend, rank)(manifest) - } - } - } - - // TODO: or use AttributeKey label? (String) - // implicit def attrMapFormat: JsonFormat[AttributeMap] = project[AttributeMap, Map[AttributeKey[_], Any]]( - // attrMap => attrMap.entries.iterator.map(x => x.key -> x.value).toMap, - // map => AttributeMap(map.iterator.map { case (k: AttributeKey[kt], v) => AttributeEntry(k, v.asInstanceOf[kt]) }.toSeq) - // ) - - implicit def scopeAxisIso[A](implicit z: JsonFormat[A]): JsonFormat[ScopeAxis[A]] = - new JsonFormat[ScopeAxis[A]] { - def write[J](obj: ScopeAxis[A], builder: Builder[J]): Unit = obj match { - case This => builder writeString "This" - case Global => builder writeString "Global" - case Select(s) => z.write(s, builder) - } - def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): ScopeAxis[A] = jsOpt match { - case None => deserializationError("Expected some JSON but found None") - case Some("This") => This - case Some("Global") => Global - case Some(_) => Select(z.read(jsOpt, unbuilder)) - } - } - - type ScopeRepr = ScopeAxis[Reference] :*: ScopeAxis[ConfigKey] :*: ScopeAxis[AttributeKey[_]] :*: ScopeAxis[AttributeMap] :*: LNil - // implicit def scopeIso: IsoLList.Aux[Scope, ScopeRepr] = LList.iso[Scope, ScopeRepr]( - // { x: Scope => "project" -> x.project :*: "config" -> x.config :*: "task" -> x.task :*: "extra" -> x.extra :*: LNil }, - // { x: ScopeRepr => Scope(x.head, x.tail.head, x.tail.tail.head, x.tail.tail.tail.head) } - // ) - - type SettingKeyRepr[A] = Scope :*: AttributeKey[A] :*: LNil - // implicit def settingKeyIso[A]: IsoLList.Aux[SettingKey[A], SettingKeyRepr[A]] = LList.iso( - // { x: SettingKey[A] => "scope" -> x.scope :*: "attrKey" -> x.key :*: LNil }, - // { x: SettingKeyRepr[A] => Scoped.scopedSetting(x.head, x.tail.head) } - // ) -}