Created
November 21, 2013 13:00
-
-
Save Timshel/7581175 to your computer and use it in GitHub Desktop.
Play221 with scalariform formatting before compilation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Control the activation of the scalariform plugin (default false). | |
application.scalariform.enable=true | |
# Path to the configuration properties : | |
#application.scalariform.config.path="conf/scalariform.properties" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name := "play221" | |
version := "1.0-SNAPSHOT" | |
libraryDependencies ++= Seq( | |
jdbc, | |
anorm, | |
cache | |
) | |
play.Project.playScalaSettings ++ scalariformConf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sbt._ | |
import Keys._ | |
import com.typesafe.config._ | |
object ApplicationBuild extends Build { | |
val conf = ConfigFactory.parseFile(new File("conf/application.conf")).resolve() | |
lazy val scalariformConf: Seq[Setting[_]] = { | |
import scala.util.control.Exception._ | |
val useScalariform = (catching(classOf[ConfigException]) opt conf.getBoolean("application.scalariform.enable")).getOrElse(false) | |
if( useScalariform ){ | |
import com.typesafe.sbt.SbtScalariform.ScalariformKeys | |
import scalariform.formatter.preferences._ | |
val confPath = ( catching(classOf[ConfigException]) opt | |
conf.getString("application.scalariform.config.path") ).getOrElse("conf/scalariform.properties") | |
val formattingPreferences = PreferencesImporterExporter.loadPreferences(confPath) | |
com.typesafe.sbt.SbtScalariform.scalariformSettings ++ Seq( ScalariformKeys.preferences := formattingPreferences ) | |
} else { Nil } | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Comment to get more information during initialization | |
logLevel := Level.Warn | |
// The Typesafe repository | |
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" | |
// Scalariform formatting | |
addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.2.1") | |
// Use the Play sbt plugin for Play projects | |
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.1") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alignSingleLineCaseStatements=true | |
compactControlReadability=true | |
compactStringConcatenation=true | |
doubleIndentClassDeclaration=true | |
formatXml=true | |
indentLocalDefs=true | |
indentPackageBlocks=true | |
indentSpaces=2 | |
multilineScaladocCommentsStartOnFirstLine=true | |
preserveSpaceBeforeArguments=false | |
preserveDanglingCloseParenthesis=false | |
rewriteArrowSymbols=false | |
spaceBeforeColon=false | |
spaceInsideBrackets=false | |
spacesWithinPatternBinders=true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment