diff options
author | Nikolay Tatarinov <5min4eq.unity@gmail.com> | 2016-06-24 02:48:45 +0300 |
---|---|---|
committer | Jan Christopher Vogt <oss.nsp@cvogt.org> | 2016-06-23 19:48:45 -0400 |
commit | 2cbc42fd0809b60b1ee2116657d18b3f44f8aef1 (patch) | |
tree | e894a040137e591c4a7664b7353d709298a44f65 /examples/scalariform-example/build | |
parent | 75c32537cd8f29f9d12db37bf06ad942806f0239 (diff) | |
download | cbt-2cbc42fd0809b60b1ee2116657d18b3f44f8aef1.tar.gz cbt-2cbc42fd0809b60b1ee2116657d18b3f44f8aef1.tar.bz2 cbt-2cbc42fd0809b60b1ee2116657d18b3f44f8aef1.zip |
Scalafmt plugin implementation (#156)
* scalariform: improve logging, declare tasks final
* scalafmt plugin implementation
* add scalafmt and scalariform plugins and examples to tests
* fix logging guarded logging behaviour
* add notes about formatting check to README
* fix compilation error in examples
Diffstat (limited to 'examples/scalariform-example/build')
-rw-r--r-- | examples/scalariform-example/build/build.scala | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/scalariform-example/build/build.scala b/examples/scalariform-example/build/build.scala index b9caa59..5f7b7ff 100644 --- a/examples/scalariform-example/build/build.scala +++ b/examples/scalariform-example/build/build.scala @@ -1,7 +1,7 @@ import cbt._ import scalariform.formatter.preferences._ -class Build(val context: Context) extends BuildBuild with Scalariform { +class Build(val context: Context) extends BaseBuild with Scalariform { override def compile = { scalariformFormat super.compile @@ -13,15 +13,17 @@ class Build(val context: Context) extends BuildBuild with Scalariform { .setPreference(DoubleIndentClassDeclaration, true) .setPreference(RewriteArrowSymbols, true) - def breakFormatting = { + final def breakFormatting = { import java.nio.file._ + import java.nio.charset.Charset import scala.collection.JavaConverters._ + val utf8 = Charset.forName("UTF-8") sourceFiles foreach { file => try { val path = file.toPath - val fileLines = Files.readAllLines(path).asScala + val fileLines = Files.readAllLines(path, utf8).asScala val brokenLines = fileLines map (_.dropWhile(_ ==' ')) - Files.write(path, brokenLines.asJava) + Files.write(path, brokenLines.asJava, utf8) } catch { case e: Exception => System.err.print(s"Error happend when breaking formatting: ${e}") } |