|
| 1 | +import _root_.scalafix.sbt.{BuildInfo => Versions} |
| 2 | + |
| 3 | +inThisBuild( |
| 4 | + List( |
| 5 | + scalafixDependencies := List( |
| 6 | + // CollectHead |
| 7 | + "com.github.xuwei-k" %% "scalafix-rules" % "0.6.5" |
| 8 | + ), |
| 9 | + resolvers += Resolver.sonatypeRepo("snapshots"), |
| 10 | + // out of sync with scalafix.sbt.BuildInfo.scala213 on purpose |
| 11 | + scalaVersion := "2.13.11", |
| 12 | + Compat.allowUnsafeScalaLibUpgrade := true |
| 13 | + ) |
| 14 | +) |
| 15 | + |
| 16 | +// LocalSyntacticRule |
| 17 | +val rules = project |
| 18 | + .disablePlugins(ScalafixPlugin) |
| 19 | + .settings( |
| 20 | + libraryDependencies += |
| 21 | + ("ch.epfl.scala" %% "scalafix-core" % Versions.scalafixVersion) |
| 22 | + .cross(CrossVersion.for3Use2_13), |
| 23 | + libraryDependencies += "joda-time" % "joda-time" % "2.10.6" |
| 24 | + ) |
| 25 | + |
| 26 | +val service = project |
| 27 | + .dependsOn(rules % ScalafixConfig) |
| 28 | + .settings( |
| 29 | + // SyntacticRule |
| 30 | + libraryDependencies += |
| 31 | + ("ch.epfl.scala" %% "example-scalafix-rule" % "3.0.0") |
| 32 | + .cross(CrossVersion.for3Use2_13) % ScalafixConfig |
| 33 | + ) |
| 34 | + |
| 35 | +// SameProjectSyntacticRule |
| 36 | +val sameproject = project |
| 37 | + .settings( |
| 38 | + libraryDependencies += |
| 39 | + ("ch.epfl.scala" %% "scalafix-core" % Versions.scalafixVersion) |
| 40 | + .cross(CrossVersion.for3Use2_13) % ScalafixConfig, |
| 41 | + // Since sbt 1.10.x (https://github.com/sbt/sbt/pull/7480), scala3-library is not automatically added |
| 42 | + // to non-standard configurations, but is needed by the Scala 3 compiler, so it must be added explicitly |
| 43 | + // if no dependency brings it implicitly, which is the case here because the only dependency is for3Use2_13. |
| 44 | + libraryDependencies ++= { |
| 45 | + if (scalaBinaryVersion.value == "3") |
| 46 | + Seq( |
| 47 | + "org.scala-lang" %% "scala3-library" % scalaVersion.value % ScalafixConfig |
| 48 | + ) |
| 49 | + else |
| 50 | + Nil |
| 51 | + } |
| 52 | + ) |
0 commit comments