diff --git a/build.sbt b/build.sbt index b48d30a..06b1e26 100644 --- a/build.sbt +++ b/build.sbt @@ -8,6 +8,9 @@ ThisBuild / organization := "com.alejandrohdezma" */ ThisBuild / scalafixDependencies := ScalafixWithDefaultsPlugin.scalafixDefaultRules +ThisBuild / scalafixConfigLocation := "https://github.com/alejandrohdezma/sbt-fix-defaults/releases/download/v0.0.6/default.scalafix.conf" +ThisBuild / scalafmtConfigLocation := "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") diff --git a/docs/README.md b/docs/README.md index 03920dc..6ebc712 100644 --- a/docs/README.md +++ b/docs/README.md @@ -19,11 +19,11 @@ All included plugins are automatically activated, so you don't have to do anythi ### Download scalafix/scalafmt configuration from the cloud -One of the main reasons of this plugin is to keep scalafix/scalafmt configurations synchronized across projects. To do so, both configurations are automatically downloaded from a remote location. By default both configurations are downloaded from [alejandrohdezma/sbt-fix-defaults](https://github.com/alejandrohdezma/sbt-fix-defaults). +One of the main reasons of this plugin is to keep scalafix/scalafmt configurations synchronized across projects. To do so, both configurations are automatically downloaded from a remote location. #### Edit configuration location -To download configurations from a different location, edit `scalafixConfigLocation` and `scalafmtConfigLocation` to a valid url: +Edit `scalafixConfigLocation` and `scalafmtConfigLocation` to a valid url: ```sbt scalafixConfigLocation := "your-url" diff --git a/sbt-fix/src/main/scala/com/alejandrohdezma/sbt/fix/Defaults.scala b/sbt-fix/src/main/scala/com/alejandrohdezma/sbt/fix/Defaults.scala deleted file mode 100644 index 0832f52..0000000 --- a/sbt-fix/src/main/scala/com/alejandrohdezma/sbt/fix/Defaults.scala +++ /dev/null @@ -1,34 +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 - -/** Contains defaults URLs for scalafix/scalafmt config files */ -object Defaults { - - /** - * Don't change this value. It's automatically updated - * from `sbt-fix-defaults` releases. - */ - private val version = "v0.0.7" - - val scalafix: String = - s"https://github.com/alejandrohdezma/sbt-fix-defaults/releases/download/$version/default.scalafix.conf" - - val scalafmt: String = - s"https://github.com/alejandrohdezma/sbt-fix-defaults/releases/download/$version/default.scalafmt.conf" - -} diff --git a/sbt-fix/src/main/scala/com/alejandrohdezma/sbt/fix/ScalafixWithDefaultsPlugin.scala b/sbt-fix/src/main/scala/com/alejandrohdezma/sbt/fix/ScalafixWithDefaultsPlugin.scala index 8ead3b6..1e97914 100644 --- a/sbt-fix/src/main/scala/com/alejandrohdezma/sbt/fix/ScalafixWithDefaultsPlugin.scala +++ b/sbt-fix/src/main/scala/com/alejandrohdezma/sbt/fix/ScalafixWithDefaultsPlugin.scala @@ -17,7 +17,7 @@ package com.alejandrohdezma.sbt.fix import sbt.Keys._ -import sbt.{Command, Def, addCompilerPlugin, _} +import sbt._ import scalafix.sbt.ScalafixPlugin import scalafix.sbt.ScalafixPlugin.autoImport._ @@ -36,7 +36,7 @@ object ScalafixWithDefaultsPlugin extends AutoPlugin { object autoImport { lazy val scalafixConfigLocation: SettingKey[String] = settingKey[String] { - s"Location of the remote scalafix config. Defaults to ${Defaults.scalafix}" + s"Location of the remote scalafix config" } lazy val scalafixExtraConfig: SettingKey[File] = settingKey[File] { @@ -55,7 +55,6 @@ object ScalafixWithDefaultsPlugin extends AutoPlugin { override def buildSettings: Seq[Setting[_]] = Seq( scalafixExtraConfig := file(".scalafix-extra.conf"), scalafixConfig := scalafixDownloadConfig.value, - scalafixConfigLocation := Defaults.scalafix, scalacOptions += "-P:semanticdb:synthetics:on", scalafixDependencies in ThisBuild ++= scalafixDefaultRules, addCompilerPlugin(scalafixSemanticdb) diff --git a/sbt-fix/src/main/scala/com/alejandrohdezma/sbt/fix/ScalafmtWithDefaultsPlugin.scala b/sbt-fix/src/main/scala/com/alejandrohdezma/sbt/fix/ScalafmtWithDefaultsPlugin.scala index b830645..a9fd940 100644 --- a/sbt-fix/src/main/scala/com/alejandrohdezma/sbt/fix/ScalafmtWithDefaultsPlugin.scala +++ b/sbt-fix/src/main/scala/com/alejandrohdezma/sbt/fix/ScalafmtWithDefaultsPlugin.scala @@ -31,7 +31,7 @@ object ScalafmtWithDefaultsPlugin extends AutoPlugin { object autoImport { lazy val scalafmtConfigLocation: SettingKey[String] = settingKey[String] { - s"Location of the remote scalafmt config. Defaults to ${Defaults.scalafmt}" + s"Location of the remote scalafmt config" } lazy val scalafmtExtraConfig: SettingKey[File] = settingKey[File] { @@ -49,9 +49,8 @@ object ScalafmtWithDefaultsPlugin extends AutoPlugin { override def buildSettings: Seq[Setting[_]] = Seq( - scalafmtConfigLocation := Defaults.scalafmt, - scalafmtExtraConfig := file(".scalafmt-extra.conf"), - scalafmtConfig := scalafmtDownloadConfig.value + scalafmtExtraConfig := file(".scalafmt-extra.conf"), + scalafmtConfig := scalafmtDownloadConfig.value ) private lazy val scalafmtDownloadConfig: Def.Initialize[Task[File]] = Def.task {