diff --git a/build.sbt b/build.sbt index 80dc438..4147b8e 100644 --- a/build.sbt +++ b/build.sbt @@ -13,7 +13,6 @@ ThisBuild / scalafixConfigLocation := url { ThisBuild / scalafmtConfigLocation := url { "https://github.com/alejandrohdezma/sbt-fix-defaults/releases/download/v0.0.6/default.scalafmt.conf" } - Global / onChangedBuildSource := ReloadOnSourceChanges addCommandAlias("ci-test", "fix --check; docs/mdoc") @@ -31,8 +30,3 @@ lazy val `sbt-fix` = project .enablePlugins(SbtPlugin) .settings(addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.12")) .settings(addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.3.2")) - -lazy val `sbt-fix-it` = project - .dependsOn(`sbt-fix`) - .enablePlugins(SbtPlugin) - .settings(description := "Enables scalafix/scalafmt settings in it configuration") diff --git a/docs/README.md b/docs/README.md index a35a15b..65aac30 100644 --- a/docs/README.md +++ b/docs/README.md @@ -83,24 +83,6 @@ fix --check Which can be used in CI to check formatting easily. -## Integration tests - -If you normally use the configuration for integration tests that SBT provides you can use `sbt-fix-it` (instead of `sbt-fix`). Add the following line to your `plugins.sbt` file: - -```sbt -addSbtPlugin("com.alejandrohdezma" %% "sbt-fix-it" % "@VERSION@") -``` - -This plugin contains all the extras and settings of the `sbt-fix` as well as automatically activating the `IntegrationTest` configuration and its default settings (as described in the [SBT documentation](https://www.scala-sbt.org/1.x/docs/Testing.html#Integration+Tests)) and adds the [scalafix](https://scalacenter.github.io/scalafix/docs/users/installation.html#integration-tests) and [scalafmt](https://scalameta.org/scalafmt/docs/installation.html#enable-integrationtest) settings for this configuration. - -```diff -lazy val `my-project` = project -- .configs(IntegrationTest) -- .settings(inConfig(IntegrationTest)(Defaults.testSettings)) -- .settings(inConfig(IntegrationTest)(scalafixConfigSettings(IntegrationTest))) -- .settings(inConfig(IntegrationTest)(org.scalafmt.sbt.ScalafmtPlugin.scalafmtConfigSettings)) -``` - [github-action]: https://github.com/alejandrohdezma/sbt-fix/actions [github-action-badge]: https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Falejandrohdezma%2Fsbt-fix%2Fbadge%3Fref%3Dmaster&style=flat diff --git a/project/dependencies.sbt b/project/dependencies.sbt index cc95510..d417842 100644 --- a/project/dependencies.sbt +++ b/project/dependencies.sbt @@ -1,3 +1,3 @@ -// For using the plugins in their own build +// For using the plugin in its own build unmanagedSourceDirectories in Compile += baseDirectory.in(ThisBuild).value.getParentFile / "sbt-fix" / "src" / "main" / "scala" diff --git a/sbt-fix-it/src/main/scala/com/alejandrohdezma/sbt/fix/it/EnableIntegrationTestPlugin.scala b/sbt-fix-it/src/main/scala/com/alejandrohdezma/sbt/fix/it/EnableIntegrationTestPlugin.scala deleted file mode 100644 index aa630f4..0000000 --- a/sbt-fix-it/src/main/scala/com/alejandrohdezma/sbt/fix/it/EnableIntegrationTestPlugin.scala +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2019-2020 Alejandro Hernández - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.alejandrohdezma.sbt.fix.it - -import sbt.PluginTrigger -import sbt.Plugins -import sbt._ -import sbt.librarymanagement.Configuration - -import org.scalafmt.sbt.ScalafmtPlugin -import org.scalafmt.sbt.ScalafmtPlugin.scalafmtConfigSettings -import scalafix.sbt.ScalafixPlugin -import scalafix.sbt.ScalafixPlugin.autoImport.scalafixConfigSettings - -/** - * This plugin activates the `IntegrationTest` configuration by - * default in all projects and adds the scalafix/scalafmt - * settings for the `it` configuration. - * - * If this is not the desired outcome for a certain project add: - * - * {{{ - * .disablePlugins(EnableIntegrationTestPlugin) - * }}} - */ -object EnableIntegrationTestPlugin extends AutoPlugin { - - override def trigger: PluginTrigger = allRequirements - - override def requires: Plugins = ScalafmtPlugin && ScalafixPlugin - - override def projectConfigurations: Seq[Configuration] = Seq(IntegrationTest) - - override def projectSettings: Seq[Def.Setting[_]] = inConfig(IntegrationTest) { - Defaults.testSettings ++ scalafixConfigSettings(IntegrationTest) ++ scalafmtConfigSettings - } - -}