From f671e3ec915f70d3b1ee5a97c3393070301407cf Mon Sep 17 00:00:00 2001 From: Kamil Adam Date: Fri, 15 Sep 2023 21:16:12 +0200 Subject: [PATCH] Add Dependencies object --- build.sbt | 75 +++++----------------------------- project/Dependencies.scala | 83 ++++++++++++++++++++++++++++++++++++++ project/plugins.sbt | 21 ++++++++-- 3 files changed, 110 insertions(+), 69 deletions(-) create mode 100644 project/Dependencies.scala diff --git a/build.sbt b/build.sbt index e51abe0..88eaf82 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ ThisBuild / tlBaseVersion := "1.6" ThisBuild / developers := List(tlGitHubDev("kamil-adam", "Kamil Adam")) -ThisBuild / crossScalaVersions := Seq("3.3.0") +ThisBuild / crossScalaVersions := Seq(Dependencies.scalaVersion) ThisBuild / tlVersionIntroduced := Map("3" -> "1.1.5") ThisBuild / licenses := Seq("MIT" -> url("https://opensource.org/licenses/MIT")) @@ -13,73 +13,18 @@ ThisBuild / tlJdkRelease := Some(8) ThisBuild / tlSonatypeUseLegacyHost := false ThisBuild / tlCiReleaseTags := false -val catsVersion = "2.9.0" -val catsEffectVersion = "3.5.1" -val catsMtlVersion = "1.3.1" -val fs2Version = "3.8.0" -//val spec2Version = "4.20.2" -val spec2Version = "4.19.2" -val jawnVersion = "1.5.1" -val scalaTestVersion = "3.2.16" - lazy val coreSettings = Seq( name := "catculator", moduleName := "catculator-core", - libraryDependencies ++= Seq( - "org.typelevel" %%% "cats-kernel" % catsVersion, - "org.typelevel" %%% "cats-core" % catsVersion, - "org.typelevel" %%% "cats-laws" % catsVersion, - "org.typelevel" %%% "cats-free" % catsVersion, - "org.typelevel" %%% "cats-testkit" % catsVersion, - "org.typelevel" %%% "algebra" % catsVersion, - ), - libraryDependencies ++= Seq( - "org.typelevel" %%% "cats-effect" % catsEffectVersion, - "org.typelevel" %%% "cats-effect-kernel" % catsEffectVersion, - "org.typelevel" %%% "cats-effect-laws" % catsEffectVersion % Test, - ), - libraryDependencies ++= Seq( - "org.typelevel" %%% "cats-mtl" % catsMtlVersion, - "org.typelevel" %%% "cats-mtl-laws" % catsMtlVersion % Test, - ), - libraryDependencies ++= Seq( - "co.fs2" %%% "fs2-core" % fs2Version, - "co.fs2" %%% "fs2-scodec" % fs2Version, - "co.fs2" %%% "fs2-io" % fs2Version, - ), - // libraryDependencies ++= Seq( - // "org.typelevel" %%% "jawn-parser" % jawnVersion, - // "org.typelevel" %%% "jawn-ast" % jawnVersion, - // ), - libraryDependencies ++= Seq( - "org.typelevel" %%% "mouse" % "1.2.1", - "org.typelevel" %%% "kittens" % "3.0.0", - "org.typelevel" %%% "cats-collections-core" % "0.9.7", - ), - libraryDependencies ++= Seq( - "org.typelevel" %%% "discipline-core" % "1.5.1", - "org.typelevel" %%% "discipline-scalatest" % "2.2.0" % Test, - "org.typelevel" %%% "discipline-specs2" % "1.4.0" % Test, - // "org.typelevel" %%% "discipline-munit" % "1.0.9" % Test, - ), - libraryDependencies ++= Seq( - // "org.scalatest" %%% "scalatest" % scalaTestVersion % Test, - "org.scalatest" %%% "scalatest-funspec" % scalaTestVersion % Test, - "org.scalatest" %%% "scalatest-wordspec" % scalaTestVersion % Test, - ), - libraryDependencies ++= Seq( - "org.specs2" %%% "specs2-core" % spec2Version % Test, - "org.specs2" %%% "specs2-scalacheck" % spec2Version % Test, - ), - libraryDependencies ++= Seq( - "org.typelevel" %%% "spire" % "0.18.0", - "org.typelevel" %%% "cats-parse" % "0.3.10", - "org.typelevel" %%% "log4cats-core" % "2.6.0", - "org.scalacheck" %%% "scalacheck" % "1.17.0" % Test, - - // "org.scalameta" %%% "munit" % "1.0.0" % Test, - // "org.scalameta" %%% "munit-scalacheck" % "0.7.29" % Test, - ), + libraryDependencies ++= Dependencies.catsDeps.value, + libraryDependencies ++= Dependencies.catsEffectDeps.value, + libraryDependencies ++= Dependencies.catsMtlDeps.value, + libraryDependencies ++= Dependencies.fs2Deps.value, + libraryDependencies ++= Dependencies.jawnDeps.value, + libraryDependencies ++= Dependencies.scalaTestDeps.value, + libraryDependencies ++= Dependencies.specs2Deps.value, + libraryDependencies ++= Dependencies.disciplineDeps.value, + libraryDependencies ++= Dependencies.otherDeps.value, ) val coreJvmSettings = Seq( diff --git a/project/Dependencies.scala b/project/Dependencies.scala new file mode 100644 index 0000000..0f0441f --- /dev/null +++ b/project/Dependencies.scala @@ -0,0 +1,83 @@ +import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._ +import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._ +import org.scalajs.jsdependencies.sbtplugin.JSDependenciesPlugin.autoImport._ +import sbt._ + +object Dependencies { + val scalaVersion = "3.3.0" + + // Core + private val catsVersion = "2.9.0" + private val catsEffectVersion = "3.5.1" + private val catsMtlVersion = "1.3.1" + private val fs2Version = "3.8.0" + private val jawnVersion = "1.5.1" + private val scalaTestVersion = "3.2.16" + private val spec2Version = "4.19.2" + + // Udash + val udashVersion = "0.9.0" + val udashJQueryVersion = "3.2.0" + + // Backend + val jettyVersion = "9.4.51.v20230217" + val logbackVersion = "1.3.5" + val typesafeConfigVersion = "1.4.2" + + // JS dependencies + val bootstrapVersion = "4.1.3" + + val catsDeps = Def.setting(Seq( + "org.typelevel" %%% "cats-kernel" % catsVersion, + "org.typelevel" %%% "cats-core" % catsVersion, + "org.typelevel" %%% "cats-laws" % catsVersion, + "org.typelevel" %%% "cats-free" % catsVersion, + "org.typelevel" %%% "cats-testkit" % catsVersion, + "org.typelevel" %%% "algebra" % catsVersion, + )) + val catsEffectDeps = Def.setting(Seq( + "org.typelevel" %%% "cats-effect" % catsEffectVersion, + "org.typelevel" %%% "cats-effect-kernel" % catsEffectVersion, + "org.typelevel" %%% "cats-effect-laws" % catsEffectVersion % Test, + )) + val catsMtlDeps = Def.setting(Seq( + "org.typelevel" %%% "cats-mtl" % catsMtlVersion, + "org.typelevel" %%% "cats-mtl-laws" % catsMtlVersion % Test, + )) + val fs2Deps = Def.setting(Seq( + "co.fs2" %%% "fs2-core" % fs2Version, + "co.fs2" %%% "fs2-scodec" % fs2Version, + "co.fs2" %%% "fs2-io" % fs2Version, + )) + val jawnDeps = Def.setting(Seq( + "org.typelevel" %%% "jawn-parser" % jawnVersion, + "org.typelevel" %%% "jawn-ast" % jawnVersion, + )) + val scalaTestDeps = Def.setting(Seq( + "org.scalatest" %%% "scalatest-funspec" % scalaTestVersion % Test, + "org.scalatest" %%% "scalatest-wordspec" % scalaTestVersion % Test, + )) + val specs2Deps = Def.setting(Seq( + "org.specs2" %%% "specs2-core" % spec2Version % Test, + "org.specs2" %%% "specs2-scalacheck" % spec2Version % Test, + )) + val munitDeps = Def.setting(Seq( + "org.scalameta" %%% "munit" % "1.0.0" % Test, + "org.scalameta" %%% "munit-scalacheck" % "0.7.29" % Test, + )) + val disciplineDeps = Def.setting(Seq( + "org.typelevel" %%% "discipline-core" % "1.5.1", + "org.typelevel" %%% "discipline-scalatest" % "2.2.0" % Test, + "org.typelevel" %%% "discipline-specs2" % "1.4.0" % Test, + // "org.typelevel" %%% "discipline-munit" % "1.0.9" % Test, + )) + val otherDeps = Def.setting(Seq( + "org.typelevel" %%% "mouse" % "1.2.1", + "org.typelevel" %%% "kittens" % "3.0.0", + "org.typelevel" %%% "cats-collections-core" % "0.9.7", + "org.typelevel" %%% "spire" % "0.18.0", + "org.typelevel" %%% "cats-parse" % "0.3.10", + "org.typelevel" %%% "log4cats-core" % "2.6.0", + "org.scalacheck" %%% "scalacheck" % "1.17.0" % Test, + )) +} diff --git a/project/plugins.sbt b/project/plugins.sbt index 073c941..2511597 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,20 @@ +libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "1.1.1" + +// core + +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6") +addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.0") +addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.4.22") +addSbtPlugin("org.jetbrains.scala" % "sbt-ide-settings" % "1.1.1") + +addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.16") + +// native + addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.14") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.2") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") -addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.4.22") -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6") -addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.0") \ No newline at end of file +// js + +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.2") +addSbtPlugin("org.scala-js" % "sbt-jsdependencies" % "1.0.2")