diff --git a/build.sbt b/build.sbt index fa75a68..45d3895 100644 --- a/build.sbt +++ b/build.sbt @@ -11,22 +11,22 @@ scmInfo := Some( ) ) -scalaVersion := "3.3.1" +scalaVersion := "3.4.2" + +scalacOptions += "-Ykind-projector:underscores" mainClass := Some("fr.janalyse.cem.Main") lazy val versions = new { - val sttp = "3.9.1" - val zio = "2.0.21" + val sttp = "3.9.7" + val zio = "2.1.3" val zionio = "2.0.2" val zioproc = "0.7.2" - val zioconfig = "4.0.0" - val ziologging = "2.1.16" - val ziolmdb = "1.7.1" + val zioconfig = "4.0.2" + val ziologging = "2.3.0" + val ziolmdb = "1.8.0" val naturalsort = "1.0.4" - val jgit = "6.8.0.202311291450-r" - // val logback = "1.4.7" - val log4j2 = "2.20.0" + val jgit = "6.10.0.202406032230-r" } libraryDependencies ++= Seq( @@ -50,8 +50,6 @@ libraryDependencies ++= Seq( "org.eclipse.jgit" % "org.eclipse.jgit" % versions.jgit ) -//excludeDependencies += "org.scala-lang.modules" % "scala-collection-compat_2.13" - testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework") enablePlugins(SbtTwirl) diff --git a/project/build.properties b/project/build.properties index a93647b..d80183c 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1,2 +1,2 @@ # suppress inspection "UnusedProperty" for whole file -sbt.version=1.9.8 +sbt.version=1.10.0 diff --git a/project/plugins.sbt b/project/plugins.sbt index 168f0eb..b6a384d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,7 @@ -addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") +addSbtPlugin("com.github.sbt" % "sbt-release" % "1.4.0") addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1") -addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.21") +addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.10.0") addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.3") -addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.16") -addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.1") -addSbtPlugin("com.typesafe.play" % "sbt-twirl" % "1.6.4") +addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.10.0") +addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.1") +addSbtPlugin("com.typesafe.play" % "sbt-twirl" % "1.6.6") diff --git a/src/main/scala/fr/janalyse/cem/Main.scala b/src/main/scala/fr/janalyse/cem/Main.scala index c5e01fb..81f419c 100644 --- a/src/main/scala/fr/janalyse/cem/Main.scala +++ b/src/main/scala/fr/janalyse/cem/Main.scala @@ -4,10 +4,10 @@ import zio.* import zio.config.* import zio.config.typesafe.* import zio.config.magnolia.* - -import zio.logging.{LogFormat, removeDefaultLoggers, consoleLogger} +import zio.logging.{ConsoleLoggerConfig, LogFormat, consoleLogger} import zio.logging.slf4j.bridge.Slf4jBridge import sttp.client3.asynchttpclient.zio.AsyncHttpClientZioBackend +import zio.Runtime.removeDefaultLoggers import zio.lmdb.{LMDB, LMDBConfig} object Main extends ZIOAppDefault { @@ -37,10 +37,7 @@ object Main extends ZIOAppDefault { val configLayer = ZLayer.fromZIO(configProviderLogic.map(provider => Runtime.setConfigProvider(provider))).flatten - override val bootstrap = - //removeDefaultLoggers ++ SLF4J.slf4j(format = LogFormat.colored) ++ ZLayer.fromZIO(configProviderLogic.map(provider => Runtime.setConfigProvider(provider))).flatten - configLayer ++ (removeDefaultLoggers >>> configLayer >>> consoleLogger(configPath = "logger") >>> Slf4jBridge.initialize) - + override val bootstrap = configLayer ++ ( removeDefaultLoggers >>> configLayer >>> consoleLogger() >>> Slf4jBridge.initialize) val httpClientLayer = AsyncHttpClientZioBackend.layer() diff --git a/src/main/scala/fr/janalyse/cem/RemoteGithubOperations.scala b/src/main/scala/fr/janalyse/cem/RemoteGithubOperations.scala index a4be5b2..d17bb9e 100644 --- a/src/main/scala/fr/janalyse/cem/RemoteGithubOperations.scala +++ b/src/main/scala/fr/janalyse/cem/RemoteGithubOperations.scala @@ -170,7 +170,7 @@ object RemoteGithubOperations { Obj( "description" -> Str(description), "public" -> Bool(publicBool), - "files" -> Obj(files: _*) + "files" -> Obj(files*) ) } @@ -221,7 +221,7 @@ object RemoteGithubOperations { Obj( "description" -> Str(description), - "files" -> Obj(files: _*) + "files" -> Obj(files*) ) } diff --git a/src/test/scala/fr/janalyse/cem/RemoteGithubOperationsSpec.scala b/src/test/scala/fr/janalyse/cem/RemoteGithubOperationsSpec.scala index ebeb098..228e239 100644 --- a/src/test/scala/fr/janalyse/cem/RemoteGithubOperationsSpec.scala +++ b/src/test/scala/fr/janalyse/cem/RemoteGithubOperationsSpec.scala @@ -24,6 +24,9 @@ import fr.janalyse.cem.model.WhatToDo.* import fr.janalyse.cem.tools.DescriptionTools.* import org.junit.runner.RunWith import sttp.client3.asynchttpclient.zio.AsyncHttpClientZioBackend +import sttp.capabilities.zio.ZioStreams +import sttp.capabilities.WebSockets +import sttp.client3.testing.SttpBackendStub import zio.nio.file.Path import zio.lmdb.LMDB @@ -85,13 +88,13 @@ class RemoteGithubOperationsSpec extends ZIOSpecDefault { results <- githubRemoteExamplesChangesApply(config, todos) } yield results - val stubbedLayer = ZLayer.succeed( - AsyncHttpClientZioBackend.stub - .whenRequestMatches(_.uri.toString() == "https://api.github.com/gists/6e40f8239fa6828ab45a064b8131fdfc") - .thenRespond("""{"id":"aa-bb", "html_url":"https://truc/aa-bb"}""") - ) + val stub: SttpBackendStub[Task, Any] = AsyncHttpClientZioBackend.stub + .whenRequestMatches(_.uri.toString() == "https://api.github.com/gists/6e40f8239fa6828ab45a064b8131fdfc") + .thenRespond("""{"id":"aa-bb", "html_url":"https://truc/aa-bb"}""") + + val stubLayer = ZLayer.succeed(stub) - logic.provide(stubbedLayer).map(result => assertTrue(true)) + logic.provide(stubLayer).map(result => assertTrue(true)) } // ----------------------------------------------------------------------------------------------