Skip to content

Commit

Permalink
Consolidate dependencies into project/Dependencies.scala
Browse files Browse the repository at this point in the history
  • Loading branch information
reidspencer committed Jan 25, 2025
1 parent 1194080 commit 4bd7867
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 41 deletions.
73 changes: 35 additions & 38 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import com.ossuminc.sbt.OssumIncPlugin
import com.typesafe.tools.mima.core.{ProblemFilters, ReversedMissingMethodProblem}
import de.heikoseeberger.sbtheader.License.ALv2
import de.heikoseeberger.sbtheader.LicenseStyle.SpdxSyntax
import os./
import sbt.Append.{appendSeqImplicit, appendSet}
import sbt.Keys.{description, libraryDependencies, scalacOptions}
import sbtbuildinfo.BuildInfoPlugin.autoImport.buildInfoPackage
import sbtcrossproject.{CrossClasspathDependency, CrossProject}
import sbttastymima.TastyMiMaPlugin.autoImport.*
import tastymima.intf.{ProblemKind, ProblemMatcher}

import scala.collection.Seq

Expand Down Expand Up @@ -109,10 +109,10 @@ lazy val utils_cp: CrossProject = CrossModule("utils", "riddl-utils")(JVM, JS, N
buildInfoPackage := "com.ossuminc.riddl.utils",
buildInfoObject := "RiddlBuildInfo",
libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "2.8.0",
"io.github.cquiroz" %%% "scala-java-time" % "2.6.0",
"org.scalactic" %%% "scalactic" % V.scalatest % Test,
"org.scalatest" %%% "scalatest" % V.scalatest % Test
Dep.dom.value,
Dep.scala_java_time.value,
Dep.scalatest_nojvm.value,
Dep.scalactic_nojvm.value
)
)
.nativeConfigure(
Expand All @@ -135,11 +135,12 @@ lazy val utils_cp: CrossProject = CrossModule("utils", "riddl-utils")(JVM, JS, N
buildInfoPackage := "com.ossuminc.riddl.utils",
buildInfoObject := "RiddlBuildInfo",
libraryDependencies ++= Seq(
"com.softwaremill.sttp.client4" %%% "core" % V.sttp,
"org.scala-native" %%% "java-net-url-stubs" % "1.0.0",
"io.github.cquiroz" %%% "scala-java-time" % "2.6.0",
"org.scalactic" %%% "scalactic" % V.scalatest % Test,
"org.scalatest" %%% "scalatest" % V.scalatest % Test
Dep.sttp_nojvm.value,
Dep.java_net_url_stubs.value,
Dep.scala_java_time.value,
Dep.scalactic_nojvm.value,
Dep.scalatest_nojvm.value,
Dep.scalactic_nojvm.value
)
)
lazy val utils = utils_cp.jvm
Expand Down Expand Up @@ -176,16 +177,17 @@ lazy val language_cp: CrossProject = CrossModule("language", "riddl-language")(J
)
},
coverageExcludedPackages := "<empty>;$anon",
libraryDependencies ++= Dep.testing ++ Seq(Dep.fastparse),
libraryDependencies += "org.wvlet.airframe" %% "airframe-ulid" % V.airframe_ulid,
libraryDependencies += "org.wvlet.airframe" %% "airframe-json" % V.airframe_json,
libraryDependencies += Dep.commons_io % Test
libraryDependencies ++= Dep.testing ++ Seq(
Dep.fastparse,
Dep.airframe_ulid,
Dep.airframe_json,
Dep.commons_io % Test
)
)
.jsConfigure(With.js("RIDDL: language", withCommonJSModule = true))
.jsConfigure(With.noMiMa)
.jsSettings(
libraryDependencies += "com.lihaoyi" %%% "fastparse" % V.fastparse,
libraryDependencies += "org.wvlet.airframe" %%% "airframe-ulid" % V.airframe_ulid
libraryDependencies ++= Seq(Dep.fastparse_nojvm.value, Dep.airframe_ulid_nojvm.value)
)
.nativeConfigure(
With.native(
Expand All @@ -201,10 +203,10 @@ lazy val language_cp: CrossProject = CrossModule("language", "riddl-language")(J
.nativeConfigure(With.noMiMa)
.nativeSettings(
libraryDependencies ++= Seq(
"com.lihaoyi" %%% "fastparse" % V.fastparse,
"org.wvlet.airframe" %%% "airframe-ulid" % V.airframe_ulid,
"org.scalactic" %%% "scalactic" % V.scalatest % Test,
"org.scalatest" %%% "scalatest" % V.scalatest % Test
Dep.fastparse_nojvm.value,
Dep.airframe_ulid_nojvm.value,
Dep.scalatest_nojvm.value,
Dep.scalactic_nojvm.value
)
)

Expand Down Expand Up @@ -261,8 +263,8 @@ lazy val testkit_cp = CrossModule("testkit", "riddl-testkit")(JVM, JS, Native)
.dependsOn(tkDep(utils_cp), tkDep(language_cp), tkDep(passes_cp))
.jvmSettings(
libraryDependencies ++= Seq(
"org.scalactic" %% "scalactic" % V.scalatest,
"org.scalatest" %% "scalatest" % V.scalatest
Dep.scalatest_nojvm.value,
Dep.scalactic_nojvm.value
)
)
.jvmConfigure(With.MiMa("0.57.0"))
Expand All @@ -271,17 +273,17 @@ lazy val testkit_cp = CrossModule("testkit", "riddl-testkit")(JVM, JS, Native)
.jsSettings(
// scalacOptions ++= Seq("-rewrite", "-source", "3.4-migration"),
libraryDependencies ++= Seq(
"org.scalactic" %%% "scalactic" % V.scalatest,
"org.scalatest" %%% "scalatest" % V.scalatest
Dep.scalatest_nojvm.value,
Dep.scalactic_nojvm.value
)
)
.nativeConfigure(With.noMiMa)
.nativeConfigure(With.native(mode = "fast"))
.nativeSettings(
evictionErrorLevel := sbt.util.Level.Warn,
libraryDependencies ++= Seq(
"org.scalactic" %%% "scalactic" % V.scalatest,
"org.scalatest" %%% "scalatest" % V.scalatest
Dep.scalatest_nojvm.value,
Dep.scalactic_nojvm.value
)
)
val testkit = testkit_cp.jvm
Expand Down Expand Up @@ -352,25 +354,20 @@ lazy val commands_cp: CrossProject = CrossModule("commands", "riddl-commands")(J
.jvmConfigure(With.coverage(50))
.jvmConfigure(With.MiMa("0.57.0"))
.jvmSettings(
libraryDependencies ++= Seq(Dep.scopt, Dep.sconfig),
libraryDependencies += "org.scala-js" %% "scalajs-stubs" % "1.1.0" % "provided",
libraryDependencies ++= Seq(Dep.scopt, Dep.sconfig, Dep.scalajs_stubs),
coverageExcludedFiles := """<empty>;$anon"""
)
// NOTE: This configuration is not supported because executing commands
// NOTE: from javascript is not easy
// .jsConfigure(With.js("RIDDL: diagrams", withCommonJSModule = true))
// .jsConfigure(With.noMiMa)
// .jsSettings(
// libraryDependencies ++= Seq(
// "com.github.scopt" %%% "scopt" % V.scopt,
// "org.ekrich" %%% "sconfig" % V.sconfig
// )
// libraryDependencies ++= Seq(Dep.scopt_njvm.value, Dep.sconfig_nojvm.value)
// )
.nativeConfigure(With.native(mode = "fast"))
.nativeConfigure(With.noMiMa)
.nativeSettings(
libraryDependencies ++= Seq(
"com.github.scopt" %%% "scopt" % V.scopt,
"org.ekrich" %%% "sconfig" % V.sconfig
)
libraryDependencies ++= Seq(Dep.scopt_nojvm.value, Dep.sconfig_nojvm.value)
)
val commands: Project = commands_cp.jvm
val commandsNative = riddlLib_cp.native
Expand Down Expand Up @@ -399,12 +396,12 @@ lazy val riddlc_cp: CrossProject = CrossModule("riddlc", "riddlc")(JVM, Native)
.jvmSettings(
coverageExcludedFiles := """<empty>;$anon""",
coverallsTokenFile := Some("/home/reid/.coveralls.yml"),
libraryDependencies ++= Seq(Dep.sconfig)
libraryDependencies += Dep.sconfig
)
.nativeConfigure(With.native(mode = "fast", buildTarget = "application"))
.nativeConfigure(With.noMiMa)
.nativeSettings(
libraryDependencies += "org.ekrich" %%% "sconfig" % V.sconfig
libraryDependencies += Dep.sconfig_nojvm.value
)
val riddlc = riddlc_cp.jvm
val riddlcNative = riddlc_cp.native
Expand Down
42 changes: 39 additions & 3 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sbt.*
import sbt.librarymanagement.ModuleID
import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport.*
import sbt.Keys.libraryDependencies

/** V - Dependency Versions object */

Expand All @@ -10,9 +11,11 @@ object V {
val commons_io = "2.18.0"
val compress = "1.27.1"
val config = "1.4.2"
val dom = "2.8.0"
val fastparse = "3.1.1"
val jgit = "6.5.0"
val lang3 = "3.17.0"
val scala_java_time = "2.6.0"
val scalacheck = "1.18.1"
val scalatest = "3.2.19"
val sconfig = "1.8.1"
Expand All @@ -22,21 +25,54 @@ object V {
}

object Dep {
val airframe_ulid = "org.wvlet.airframe" %% "airframe-ulid" % V.airframe_ulid
val airframe_ulid_nojvm = Def.setting {
"org.wvlet.airframe" %%% "airframe-ulid" % V.airframe_ulid
}

val airframe_json = "org.wvlet.airframe" %% "airframe-json" % V.airframe_json
val compress = "org.apache.commons" % "commons-compress" % V.compress
val commons_io = "commons-io" % "commons-io" % V.commons_io
val fastparse = "com.lihaoyi" %% "fastparse" % V.fastparse
val fastparse_nojvm = Def.setting { "com.lihaoyi" %%% "fastparse" % V.fastparse }
val jacabi_w3c = "com.jcabi" % "jcabi-w3c" % "1.4.0"
val jgit = "org.eclipse.jgit" % "org.eclipse.jgit" % V.jgit
val lang3 = "org.apache.commons" % "commons-lang3" % V.lang3
val sconfig = "org.ekrich" %% "sconfig" % V.sconfig
val sttp = "com.softwaremill.sttp.client3" %% "core" % V.sttp

val scalactic = "org.scalactic" %% "scalactic" % V.scalatest
val scalactic_nojvm = Def.setting { "org.scalactic" %%% "scalactic" % V.scalatest }

val scalatest = "org.scalatest" %% "scalatest" % V.scalatest
val scalatest_nojvm = Def.setting { "org.scalatest" %%% "scalatest" % V.scalatest }

val scalacheck = "org.scalacheck" %% "scalacheck" % V.scalacheck
val scalacheck_nojvm = Def.setting { "org.scalacheck" %%% "scalacheck" % V.scalacheck }

val scalajs_stubs = "org.scala-js" %% "scalajs-stubs" % "1.1.0" % "provided"

val sconfig = "org.ekrich" %% "sconfig" % V.sconfig
val sconfig_nojvm = Def.setting { "org.ekrich" %%% "sconfig" % V.sconfig }

val scopt = "com.github.scopt" %% "scopt" % V.scopt
val scopt_nojvm = Def.setting { "com.github.scopt" %%% "scopt" % V.scopt }

val sttp = "com.softwaremill.sttp.client3" %% "core" % V.sttp
val sttp_nojvm = Def.setting { "com.softwaremill.sttp.client4" %%% "core" % V.sttp }

val slf4j = "org.slf4j" % "slf4j-nop" % V.slf4j

val testing: Seq[ModuleID] = Seq(scalactic % "test", scalatest % "test", scalacheck % "test")
val testing: Seq[ModuleID] = Seq(scalactic % Test, scalatest % Test, scalacheck % Test)
val testKitDeps: Seq[ModuleID] = Seq(scalactic, scalatest, scalacheck)

// JS dependencies
val dom = Def.setting { "org.scala-js" %%% "scalajs-dom" % V.dom }
val scala_java_time = Def.setting {
"io.github.cquiroz" %%% "scala-java-time" % V.scala_java_time
}

// Native dependencies
val java_net_url_stubs = Def.setting {
"org.scala-native" %%% "java-net-url-stubs" % "1.0.0"
}

}

0 comments on commit 4bd7867

Please sign in to comment.