Skip to content

v0.5.0

Compare
Choose a tag to compare
@alejandrohdezma alejandrohdezma released this 15 Apr 19:31
dfea792

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

🚀 Features

🐛 Bug Fixes

📈 Dependency updates

Contributors to this release

@alejandrohdezma