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

Update libs #295

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ target/
**/secret.conf
**/.DS_Store
.vscode/

.bsp/
project/metals.sbt
project/project/
10 changes: 10 additions & 0 deletions .sbtops
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-Xss4m
-Xms1G
-Xmx8G
-XX:ReservedCodeCacheSize=1024m
-XX:+TieredCompilation
-XX:+CMSClassUnloadingEnabled
-XX:+UseG1GC
-XX:MaxMetaspaceSize=1024M
-Dfile.encoding=UTF-8

2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=2.4.2
version=2.7.5
align.openParenCallSite = true
align.openParenDefnSite = true
maxColumn = 120
Expand Down
37 changes: 20 additions & 17 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
val Scala_212 = "2.12.11"
val Scala_213 = "2.13.2"
val Scala_213 = "2.13.5"
val Scala_3 = "3.0.0-RC1"

val catsEffectVersion = "2.4.1"
val catsTaglessVersion = "0.12"
val doobieVersion = "0.9.4"
val catsVersion = "2.4.2"
val doobieVersion = "0.12.1"
val catsVersion = "2.5.0"
val scalacacheVersion = "0.28.0"
val kindProjectorVersion = "0.11.3"
val fs2RedisVersion = "0.10.3"
val fs2RedisVersion = "0.13.1"
val h2Version = "1.4.200"
val log4CatsVersion = "1.1.1"
val log4CatsVersion = "2.0.1"
val http4sVersion = "0.21.21"
val circeVersion = "0.13.0"
val sttpVersion = "1.7.2"
val akkaHttpVersion = "10.2.4"

inThisBuild(
List(
Expand All @@ -30,12 +31,8 @@ inThisBuild(
)
)

val compilerPlugins = List(
compilerPlugin(("org.typelevel" % "kind-projector" % kindProjectorVersion).cross(CrossVersion.full))
)

val commonSettings = Seq(
scalaVersion := Scala_212,
scalaVersion := Scala_213,
scalacOptions --= Seq("-Xfatal-warnings"),
name := "sup",
updateOptions := updateOptions.value.withGigahorse(false), //may fix publishing bug
Expand All @@ -45,11 +42,14 @@ val commonSettings = Seq(
"org.typelevel" %% "cats-testkit-scalatest" % "2.1.1" % Test,
"org.typelevel" %% "cats-laws" % catsVersion % Test,
"org.typelevel" %% "cats-kernel-laws" % catsVersion % Test
) ++ compilerPlugins,
) ++ {
if (isDotty.value) Nil else compilerPlugin(("org.typelevel" % "kind-projector" % kindProjectorVersion).cross(CrossVersion.full)) :: Nil

},
mimaPreviousArtifacts := Set(organization.value %% name.value % "0.7.0")
)

val crossBuiltCommonSettings = commonSettings ++ Seq(crossScalaVersions := Seq(Scala_212, Scala_213))
val crossBuiltCommonSettings = commonSettings ++ Seq(crossScalaVersions := Seq(Scala_213, Scala_3))

def module(moduleName: String): Project =
Project(moduleName, file("modules") / moduleName).settings(crossBuiltCommonSettings).settings(name += s"-$moduleName")
Expand Down Expand Up @@ -89,7 +89,7 @@ val redis = module("redis")
val log4cats = module("log4cats")
.settings(
libraryDependencies ++= Seq(
"io.chrisdavenport" %% "log4cats-core" % log4CatsVersion
"org.typelevel" %% "log4cats-core" % log4CatsVersion
)
)
.dependsOn(core)
Expand All @@ -114,7 +114,7 @@ val http4sClient = module("http4s-client")
val akkaHttp = module("akka-http")
.settings(
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-http" % "10.2.3"
"com.typesafe.akka" %% "akka-http" % akkaHttpVersion
)
)
.dependsOn(core)
Expand Down Expand Up @@ -152,7 +152,7 @@ def enumerateAnd(values: List[String]): String = {

val microsite = project
.settings(
scalaVersion := Scala_212,
scalaVersion := Scala_213,
crossScalaVersions := List(),
micrositeName := "sup",
micrositeDescription := "Functional healthchecks in Scala",
Expand All @@ -166,7 +166,10 @@ val microsite = project
micrositePushSiteWith := GitHub4s,
micrositeGithubToken := sys.env.get("GITHUB_TOKEN"),
scalacOptions --= Seq("-Xfatal-warnings"),
libraryDependencies ++= compilerPlugins,
libraryDependencies ++= {
if (isDotty.value) Nil else compilerPlugin(("org.typelevel" % "kind-projector" % kindProjectorVersion).cross(CrossVersion.full)) :: Nil

},
libraryDependencies ++= Seq(
"org.http4s" %% "http4s-circe" % http4sVersion,
"de.heikoseeberger" %% "akka-http-circe" % "1.29.1"
Expand Down
12 changes: 6 additions & 6 deletions modules/core/src/main/scala/sup/HealthCheck.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ object HealthCheck {
*
* If H and I are the same, the result's EitherK can be combined to a single H/I container using `mods.mergeEitherK`.
* */
def either[F[_]: ApplicativeError[?[_], E], E, H[_], I[_]](
def either[F[_]: ApplicativeError[*[_], E], E, H[_], I[_]](
a: HealthCheck[F, H],
b: HealthCheck[F, I]
): HealthCheck[F, EitherK[H, I, ?]] =
): HealthCheck[F, EitherK[H, I, *]] =
liftF {
a.check
.map(ar => EitherK.left[I](ar.value))
Expand All @@ -71,7 +71,7 @@ object HealthCheck {
*
* If H and I are the same, the result's Tuple2K can be combined to a single H/I container using `mods.mergeTuple2K`.
* */
def tupled[F[_]: Apply, H[_], I[_]](a: HealthCheck[F, H], b: HealthCheck[F, I]): HealthCheck[F, Tuple2K[H, I, ?]] =
def tupled[F[_]: Apply, H[_], I[_]](a: HealthCheck[F, H], b: HealthCheck[F, I]): HealthCheck[F, Tuple2K[H, I, *]] =
liftF {
(a.check, b.check).mapN((ac, bc) => HealthResult(Tuple2K(ac.value, bc.value)))
}
Expand All @@ -84,7 +84,7 @@ object HealthCheck {
def parTupled[F[_]: NonEmptyParallel, H[_], I[_]](
a: HealthCheck[F, H],
b: HealthCheck[F, I]
): HealthCheck[F, Tuple2K[H, I, ?]] =
): HealthCheck[F, Tuple2K[H, I, *]] =
liftF {
(a.check, b.check).parMapN((ac, bc) => HealthResult(Tuple2K(ac.value, bc.value)))
}
Expand All @@ -95,12 +95,12 @@ object HealthCheck {
*
* If H and I are the same, the result's EitherK can be combined to a single H/I container using `mods.mergeEitherK`.
* */
def race[F[_]: Concurrent, H[_], I[_]](a: HealthCheck[F, H], b: HealthCheck[F, I]): HealthCheck[F, EitherK[H, I, ?]] =
def race[F[_]: Concurrent, H[_], I[_]](a: HealthCheck[F, H], b: HealthCheck[F, I]): HealthCheck[F, EitherK[H, I, *]] =
liftF {
a.check.race(b.check).map(e => HealthResult(EitherK(e.bimap(_.value, _.value))))
}

implicit def functorK[F[_]: Functor]: FunctorK[HealthCheck[F, ?[_]]] = new FunctorK[HealthCheck[F, ?[_]]] {
implicit def functorK[F[_]: Functor]: FunctorK[HealthCheck[F, *[_]]] = new FunctorK[HealthCheck[F, *[_]]] {
override def mapK[G[_], H[_]](fgh: HealthCheck[F, G])(gh: G ~> H): HealthCheck[F, H] = fgh.mapK(gh)
}

Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/sup/HealthResult.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ object HealthResult {
def const[H[_]: Applicative](health: Health): HealthResult[H] = HealthResult(health.pure[H])

val one: Health => HealthResult[Id] = HealthResult[Id]
def tagged[Tag](tag: Tag, head: Health): HealthResult[Tagged[Tag, ?]] = HealthResult(Tagged(tag, head))
def tagged[Tag](tag: Tag, head: Health): HealthResult[Tagged[Tag, *]] = HealthResult(Tagged(tag, head))

implicit val functorK: FunctorK[HealthResult] = new FunctorK[HealthResult] {
def mapK[F[_], G[_]](hf: HealthResult[F])(fg: F ~> G): HealthResult[G] = new HealthResult[G](fg(hf.value))
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/sup/data/HealthReporter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ object HealthReporter {

def fromResults[G[_]: Reducible: Functor, H[_]: Reducible](
results: G[HealthResult[H]]
): HealthResult[Report[G, H, ?]] =
): HealthResult[Report[G, H, *]] =
HealthResult(Report.fromResults[G, H, Health](results.map(_.value)))
}
6 changes: 3 additions & 3 deletions modules/core/src/main/scala/sup/data/Report.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ object Report extends ReportInstances {

trait ReportInstances {

implicit def catsReducibleForReport[G[_], H[_]](implicit F: Foldable[Nested[G, H, ?]]): Reducible[Report[G, H, ?]] =
implicit def catsReducibleForReport[G[_], H[_]](implicit F: Foldable[Nested[G, H, *]]): Reducible[Report[G, H, *]] =
new ReportReducible[G, H]

implicit def catsShowForReport[G[_], H[_], A: Show](implicit showGha: Show[G[H[A]]]): Show[Report[G, H, A]] =
Show.show(report => show"Report(health = ${report.health}, checks = ${report.checks})")
}

private[data] class ReportReducible[G[_], H[_]](implicit F: Foldable[Nested[G, H, ?]])
extends NonEmptyReducible[Report[G, H, ?], Nested[G, H, ?]] {
private[data] class ReportReducible[G[_], H[_]](implicit F: Foldable[Nested[G, H, *]])
extends NonEmptyReducible[Report[G, H, *], Nested[G, H, *]] {
override def split[A](fa: Report[G, H, A]): (A, Nested[G, H, A]) = (fa.health, Nested(fa.checks))
}
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/sup/data/Tagged.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ object Tagged {
* The only place where it should be passed to is [[sup.HealthReporter.fromChecks]],
* for determining the status of the wrapping check. In other cases, it's probably useless, as it discards the tag completely.
* */
implicit def catsReducibleForTagged[Tag]: Reducible[Tagged[Tag, ?]] = Reducibles.by(λ[Tagged[Tag, ?] ~> Id](_.health))
implicit def catsReducibleForTagged[Tag]: Reducible[Tagged[Tag, *]] = Reducibles.by(λ[Tagged[Tag, *] ~> Id](_.health))

implicit def catsEqForTagged[Tag: Eq, H: Eq]: Eq[Tagged[Tag, H]] = Eq.by(tagged => (tagged.tag, tagged.health))

Expand Down
8 changes: 4 additions & 4 deletions modules/core/src/main/scala/sup/mods.scala
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,27 @@ object mods {
/**
* Tag a health check with a value.
* */
def tagWith[F[_]: Functor, Tag](tag: Tag): HealthCheckMod[F, Id, F, Tagged[Tag, ?]] =
def tagWith[F[_]: Functor, Tag](tag: Tag): HealthCheckMod[F, Id, F, Tagged[Tag, *]] =
_.mapResult(_.transform(Tagged(tag, _)))

/**
* Unwrap a tagged health check (dual of `tagWith`).
* */
def untag[F[_]: Functor, Tag]: HealthCheckMod[F, Tagged[Tag, ?], F, Id] =
def untag[F[_]: Functor, Tag]: HealthCheckMod[F, Tagged[Tag, *], F, Id] =
_.mapResult(_.transform[Id](_.health))

/**
* Combines containers in a Tuple2K using the given semigroup. Useful in conjunction with HealthCheck.{`tupled`, `parTupled`}.
* */
def combineTuple2K[F[_]: Functor, H[_]](implicit S: Semigroup[H[Health]]): HealthCheckMod[F, Tuple2K[H, H, ?], F, H] =
def combineTuple2K[F[_]: Functor, H[_]](implicit S: Semigroup[H[Health]]): HealthCheckMod[F, Tuple2K[H, H, *], F, H] =
_.mapResult {
_.transform(tuple => tuple.first |+| tuple.second)
}

/**
* Merges an EitherK of the same container type. Useful in conjunction with HealthCheck.{`either`, `race`}.
* */
def mergeEitherK[F[_]: Functor, H[_]]: HealthCheckMod[F, EitherK[H, H, ?], F, H] = _.mapResult {
def mergeEitherK[F[_]: Functor, H[_]]: HealthCheckMod[F, EitherK[H, H, *], F, H] = _.mapResult {
_.transform(_.run.merge)
}

Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/sup/package.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sup.data.Report

package object sup {
type HealthReporter[F[_], G[_], H[_]] = HealthCheck[F, Report[G, H, ?]]
type HealthReporter[F[_], G[_], H[_]] = HealthCheck[F, Report[G, H, *]]

type HealthCheckMod[F[_], H[_], G[_], I[_]] = HealthCheck[F, H] => HealthCheck[G, I]

Expand Down
2 changes: 1 addition & 1 deletion modules/doobie/src/main/scala/sup/modules/doobie.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ object doobie {
* Note: Errors aren't recovered in this healthcheck. If you want error handling,
* consider using [[HealthCheck.through]] with [[sup.mods.recoverToSick]].
* */
def connectionCheck[F[_]: Bracket[?[_], Throwable]](
def connectionCheck[F[_]: Bracket[*[_], Throwable]](
xa: Transactor[F]
)(
timeout: Option[FiniteDuration]
Expand Down
2 changes: 1 addition & 1 deletion modules/log4cats/src/main/scala/sup/modules/log4cats.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package sup.modules

import cats.{FlatMap, Show}
import io.chrisdavenport.log4cats.MessageLogger
import org.typelevel.log4cats.MessageLogger
import cats.implicits._
import sup.{mods, Health, HealthCheckEndoMod}

Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.4.7
sbt.version=1.4.9
5 changes: 3 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7")
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.3.0")
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.3.3")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.8.1")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.16")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.17")
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.5.4")