Skip to content

Commit

Permalink
chore: inception
Browse files Browse the repository at this point in the history
Motivation:
We don't want to duplicate the list of plugins dependencies or the
dependencies override

Modifications:
 * Use the meta-build pattern to be able to use same sbt source for different
level

Result:
Only one list of dependencies to manage
  • Loading branch information
Isammoc authored and slandelle committed Dec 13, 2023
1 parent 35762ed commit 481b875
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 28 deletions.
15 changes: 1 addition & 14 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,6 @@ lazy val root = (project in file("."))
// ------------------ //
// -- DEPENDENCIES -- //
// ------------------ //
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2"),
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.1"),
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0"),
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1"),
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0"),
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.10.0"),
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.0.1"),
PluginDependencies.deps,
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.17" % Test
)

ThisBuild / dependencyOverrides ++= Seq(
"org.eclipse.jgit" % "org.eclipse.jgit" % "6.8.0.202311291450-r", // sbt-scalafix
"ch.qos.logback" % "logback-core" % "1.4.7", // sbt-sonatype
"com.google.guava" % "guava" % "23.0", // sbt-sonatype
"org.apache.httpcomponents" % "httpclient" % "4.5.14" // sbt-sonatype
)
16 changes: 2 additions & 14 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
// ------------------ //
// -- DEPENDENCIES -- //
// ------------------ //
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.1")

addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.10.0")
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.0.1")
PluginDependencies.deps

// This project is its own plugin :)
Compile / unmanagedSourceDirectories += baseDirectory.value.getParentFile / "src" / "main" / "scala"
Compile / unmanagedResourceDirectories += baseDirectory.value.getParentFile / "src" / "main" / "resources"

dependencyOverrides ++= Seq(
"org.eclipse.jgit" % "org.eclipse.jgit" % "6.8.0.202311291450-r", // sbt-scalafix
"ch.qos.logback" % "logback-core" % "1.4.7", // sbt-sonatype
"com.google.guava" % "guava" % "23.0", // sbt-sonatype
"org.apache.httpcomponents" % "httpclient" % "4.5.14" // sbt-sonatype
)
Compile / unmanagedSources += baseDirectory.value / "project" / "PluginDependencies.scala"
23 changes: 23 additions & 0 deletions project/project/PluginDependencies.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import sbt.*
import sbt.Keys.*

object PluginDependencies {
val deps = Seq(
// ------------------ //
// -- DEPENDENCIES -- //
// ------------------ //
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2"),
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.1"),
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0"),
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1"),
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0"),
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.10.0"),
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.0.1"),
dependencyOverrides ++= Seq(
"org.eclipse.jgit" % "org.eclipse.jgit" % "6.8.0.202311291450-r", // sbt-scalafix
"ch.qos.logback" % "logback-core" % "1.4.7", // sbt-sonatype
"com.google.guava" % "guava" % "23.0", // sbt-sonatype
"org.apache.httpcomponents" % "httpclient" % "4.5.14" // sbt-sonatype
)
)
}

0 comments on commit 481b875

Please sign in to comment.