diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2017-03-27 19:27:48 -0400 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2017-03-28 09:39:08 -0400 |
commit | c9be8fe67010094d21505ca05ab1363a5abba06d (patch) | |
tree | 2eccb4a4ff43d8e8c7d58ff33daeeb9a04dc8b4d /plugins/scalafix-compiler-plugin | |
parent | c0e956df1e4c466f5c80282f1086b0589959ce2e (diff) | |
download | cbt-c9be8fe67010094d21505ca05ab1363a5abba06d.tar.gz cbt-c9be8fe67010094d21505ca05ab1363a5abba06d.tar.bz2 cbt-c9be8fe67010094d21505ca05ab1363a5abba06d.zip |
rename Scalafix plugin in perparation for mirror based one
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" ) + ) + ) +} |