Last active
August 9, 2019 03:29
-
-
Save xuwei-k/a5393b3bce3d139de9f7d2321e032e03 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/xuwei-k/replace-symbol-literals | |
{ | |
val Scalafix = "Scalafix" | |
val removeCommand = "removeTemporaryScalafix" | |
def tempPluginDotSbtFile (base: File) = | |
base / "project" / ("temporaryScalafix.sbt") | |
Seq( | |
TaskKey[Unit](removeCommand) := { | |
val f = tempPluginDotSbtFile((baseDirectory in LocalRootProject).value) | |
IO.delete(f) | |
}, | |
commands += Command.command("ReplaceSymbolLiterals") { state => | |
val extracted = Project.extract(state) | |
val f = tempPluginDotSbtFile(extracted.get(baseDirectory in LocalRootProject)) | |
IO.write(f, """addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.5")""") | |
List( | |
"reload", | |
"scalafixEnable", | |
"scalafix dependency:ReplaceSymbolLiterals@com.github.xuwei-k:replace-symbol-literals:0.1.1", | |
"test:scalafix dependency:ReplaceSymbolLiterals@com.github.xuwei-k:replace-symbol-literals:0.1.1", | |
removeCommand, | |
"reload" | |
) ::: state | |
} | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment