Skip to content

Instantly share code, notes, and snippets.

@xuwei-k
Last active August 9, 2019 03:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xuwei-k/a5393b3bce3d139de9f7d2321e032e03 to your computer and use it in GitHub Desktop.
Save xuwei-k/a5393b3bce3d139de9f7d2321e032e03 to your computer and use it in GitHub Desktop.
// 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