Skip to content

Commit

Permalink
Added Logging to MojoFormatter.
Browse files Browse the repository at this point in the history
Fixed reveresed scalariform paramter bug.
  • Loading branch information
jadamcrain authored and Matt committed Jan 14, 2011
1 parent 7769927 commit 33e9c11
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class ScalariformMojo extends AbstractMojo {

public void execute() throws MojoExecutionException {

MojoFormatter.format(baseDir,
MojoFormatter.format(baseDir, this.getLog(),
alignParameters,
compactStringConcatenation,
doubleIndentClassDeclaration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import scala.collection.JavaConversions._

import scala.io.Source

import org.apache.maven.plugin.logging.Log

/**
* Goal which formats scala source files
*
Expand Down Expand Up @@ -38,10 +40,11 @@ object MojoFormatter {
findScalaFilesByFile(new File(dirpath), Nil)
}

def format(path : String,
def format(path : String,
log : Log,
alignParameters : Boolean,
doubleIndentClassDeclaration : Boolean,
compactStringConcatenation : Boolean,
doubleIndentClassDeclaration : Boolean,
preserveSpaceBeforeArguments : Boolean,
rewriteArrowSymbols : Boolean,
spaceBeforeColon : Boolean,
Expand All @@ -55,8 +58,12 @@ object MojoFormatter {
.setPreference(RewriteArrowSymbols, rewriteArrowSymbols)
.setPreference(SpaceBeforeColon, spaceBeforeColon)
.setPreference(IndentSpaces, indentSpaces)

val files = findScalaFiles(path)

log.info("Formatting " + files.size + " scala files")

findScalaFiles(path).foreach { file =>
files.foreach { file =>
val original = Source.fromFile(file).mkString
writeText(file, ScalaFormatter.format(original, preferences))
}
Expand Down

0 comments on commit 33e9c11

Please sign in to comment.