blob: 5f7b7ffee6de9b606f42057088a28fe7899a1c5b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
import cbt._
import scalariform.formatter.preferences._
class Build(val context: Context) extends BaseBuild with Scalariform {
override def compile = {
scalariformFormat
super.compile
}
override def scalariformPreferences =
FormattingPreferences()
.setPreference(SpacesAroundMultiImports, true)
.setPreference(DoubleIndentClassDeclaration, true)
.setPreference(RewriteArrowSymbols, true)
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, utf8).asScala
val brokenLines = fileLines map (_.dropWhile(_ ==' '))
Files.write(path, brokenLines.asJava, utf8)
} catch {
case e: Exception => System.err.print(s"Error happend when breaking formatting: ${e}")
}
}
System.err.println("Done breaking formatting")
}
}
|