diff options
author | Jan Christopher Vogt <oss.nsp@cvogt.org> | 2017-03-28 10:04:06 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-28 10:04:06 -0400 |
commit | 497fff26705be6a21e6099a562ff14bfe1d90003 (patch) | |
tree | 6d75c89f145fc6319ff88316bdcbf97ed6ca4beb /plugins/scalafix-compiler-plugin | |
parent | c0e956df1e4c466f5c80282f1086b0589959ce2e (diff) | |
parent | 26021f5e462fb9a5633a5f565235a2829fb6132b (diff) | |
download | cbt-497fff26705be6a21e6099a562ff14bfe1d90003.tar.gz cbt-497fff26705be6a21e6099a562ff14bfe1d90003.tar.bz2 cbt-497fff26705be6a21e6099a562ff14bfe1d90003.zip |
Merge pull request #462 from cvogt/meta
scala meta and scalafix
Diffstat (limited to 'plugins/scalafix-compiler-plugin')
-rw-r--r-- | plugins/scalafix-compiler-plugin/Scalafix.scala | 28 | ||||
-rw-r--r-- | plugins/scalafix-compiler-plugin/build/build.scala | 12 |
2 files changed, 40 insertions, 0 deletions
diff --git a/plugins/scalafix-compiler-plugin/Scalafix.scala b/plugins/scalafix-compiler-plugin/Scalafix.scala new file mode 100644 index 0000000..2a18c5d --- /dev/null +++ b/plugins/scalafix-compiler-plugin/Scalafix.scala @@ -0,0 +1,28 @@ +package cbt + +import cbt._ +import java.nio.file.Files._ +import java.nio.file._ +import java.io.File + +trait ScalafixCompilerPlugin extends BaseBuild { + def scalafixVersion = "0.3.1" + + override def scalacOptions = super.scalacOptions ++ + Scalafix.scalacOptions(projectDirectory.toPath, + Resolver( mavenCentral, sonatypeReleases ).bindOne( + ScalaDependency( "ch.epfl.scala", "scalafix-nsc", scalafixVersion ) + ).jar) +} + +object Scalafix { + def scalacOptions( rootPath: Path, nscJar: File ) = + Seq( + "-Xplugin:" ++ nscJar.string, + "-Yrangepos" + ) ++ configOption(rootPath) + + def configOption( rootPath: Path ) = + Some( rootPath.resolve(".scalafix.conf").toAbsolutePath ) + .filter(isRegularFile(_)).map("-P:scalafix:" ++ _.toString).toSeq +} diff --git a/plugins/scalafix-compiler-plugin/build/build.scala b/plugins/scalafix-compiler-plugin/build/build.scala new file mode 100644 index 0000000..b25b54d --- /dev/null +++ b/plugins/scalafix-compiler-plugin/build/build.scala @@ -0,0 +1,12 @@ +package scalafix_build + +import cbt._ + +class Build(val context: Context) extends Plugin { + override def dependencies = ( + super.dependencies ++ + Resolver( mavenCentral, sonatypeReleases ).bind( + ScalaDependency( "ch.epfl.scala", "scalafix-nsc", "0.3.1" ) + ) + ) +} |