From 79854a34823d0e3c91c295e7b8ec7138432b5d17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Del=C3=A8gue?= Date: Tue, 8 Oct 2024 10:06:15 +0200 Subject: [PATCH] WIP scala 3 --- build.sbt | 4 +++- nio-provider/build.sbt | 27 +++++++++++++++------------ nio-server/build.sbt | 16 ++++++++++------ project/Dependencies.scala | 10 +++++----- project/plugins.sbt | 4 ++++ version.sbt | 2 +- 6 files changed, 38 insertions(+), 25 deletions(-) diff --git a/build.sbt b/build.sbt index f96ea9d0..0f65dd60 100644 --- a/build.sbt +++ b/build.sbt @@ -1,4 +1,6 @@ -import ReleaseTransformations._ +import ReleaseTransformations.* + +import scala.collection.Seq name := """nio""" organization := "fr.maif" diff --git a/nio-provider/build.sbt b/nio-provider/build.sbt index 41dd6cd3..5d10c94a 100644 --- a/nio-provider/build.sbt +++ b/nio-provider/build.sbt @@ -25,7 +25,8 @@ libraryDependencies ++= Seq( "org.apache.pekko" %% "pekko-connectors-kafka" % pekkoKafka, "de.svenkubiak" % "jBCrypt" % "0.4.1", // ISC/BSD "com.auth0" % "java-jwt" % javaJwt, // MIT license - "com.github.pureconfig" %% "pureconfig" % pureConfig, // Apache 2.0 + "com.github.pureconfig" %% "pureconfig-core" % pureConfig, // Apache 2.0 + "com.github.pureconfig" %% "pureconfig-generic-scala3" % pureConfig, // Apache 2.0 "org.scalactic" %% "scalactic" % scalaticVersion, // Apache 2.0 "org.webjars" % "swagger-ui" % "3.12.1", "org.typelevel" %% "cats-core" % catsVersion, // MIT @@ -37,16 +38,18 @@ scalacOptions ++= Seq( "-feature", "-language:higherKinds", "-language:implicitConversions", - "-language:existentials" + "-language:existentials", + "-Ykind-projector:underscores", + "Xsource:3" ) /// ASSEMBLY CONFIG -mainClass in assembly := Some("play.core.server.ProdServerStart") -test in assembly := {} -assemblyJarName in assembly := "nio-provider.jar" -fullClasspath in assembly += Attributed.blank(PlayKeys.playPackageAssets.value) -assemblyMergeStrategy in assembly := { +assembly / mainClass := Some("play.core.server.ProdServerStart") +assembly / test := {} +assembly / assemblyJarName := "nio-provider.jar" +assembly / fullClasspath += Attributed.blank(PlayKeys.playPackageAssets.value) +assembly / assemblyMergeStrategy := { case PathList("javax", xs @ _*) => MergeStrategy.first case PathList("META-INF", "native", xs @ _*) => MergeStrategy.first case PathList("org", "apache", "commons", "logging", xs @ _*) => MergeStrategy.discard @@ -65,8 +68,8 @@ assemblyMergeStrategy in assembly := { lazy val packageAll = taskKey[Unit]("PackageAll") packageAll := { - (dist in Compile).value - (assembly in Compile).value + (Compile / dist).value + (Compile / assembly).value } /// DOCKER CONFIG @@ -74,9 +77,9 @@ packageAll := { dockerExposedPorts := Seq( 9000 ) -packageName in Docker := "nio-provider" +Docker / packageName := "nio-provider" -maintainer in Docker := "MAIF Team " +Docker / maintainer := "MAIF Team " dockerBaseImage := "openjdk:8" @@ -109,4 +112,4 @@ dockerEntrypoint ++= Seq( dockerUpdateLatest := true -packageName in Universal := s"nio-provider" +Universal / packageName := s"nio-provider" diff --git a/nio-server/build.sbt b/nio-server/build.sbt index 08657bea..b347a45f 100644 --- a/nio-server/build.sbt +++ b/nio-server/build.sbt @@ -11,6 +11,8 @@ lazy val `nio-server` = (project in file(".")) scalaVersion := "2.13.14" +semanticdbVersion := scalafixSemanticdb.revision + resolvers ++= Seq( Resolver.jcenterRepo, "Maven central" at "https://repo1.maven.org/maven2/" @@ -38,8 +40,9 @@ libraryDependencies ++= Seq( "org.apache.commons" % "commons-lang3" % "3.11", "de.svenkubiak" % "jBCrypt" % "0.4.1", // ISC/BSD "com.auth0" % "java-jwt" % javaJwt, // MIT license - "com.github.pureconfig" %% "pureconfig" % pureConfig, // Apache 2.0 - "org.scalactic" %% "scalactic" % scalaticVersion, // Apache 2.0 + "com.github.pureconfig" %% "pureconfig-core" % pureConfig, // Apache 2.0 +// "com.github.pureconfig" %% "pureconfig-generic-scala3" % pureConfig, // Apache 2.0 + // "org.scalactic" %% "scalactic" % scalaticVersion, // Apache 2.0 "org.webjars" % "swagger-ui" % "3.12.1", "org.typelevel" %% "cats-core" % catsVersion, // MIT "com.softwaremill.macwire" %% "macros" % macwireVersion % "provided", @@ -57,7 +60,8 @@ scalacOptions ++= Seq( "-feature", "-language:higherKinds", "-language:implicitConversions", - "-language:existentials" + "-language:existentials", + "Xsource:3" ) /// ASSEMBLY CONFIG @@ -95,9 +99,9 @@ packageAll := { dockerExposedPorts := Seq( 9000 ) -packageName in Docker := "nio" +Docker / packageName := "nio" -maintainer in Docker := "MAIF Team " +Docker / maintainer := "MAIF Team " dockerBaseImage := "openjdk:8" @@ -134,4 +138,4 @@ dockerEntrypoint ++= Seq( dockerUpdateLatest := true -packageName in Universal := s"nio" +Universal / packageName := s"nio" diff --git a/project/Dependencies.scala b/project/Dependencies.scala index e48ac623..08929c97 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -2,12 +2,12 @@ object Dependencies { val reactiveMongoVersion = "1.1.0" val pekko = "1.1.1" val pekkoKafka = "1.1.0" - val pureConfig = "0.14.0" - val scalaticVersion = "3.2.0" - val catsVersion = "2.2.0" - val macwireVersion = "2.3.7" - val metricsVersion = "4.0.2" val pekkoS3Version = "1.0.2" + val pureConfig = "0.17.7" + val scalaticVersion = "3.2.19" + val catsVersion = "2.12.0" + val macwireVersion = "2.6.2" + val metricsVersion = "4.0.2" val scalatestPlay = "7.0.1" val javaJwt = "3.11.0" } diff --git a/project/plugins.sbt b/project/plugins.sbt index 800c8450..981fc46e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -13,4 +13,8 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0") // Apache 2.0 addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13") // Apache 2.0 +addSbtPlugin("ch.epfl.scala" % "sbt-scala3-migrate" % "0.6.1") + +addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.13.0") + ThisBuild / libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always \ No newline at end of file diff --git a/version.sbt b/version.sbt index 53dfa333..eb2301f2 100644 --- a/version.sbt +++ b/version.sbt @@ -1 +1 @@ -version in ThisBuild := "2.0.6-SNAPSHOT" +ThisBuild / version := "2.0.6-SNAPSHOT"