Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reintroduce circe shaded fork, now on maven central #289

Merged
merged 1 commit into from
Apr 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.scalablytyped.converter
package internal
package importer

import io.circe.{Decoder, Encoder}
import io.circe013.{Decoder, Encoder}
import org.scalablytyped.converter.internal.scalajs.{flavours, Name, Versions}
import org.scalablytyped.converter.internal.ts.TsIdentLibrary

Expand Down Expand Up @@ -42,7 +42,7 @@ case class ConversionOptions(
}

object ConversionOptions {
import io.circe.generic.auto._
import io.circe013.generic.auto._
import jsonCodecs._

implicit val encodes: Encoder[ConversionOptions] = exportEncoder[ConversionOptions].instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package org.scalablytyped.converter.internal
package importer

import org.scalablytyped.converter.internal.ts.TsIdentLibrary
import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder}
import io.circe.{Decoder, Encoder}
import io.circe.syntax._
import io.circe013.generic.semiauto.{deriveDecoder, deriveEncoder}
import io.circe013.{Decoder, Encoder}
import io.circe013.syntax._

object ScalaJsBundlerDepFile {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package org.scalablytyped.converter.internal
package importer.documentation

import com.olvind.logging.Logger
import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder}
import io.circe.{Decoder, Encoder}
import io.circe013.generic.semiauto.{deriveDecoder, deriveEncoder}
import io.circe013.{Decoder, Encoder}
import org.scalablytyped.converter.internal.importer.Source

import scala.concurrent.Future
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.scalablytyped.converter.internal
package importer

import io.circe._
import io.circe013._
import org.scalablytyped.converter.internal.ts._

import java.io.File
Expand Down Expand Up @@ -34,7 +34,7 @@ object jsonCodecs {
implicit val TsIdentLibraryKeyDec: KeyDecoder[TsIdentLibrary] = KeyDecoder[String].map(TsIdentLibrary.apply)
implicit val TsIdentLibraryKeyEnc: KeyEncoder[TsIdentLibrary] = KeyEncoder[String].contramap[TsIdentLibrary](_.value)

import io.circe.generic.semiauto._
import io.circe013.generic.semiauto._

implicit val CompilerOptionsEncoder: Encoder[CompilerOptions] = deriveEncoder[CompilerOptions]
implicit val CompilerOptionsDecoder: Decoder[CompilerOptions] = deriveDecoder[CompilerOptions]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package org.scalablytyped.converter.internal
package importer

import org.scalablytyped.converter.internal.ts.TsIdentLibrary
import io.circe.Decoder.Result
import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder}
import io.circe.{Decoder, Encoder, HCursor}
import io.circe013.Decoder.Result
import io.circe013.generic.semiauto.{deriveDecoder, deriveEncoder}
import io.circe013.{Decoder, Encoder, HCursor}

case class Summary(
successes: Set[TsIdentLibrary],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.scalablytyped.converter.internal.importer

import io.circe.parser._
import org.scalablytyped.converter.internal.IArray
import org.scalablytyped.converter.internal.{IArray, Json}
import org.scalablytyped.converter.internal.importer.jsonCodecs._
import org.scalablytyped.converter.internal.ts._
import org.scalatest.funsuite.AnyFunSuite
Expand Down Expand Up @@ -56,7 +55,7 @@ class JsonTests extends AnyFunSuite {
),
),
)
assert(decode[TsConfig](content) === Right(expected))
assert(Json[TsConfig](content) === Right(expected))
}

test("notNeededPackages.json") {
Expand All @@ -83,7 +82,7 @@ class JsonTests extends AnyFunSuite {
),
)

assert(decode[NotNeededPackages](content) === Right(expected))
assert(Json[NotNeededPackages](content) === Right(expected))
}

test("typings.json") {
Expand All @@ -102,7 +101,7 @@ class JsonTests extends AnyFunSuite {
true,
)

assert(decode[TypingsJson](content) === Right(expected))
assert(Json[TypingsJson](content) === Right(expected))
}

test("summary.json") {
Expand All @@ -129,6 +128,6 @@ class JsonTests extends AnyFunSuite {
Set(),
)

assert(decode[Summary](content) === Right(expected))
assert(Json[Summary](content) === Right(expected))
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.scalablytyped.converter.internal.importer

import io.circe.parser._
import io.circe.syntax._
import io.circe013.syntax._
import org.scalablytyped.converter.internal.Json
import org.scalablytyped.converter.internal.importer.ScalaJsBundlerDepFile.NpmDependencies
import org.scalatest.funsuite.AnyFunSuite

Expand All @@ -19,10 +19,10 @@ class ScalaJsBundlerDepTest extends AnyFunSuite {
val expected = NpmDependencies(deps, deps, Nil, Nil)

test("parses existing") {
assert(decode[ScalaJsBundlerDepFile.NpmDependencies](content) === Right(expected))
assert(Json[ScalaJsBundlerDepFile.NpmDependencies](content) === Right(expected))
}

test("roundtrips") {
assert(decode[ScalaJsBundlerDepFile.NpmDependencies](expected.asJson.spaces4) === Right(expected))
assert(Json[ScalaJsBundlerDepFile.NpmDependencies](expected.asJson.spaces4) === Right(expected))
}
}
9 changes: 4 additions & 5 deletions project/Deps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ object Deps {
val awssdkS3 = "software.amazon.awssdk" % "s3" % "2.15.28"
val java8Compat = "org.scala-lang.modules" %% "scala-java8-compat" % "0.9.1"

val circe: List[ModuleID] = {
List(
"io.circe" %% s"circe-generic" % "0.11.2",
"io.circe" %% s"circe-jackson29" % "0.11.2",
val circe: Seq[ModuleID] =
Seq(
"org.scalablytyped.circe013" %% "circe-generic" % "0.13.0-shaded-2",
"org.scalablytyped.circe013" %% "circe-jackson29" % "0.13.0-shaded-2"
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package internal
import java.nio.file.Path

import com.olvind.logging.Logger
import io.circe.{Decoder, Encoder}
import io.circe013.{Decoder, Encoder}
import org.scalablytyped.converter.internal.importer._
import org.scalablytyped.converter.internal.importer.build.{Compiler, IvyLayout, PublishedSbtProject}
import org.scalablytyped.converter.internal.importer.documentation.Npmjs
Expand All @@ -29,7 +29,7 @@ object ImportTypings {
}

object Input {
import io.circe.generic.auto._
import io.circe013.generic.auto._
import jsonCodecs._

implicit val InputEncoder: Encoder[Input] = exportEncoder[Input].instance
Expand All @@ -48,7 +48,7 @@ object ImportTypings {
}

object Output {
import io.circe.generic.auto._
import io.circe013.generic.auto._
import jsonCodecs._
implicit val OutputEncoder: Encoder[Output] = exportEncoder[Output].instance
implicit val OutputDecoder: Decoder[Output] = exportDecoder[Output].instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import java.nio.file.Path

import com.olvind.logging
import com.olvind.logging.{LogLevel, Logger}
import io.circe.{Decoder, Encoder}
import io.circe013.{Decoder, Encoder}
import org.scalablytyped.converter.internal.importer.Source.TsLibSource
import org.scalablytyped.converter.internal.importer._
import org.scalablytyped.converter.internal.maps._
Expand All @@ -30,7 +30,7 @@ object ImportTypingsGenSources {
)

object Input {
import io.circe.generic.auto._
import io.circe013.generic.auto._
import jsonCodecs._

implicit val ConfigEncoder: Encoder[Input] = exportEncoder[Input].instance
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.scalablytyped.converter.internal

import com.olvind.logging.Formatter
import io.circe.syntax._
import io.circe013.syntax._

case class RunCacheKey private (digest: Digest) {
def path(cacheDir: os.Path): os.Path = cacheDir / "runs" / s"${digest.hexString}.json"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.scalablytyped.converter.internal.scalajs

import io.circe.{Decoder, Encoder}
import io.circe013.{Decoder, Encoder}
import org.scalablytyped.converter.internal.stringUtils.quote

import scala.xml.Elem
Expand Down Expand Up @@ -75,6 +75,6 @@ object Dep {
override def version: String = dep.version
}

implicit val DepDecoder: Decoder[Dep] = io.circe.generic.semiauto.deriveDecoder[Dep]
implicit val DepEncoder: Encoder[Dep] = io.circe.generic.semiauto.deriveEncoder[Dep]
implicit val DepDecoder: Decoder[Dep] = io.circe013.generic.semiauto.deriveDecoder[Dep]
implicit val DepEncoder: Encoder[Dep] = io.circe013.generic.semiauto.deriveEncoder[Dep]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.scalablytyped.converter.internal
package scalajs
package flavours

import io.circe.Decoder
import io.circe013.Decoder
import org.scalablytyped.converter.internal.maps._
import org.scalablytyped.converter.internal.scalajs.QualifiedName.StdNames
import org.scalablytyped.converter.internal.scalajs.flavours.SlinkyGenComponents.names.{
Expand Down Expand Up @@ -159,9 +159,9 @@ object SlinkyTagsLoader {
/* extract what we need from the slinky json files */
type AttrsByTag = Map[TagName.Concrete, (Tag, Set[String])]
object AttrsByTag {
implicit val TagDecoder: Decoder[Tag] = io.circe.generic.semiauto.deriveDecoder[Tag]
implicit val AttributeDecoder: Decoder[Attribute] = io.circe.generic.semiauto.deriveDecoder[Attribute]
implicit val TagsModelDecoder: Decoder[TagsModel] = io.circe.generic.semiauto.deriveDecoder[TagsModel]
implicit val TagDecoder: Decoder[Tag] = io.circe013.generic.semiauto.deriveDecoder[Tag]
implicit val AttributeDecoder: Decoder[Attribute] = io.circe013.generic.semiauto.deriveDecoder[Attribute]
implicit val TagsModelDecoder: Decoder[TagsModel] = io.circe013.generic.semiauto.deriveDecoder[TagsModel]

private def massage(model: TagsModel): AttrsByTag =
model.tags.map { tag =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import java.io.File
import java.nio.file.{Files, Path}

import cats.data.ValidatedNel
import io.circe._
import io.circe.syntax._
import io.circe013._
import io.circe013.syntax._

import scala.io.Source
import scala.util.control.NonFatal
Expand All @@ -18,7 +18,7 @@ object Json {
object CustomJacksonParser extends Parser {
import com.fasterxml.jackson.core.{JsonFactory, JsonParser}
import com.fasterxml.jackson.databind.ObjectMapper
import io.circe.jackson.CirceJsonModule
import io.circe013.jackson.CirceJsonModule

// val Features = Set[JsonReadFeature](
// JsonReadFeature.ALLOW_JAVA_COMMENTS,
Expand Down