aboutsummaryrefslogtreecommitdiff
path: root/examples/scalafmt-example/build
diff options
context:
space:
mode:
authorrockjam <rockjam@actor.im>2016-10-02 19:34:10 +0300
committerrockjam <rockjam@actor.im>2016-10-02 23:56:34 +0300
commitaea470195de6cb8f0111e5908917d64889f3c753 (patch)
tree18d537835d16e08afb23706b8546045da4da9f9f /examples/scalafmt-example/build
parent3e35d0809240a3379dd3d71d42655e00b9cff421 (diff)
downloadcbt-aea470195de6cb8f0111e5908917d64889f3c753.tar.gz
cbt-aea470195de6cb8f0111e5908917d64889f3c753.tar.bz2
cbt-aea470195de6cb8f0111e5908917d64889f3c753.zip
upgrade scalafmt 0.3.1 -> 0.4.2; load scalafmt config from config file
Diffstat (limited to 'examples/scalafmt-example/build')
-rw-r--r--examples/scalafmt-example/build/build.scala9
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/scalafmt-example/build/build.scala b/examples/scalafmt-example/build/build.scala
index b8a819b..4f5545e 100644
--- a/examples/scalafmt-example/build/build.scala
+++ b/examples/scalafmt-example/build/build.scala
@@ -1,5 +1,4 @@
import cbt._
-import org.scalafmt.ScalafmtStyle
class Build(val context: Context) extends BaseBuild with Scalafmt {
override def compile = {
@@ -7,8 +6,6 @@ class Build(val context: Context) extends BaseBuild with Scalafmt {
super.compile
}
- override def scalafmtConfig: ScalafmtStyle = ScalafmtStyle.defaultWithAlign
-
def breakFormatting = {
import java.nio.file._
import java.nio.charset.Charset
@@ -17,7 +14,11 @@ class Build(val context: Context) extends BaseBuild with Scalafmt {
sourceFiles foreach { file =>
val path = file.toPath
val fileLines = Files.readAllLines(path, utf8).asScala
- val brokenLines = fileLines map (_.dropWhile(_ == ' '))
+ val brokenLines = fileLines map (l =>
+ l.dropWhile(_ == ' ')
+ .replaceAll("⇒", "=>")
+ .replaceAll("→", "->")
+ )
Files.write(path, brokenLines.asJava, utf8)
}
System.err.println("Done breaking formatting")