v0.5.0
tl;dr;
Synchronization of configuration has been removed. To enable similar functionality to previous versions add the following to your plugins.sbt
:
// This plugin no longer forces a version of Scalafmt/Scalafix
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.12")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.3.2")
addSbtPlugin("com.alejandrohdezma" % "sbt-fix" % "0.5.0")
// https://github.com/alejandrohdezma/sbt-scalafix-defaults
addSbtPlugin("com.alejandrohdezma" % "sbt-scalafix-defaults" % "0.1.0")
// https://github.com/alejandrohdezma/sbt-scalafmt-defaults
addSbtPlugin("com.alejandrohdezma" % "sbt-scalafmt-defaults" % "0.1.0")
If you were using extra configurations in your project you can add:
import scala.sys.process._ Global / onLoad := (Global / onLoad).value andThen { state => (file(".scalafmt-extra.conf") #>> file(".scalafmt.conf")).! state }
If you were using this plugin to synchronize your own configuration, you can continue to do so easily by using alejandrohdezma/sbt-scalafix-defaults and alejandrohdezma/sbt-scalafmt-defaults as templates, edit the included configurations at will and publish them under your own domain.
And last but not least sbt-fix-it
has been removed. To obtain that same functionality, please add the following plugin to your project
folder:
object IntegrationTestPlugin extends AutoPlugin {
override def trigger = allRequirements
override def requires = ScalafmtPlugin && ScalafixPlugin
override def projectConfigurations = Seq(IntegrationTest)
override def projectSettings = inConfig(IntegrationTest) {
testSettings ++ scalafixConfigSettings(IntegrationTest) ++ scalafmtConfigSettings
}
}
What's changed
The configuration-synchronization part of the plugin has become obsolete with alejandrohdezma/sbt-scalafix-defaults and alejandrohdezma/sbt-scalafmt-defaults.
These new plugins can be used to automatically include scalafmt & scalafix configuration files on any build and are auto-upgradable by using scala-steward. Also, they're written to be extremely easy to use as a template repository, so anyone out there can create their version to use across their repositories.
In addition, since there is no longer any synchronization, there is also no possibility of using .*-extra.conf
files but it can be easily obtained by adding the following piece of code to your build.sbt
:
import scala.sys.process._
Global / onLoad := (Global / onLoad).value andThen { state =>
(file(".scalafmt-extra.conf") #>> file(".scalafmt.conf")).!
state
}
Also sbt-fix-it
has been removed. It was only useful for projects using both tools that also use the IntegrationTest
configuration.
The same goal can be met by adding the following AutoPlugin
to your project
folder:
object IntegrationTestPlugin extends AutoPlugin {
override def trigger = allRequirements
override def requires = ScalafmtPlugin && ScalafixPlugin
override def projectConfigurations = Seq(IntegrationTest)
override def projectSettings = inConfig(IntegrationTest) {
testSettings ++ scalafixConfigSettings(IntegrationTest) ++ scalafmtConfigSettings
}
}
Finally, dependencies with scalafix and scalafmt have been set as Provided
so you'll need to provide your own version of these plugins in your plugins.sbt
:
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.12")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.3.2")
⚠️ Breaking changes
- Set scalafix & scalafmt dependencies as
Provided
(#107) @alejandrohdezma - Remove configuration synchronisation code (#100) @alejandrohdezma
- Remove
sbt-fix-it
module (#97) @alejandrohdezma scalafixDependencies
should be added by config providers (#91) @alejandrohdezma- Remove default values from
sbt-fix
(#80) @alejandrohdezma
🚀 Features
- Enable calling
fix --check
usingfix -c
(#105) @alejandrohdezma - Add
scalafixEnable
before callingscalafix
onfix --check
(#103) @alejandrohdezma
🐛 Bug Fixes
- Avoid publishing
root
project (#93) @alejandrohdezma
📈 Dependency updates
- Update sbt-header to 5.5.0 (#76) @scala-steward
- Update sbt-github-header, sbt-github-mdoc to 0.7.0 (#72) @scala-steward
- Update sbt-mdoc to 2.1.5 (#70) @scala-steward
- Update sbt-scalafix to 0.9.13 (#69) @scala-steward
- Update sbt to 1.3.9 (#65) @scala-steward
- Update scaluzzi to 0.1.5 (#64) @scala-steward
- Update sbt-scalafix to 0.9.12 (#63) @scala-steward
- Update sbt-mdoc to 2.1.3 (#62) @scala-steward
- Update sbt-scalafmt to 2.3.2 (#60) @scala-steward
- Update sbt-github-header, sbt-github-mdoc to 0.6.0 (#57) @scala-steward
- Update scaluzzi to 0.1.4.1 (#53) @scala-steward