Skip to content

Commit

Permalink
Merge pull request #1 from kaizen-solutions/updates
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
calvinlfer committed Jun 22, 2022
2 parents cb0ca0d + e8949ba commit 1990859
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 71 deletions.
17 changes: 12 additions & 5 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
version = 2.7.5
version = 3.5.8
maxColumn = 120
align = most
align.preset = most
align.multiline = false
continuationIndent.defnSite = 2
assumeStandardLibraryStripMargin = true
docstrings = JavaDoc
docstrings.style = Asterisk
docstrings.wrapMaxColumn = 80
lineEndings = preserve
includeCurlyBraceInSelectChains = false
danglingParentheses = true
danglingParentheses.preset = true
optIn.annotationNewlines = true
rewrite.rules = [RedundantBraces]
newlines.alwaysBeforeMultilineDef = false
runner.dialect = scala212source3
rewrite {
rules = [AvoidInfix, PreferCurlyFors, SortImports, RedundantBraces, RedundantParens]
redundantBraces.maxLines = 1
}
133 changes: 77 additions & 56 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,66 +1,87 @@
import ReleaseTransformations._
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._

organization := "io.kaizensolutions"
inThisBuild {
val scala212 = "2.12.16"
val scala213 = "2.13.8"

name := "fs2-kafka-jsonschema-support"
Seq(
scalaVersion := scala213,
crossScalaVersions := Seq(scala212, scala213),
releaseTagName := s"${version.value}"
)
}

scalaVersion := "2.13.6"
ThisBuild / scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 12 | 13)) =>
Seq(
"-deprecation",
"-encoding",
"UTF-8",
"-feature",
"-language:implicitConversions",
"-unchecked",
"-language:higherKinds",
"-Xlint",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
"-Ywarn-unused",
"-Xsource:3"
)

scalacOptions ++= Seq(
"-deprecation",
"-encoding",
"UTF-8",
"-feature",
"-language:implicitConversions",
"-unchecked",
"-language:higherKinds",
"-Xlint",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
"-Ywarn-unused",
"-Xfatal-warnings",
"-Vimplicits",
"-Vtype-diffs",
"-Xsource:3"
)
case Some((3, _)) =>
Seq.empty

resolvers ++= Seq(
"confluent" at "https://packages.confluent.io/maven/",
"jitpack" at "https://jitpack.io"
)
case Some(_) | None =>
Seq.empty
}
}

libraryDependencies ++= {
val circe = "io.circe"
val fd4s = "com.github.fd4s"
val fs2KafkaV = "2.1.0"
def releaseSettings: Seq[Def.Setting[_]] =
Seq(
fd4s %% "fs2-kafka" % fs2KafkaV,
fd4s %% "fs2-kafka-vulcan" % fs2KafkaV,
"com.github.andyglow" %% "scala-jsonschema" % "0.7.2",
circe %% "circe-jackson212" % "0.14.0",
circe %% "circe-generic" % "0.14.1",
"org.typelevel" %% "munit-cats-effect-3" % "1.0.0" % Test,
"com.dimafeng" %% "testcontainers-scala-munit" % "0.39.5" % Test,
"ch.qos.logback" % "logback-classic" % "1.2.3" % Test,
"io.confluent" % "kafka-json-schema-serializer" % "6.2.0"
releaseIgnoreUntrackedFiles := true,
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
setNextVersion,
commitNextVersion,
pushChanges
)
)
}

releaseIgnoreUntrackedFiles := true

// Use just the version as the tag name (do not prefix with v)
releaseTagName := s"${version.value}"

releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
setNextVersion,
commitNextVersion,
pushChanges
resolvers ++= Seq(
"confluent".at("https://packages.confluent.io/maven/"),
"jitpack".at("https://jitpack.io")
)

lazy val root =
project
.in(file("."))
.settings(releaseSettings: _*)
.settings(
organization := "io.kaizensolutions",
name := "fs2-kafka-jsonschema-support",
libraryDependencies ++= {
val circe = "io.circe"
val fd4s = "com.github.fd4s"
val fs2KafkaV = "2.4.0"
Seq(
fd4s %% "fs2-kafka" % fs2KafkaV,
fd4s %% "fs2-kafka-vulcan" % fs2KafkaV,
"com.github.andyglow" %% "scala-jsonschema" % "0.7.8",
circe %% "circe-jackson212" % "0.14.0",
circe %% "circe-generic" % "0.14.2",
"org.scala-lang.modules" %% "scala-collection-compat" % "2.7.0",
"org.typelevel" %% "munit-cats-effect-3" % "1.0.7" % Test,
"com.dimafeng" %% "testcontainers-scala-munit" % "0.40.8" % Test,
"ch.qos.logback" % "logback-classic" % "1.2.11" % Test,
"io.confluent" % "kafka-json-schema-serializer" % "7.1.1"
)
}
)
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version = 1.5.4
sbt.version = 1.6.2
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.3")
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import json.{Json, Schema}
import munit.CatsEffectSuite

import java.io.{File, IOException}
import scala.annotation.nowarn
import scala.concurrent.duration.DurationInt
import scala.reflect.ClassTag

Expand Down Expand Up @@ -289,17 +288,17 @@ class JsonSchemaSerDesSpec extends CatsEffectSuite with TestContainersForAll {
}

object Book {
@nowarn implicit val bookJsonSchema: Schema[Book] = Json.schema[Book]
@nowarn implicit val bookCodec: Codec[Book] = deriveCodec[Book]
implicit val bookJsonSchema: Schema[Book] = Json.schema[Book]
implicit val bookCodec: Codec[Book] = deriveCodec[Book]
}
final case class Book(
@description("name of the book") name: String,
@description("international standard book number") isbn: Int
)

object PersonV1 {
@nowarn implicit val personJsonSchema: Schema[PersonV1] = Json.schema[PersonV1]
@nowarn implicit val personCodec: Codec[PersonV1] = deriveCodec[PersonV1]
implicit val personJsonSchema: Schema[PersonV1] = Json.schema[PersonV1]
implicit val personCodec: Codec[PersonV1] = deriveCodec[PersonV1]
}
final case class PersonV1(
@description("name of the person") name: String,
Expand All @@ -309,8 +308,8 @@ final case class PersonV1(

// V2 is backwards incompatible with V1 because the key has changed
object PersonV2Bad {
@nowarn implicit val personV2BadJsonSchema: Schema[PersonV2Bad] = Json.schema[PersonV2Bad]
@nowarn implicit val personV2BadCodec: Codec[PersonV2Bad] = deriveCodec[PersonV2Bad]
implicit val personV2BadJsonSchema: Schema[PersonV2Bad] = Json.schema[PersonV2Bad]
implicit val personV2BadCodec: Codec[PersonV2Bad] = deriveCodec[PersonV2Bad]
}
final case class PersonV2Bad(
@description("name of the person") name: String,
Expand All @@ -319,8 +318,8 @@ final case class PersonV2Bad(
)

object PersonV2Good {
@nowarn implicit val personV2GoodJsonSchema: Schema[PersonV2Good] = Json.schema[PersonV2Good]
@nowarn implicit val personV2GoodCodec: Codec[PersonV2Good] = {
implicit val personV2GoodJsonSchema: Schema[PersonV2Good] = Json.schema[PersonV2Good]
implicit val personV2GoodCodec: Codec[PersonV2Good] = {
val encoder: Encoder[PersonV2Good] = deriveEncoder[PersonV2Good]

val decoder: Decoder[PersonV2Good] = cursor =>
Expand Down

0 comments on commit 1990859

Please sign in to comment.