本文整理汇总了Scala中com.typesafe.sbt.SbtScalariform.ScalariformKeys类的典型用法代码示例。如果您正苦于以下问题:Scala ScalariformKeys类的具体用法?Scala ScalariformKeys怎么用?Scala ScalariformKeys使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ScalariformKeys类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: Formatting
//设置package包名称以及导入依赖的类
package lobola
import sbt._
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
object Formatting {
lazy val formatSettings = Seq(
ScalariformKeys.preferences in Compile := formattingPreferences.value,
ScalariformKeys.preferences in Test := formattingPreferences.value
)
def formattingPreferences = Def.setting {
import scalariform.formatter.preferences._
ScalariformKeys.preferences.value
.setPreference(RewriteArrowSymbols, true)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DanglingCloseParenthesis, Preserve)
.setPreference(DoubleIndentClassDeclaration, false)
}
}
示例2: ScalariformSettings
//设置package包名称以及导入依赖的类
package it.trenzalore.build.settings
import com.typesafe.sbt.SbtScalariform.{ ScalariformKeys, _ }
import sbt.ThisBuild
import scalariform.formatter.preferences._
object ScalariformSettings {
lazy val scalariformPluginSettings = scalariformSettings ++ Seq(
ScalariformKeys.preferences in ThisBuild := ScalariformKeys.preferences.value
.setPreference(RewriteArrowSymbols, true)
.setPreference(IndentSpaces, 2)
.setPreference(SpaceBeforeColon, false)
.setPreference(CompactStringConcatenation, false)
.setPreference(PreserveSpaceBeforeArguments, false)
.setPreference(AlignParameters, true)
.setPreference(AlignArguments, false)
.setPreference(DoubleIndentClassDeclaration, false)
.setPreference(FormatXml, true)
.setPreference(IndentPackageBlocks, true)
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(IndentLocalDefs, false)
.setPreference(DanglingCloseParenthesis, Force)
.setPreference(SpaceInsideParentheses, false)
.setPreference(SpaceInsideBrackets, false)
.setPreference(SpacesWithinPatternBinders, true)
.setPreference(MultilineScaladocCommentsStartOnFirstLine, true)
.setPreference(IndentWithTabs, false)
.setPreference(CompactControlReadability, false)
.setPreference(PlaceScaladocAsterisksBeneathSecondAsterisk, true)
.setPreference(SpacesAroundMultiImports, true)
)
}
示例3: Shared
//设置package包名称以及导入依赖的类
import Dependencies.SharedDependencies
//import com.sksamuel.scapegoat.sbt.ScapegoatSbtPlugin.autoImport._
import com.typesafe.sbt.SbtScalariform.{ScalariformKeys, scalariformSettings}
import net.virtualvoid.sbt.graph.DependencyGraphSettings.graphSettings
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import sbt.Keys._
import sbt._
import webscalajs.ScalaJSWeb
object Shared {
val projectId = "realworld-starter-kit"
val projectName = "realworld-starter-kit"
lazy val commonSettings = Seq(
version := Shared.Versions.app,
scalaVersion := Shared.Versions.scala,
organization := "",
scalacOptions ++= Seq(
"-encoding", "UTF-8", "-feature", "-deprecation", "-unchecked", "–Xcheck-null" JsonSerializers.scala"),
ScalariformKeys.preferences := ScalariformKeys.preferences.value
) ++ graphSettings ++ scalariformSettings
object Versions {
val app = "0.1"
val scala = "2.11.11"
}
def withProjects(p: Project, includes: Seq[Project]) = includes.foldLeft(p) { (proj, inc) =>
proj.aggregate(inc).dependsOn(inc)
}
lazy val shared = (crossProject.crossType(CrossType.Pure) in file("shared")).settings(commonSettings: _*).settings(
libraryDependencies ++= Seq(
SharedDependencies.macwire,
"com.typesafe.play" %%% "play-json" % SharedDependencies.playJsonVersion
)
)
.jvmSettings(
libraryDependencies ++= Seq(
)
)
.jsSettings(
libraryDependencies ++= Seq(
)
)
.jsConfigure(_ enablePlugins ScalaJSWeb)
lazy val sharedJs = shared.js
lazy val sharedJvm = shared.jvm
}
示例4: Formatting
//设置package包名称以及导入依赖的类
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
import sbt._
import scalariform.formatter.preferences.FormattingPreferences
object Formatting extends AutoPlugin {
override def trigger: PluginTrigger = allRequirements
override def projectSettings: Seq[_root_.sbt.Def.Setting[_]] =
SbtScalariform.scalariformSettings ++ Seq(
ScalariformKeys.preferences in Compile := formattingPreferences,
ScalariformKeys.preferences in Test := formattingPreferences
)
def formattingPreferences: FormattingPreferences = {
import scalariform.formatter.preferences._
FormattingPreferences()
.setPreference(RewriteArrowSymbols, true)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
}
def docFormattingPreferences: FormattingPreferences = {
import scalariform.formatter.preferences._
FormattingPreferences()
.setPreference(RewriteArrowSymbols, false)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
}
}
示例5: Scalariform
//设置package包名称以及导入依赖的类
package org.hammerlab.sbt.plugin
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
import scalariform.formatter.preferences._
object Scalariform
extends Plugin {
object autoImport {
val enableScalariform = (
SbtScalariform.defaultScalariformSettings ++
Seq(
ScalariformKeys.preferences :=
ScalariformKeys.preferences.value
.setPreference(AlignParameters, true)
.setPreference(CompactStringConcatenation, false)
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DoubleIndentClassDeclaration, true)
.setPreference(PreserveDanglingCloseParenthesis, true)
)
)
}
}
示例6: ScalariformSettings
//设置package包名称以及导入依赖的类
import scalariform.formatter.preferences._
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
object ScalariformSettings {
val customScalariformSettings = SbtScalariform.defaultScalariformSettings ++ Seq(
ScalariformKeys.preferences := ScalariformKeys.preferences.value
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DoubleIndentClassDeclaration, true)
.setPreference(CompactControlReadability, true)
.setPreference(MultilineScaladocCommentsStartOnFirstLine, true)
.setPreference(PreserveDanglingCloseParenthesis, true)
.setPreference(PlaceScaladocAsterisksBeneathSecondAsterisk, true)
)
}
示例7: Build
//设置package包名称以及导入依赖的类
import sbt._
import sbt.Keys._
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
object Build extends sbt.Build {
lazy val root = Project("SampleProject", file("."))
.settings(basicSettings: _*)
.settings(libraryDependencies ++= Dependencies.basic)
lazy val basicSettings = Seq(
organization := "your.organization",
version := "0.1.0",
scalaVersion := "2.11.7",
scalacOptions ++= Seq("-unchecked", "-deprecation"),
javacOptions ++= Seq("-source", "1.8", "-target", "1.8"),
resolvers ++= Seq(
"Sonatype OSS Releases" at "https://oss.sonatype.org/content/repositories/releases",
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
"Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases/"))
// scalariform code format settings
SbtScalariform.scalariformSettings // enable scalariformSettings
import scalariform.formatter.preferences._
ScalariformKeys.preferences := ScalariformKeys.preferences.value
.setPreference(RewriteArrowSymbols, false)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DoubleIndentClassDeclaration, true)
.setPreference(IndentSpaces, 2)
}
object Dependencies {
// ---- define dependencies libs
var basic: Seq[ModuleID] = Seq(
"io.spray" %% "spray-can" % "1.3.3" withSources() withJavadoc(),
"io.spray" %% "spray-routing" % "1.3.3" withSources() withJavadoc(),
"io.spray" %% "spray-json" % "1.3.2",
"io.spray" %% "spray-client" % "1.3.3",
"io.spray" %% "spray-testkit" % "1.3.3" % "test",
"com.typesafe.akka" %% "akka-actor" % "2.3.11",
"com.typesafe.akka" %% "akka-remote" % "2.3.11",
"com.typesafe.akka" %% "akka-contrib" % "2.3.11",
"com.typesafe.akka" %% "akka-testkit" % "2.3.11",
"org.scalatest" %% "scalatest" % "2.2.4" % "test",
"commons-io" % "commons-io" % "2.4" % "test",
"org.specs2" %% "specs2-core" % "2.3.11" % "test",
"org.scalaz" %% "scalaz-core" % "7.1.0"
)
}
示例8: Formatting
//设置package包名称以及导入依赖的类
import sbt._
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
object Formatting extends AutoPlugin {
override def trigger: PluginTrigger = AllRequirements
override def requires: Plugins = SbtScalariform
override def projectSettings: Seq[_root_.sbt.Def.Setting[_]] = formatSettings
lazy val formatSettings = SbtScalariform.scalariformSettings ++ Seq(
ScalariformKeys.preferences in Compile := formattingPreferences,
ScalariformKeys.preferences in Test := formattingPreferences
)
import scalariform.formatter.preferences._
def formattingPreferences =
FormattingPreferences()
.setPreference(RewriteArrowSymbols, false)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DanglingCloseParenthesis, Preserve)
.setPreference(DoubleIndentClassDeclaration, true)
.setPreference(SpacesAroundMultiImports, true)
}
示例9: Formatting
//设置package包名称以及导入依赖的类
import sbt._
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
object Formatting extends AutoPlugin {
override def trigger: PluginTrigger = AllRequirements
override def requires: Plugins = SbtScalariform
override def projectSettings: Seq[_root_.sbt.Def.Setting[_]] = formatSettings
lazy val formatSettings = SbtScalariform.scalariformSettings ++ Seq(
ScalariformKeys.preferences in Compile := formattingPreferences,
ScalariformKeys.preferences in Test := formattingPreferences
)
import scalariform.formatter.preferences._
def formattingPreferences =
FormattingPreferences()
.setPreference(RewriteArrowSymbols, true)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DanglingCloseParenthesis, Preserve)
.setPreference(DoubleIndentClassDeclaration, true)
}
示例10: ScalariformSupport
//设置package包名称以及导入依赖的类
import sbt._
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
object ScalariformSupport {
lazy val formatSettings = SbtScalariform.scalariformSettings ++ Seq(
ScalariformKeys.preferences in Compile := formattingPreferences,
ScalariformKeys.preferences in Test := formattingPreferences
)
import scalariform.formatter.preferences._
def formattingPreferences =
FormattingPreferences()
.setPreference(RewriteArrowSymbols, true)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DoubleIndentClassDeclaration, true)
}
示例11: Formatting
//设置package包名称以及导入依赖的类
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
import scalariform.formatter.preferences._
import sbt._
object Formatting {
lazy val formatSettings = Seq(
ScalariformKeys.preferences in Compile <<= formattingPreferences,
ScalariformKeys.preferences in Test <<= formattingPreferences
)
lazy val docFormatSettings = Seq(
ScalariformKeys.preferences in Compile <<= docFormattingPreferences,
ScalariformKeys.preferences in Test <<= docFormattingPreferences
)
def formattingPreferences = Def.setting {
ScalariformKeys.preferences.value
.setPreference(RewriteArrowSymbols, true)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DanglingCloseParenthesis, Preserve)
.setPreference(DoubleIndentClassDeclaration, false)
}
def docFormattingPreferences = Def.setting {
ScalariformKeys.preferences.value
.setPreference(RewriteArrowSymbols, false)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DanglingCloseParenthesis, Preserve)
.setPreference(DoubleIndentClassDeclaration, false)
}
}
示例12: Settings
//设置package包名称以及导入依赖的类
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
import sbt._
import scala.collection.immutable.Seq
import scalariform.formatter.preferences.FormattingPreferences
object Settings {
object Formatting {
lazy val formatSettings: Seq[Setting[_]] = SbtScalariform.scalariformSettings ++ Seq(
ScalariformKeys.preferences in Compile := formattingPreferences,
ScalariformKeys.preferences in Test := formattingPreferences
)
lazy val docFormatSettings: Seq[Setting[_]] = SbtScalariform.scalariformSettings ++ Seq(
ScalariformKeys.preferences in Compile := docFormattingPreferences,
ScalariformKeys.preferences in Test := docFormattingPreferences
)
def formattingPreferences: FormattingPreferences = {
import scalariform.formatter.preferences._
FormattingPreferences()
.setPreference(RewriteArrowSymbols, true)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
}
def docFormattingPreferences: FormattingPreferences = {
import scalariform.formatter.preferences._
FormattingPreferences()
.setPreference(RewriteArrowSymbols, false)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
}
}
}
示例13: Format
//设置package包名称以及导入依赖的类
import sbt._
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
object Format {
lazy val settings = SbtScalariform.scalariformSettings ++ Seq(
ScalariformKeys.preferences in Compile := formattingPreferences,
ScalariformKeys.preferences in Test := formattingPreferences
)
def formattingPreferences = {
import scalariform.formatter.preferences._
FormattingPreferences()
.setPreference(RewriteArrowSymbols, true)
.setPreference(AlignParameters, false)
.setPreference(AlignArguments, false)
.setPreference(AlignSingleLineCaseStatements, true)
}
}
示例14: Formatting
//设置package包名称以及导入依赖的类
package example
import sbt._
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
object Formatting {
lazy val formatSettings = Seq(
ScalariformKeys.preferences in Compile := formattingPreferences.value,
ScalariformKeys.preferences in Test := formattingPreferences.value
)
def formattingPreferences = Def.setting {
import scalariform.formatter.preferences._
ScalariformKeys.preferences.value
.setPreference(RewriteArrowSymbols, true)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DanglingCloseParenthesis, Preserve)
.setPreference(DoubleIndentClassDeclaration, false)
}
}
示例15: ProjectPlugin
//设置package包名称以及导入依赖的类
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
import sbt._
import sbt.Keys._
import scalariform.formatter.preferences._
object ProjectPlugin extends SensiblePlugin {
override def projectSettings = Seq(
scalaVersion := "2.11.8",
organization := "com.fommil",
version := "1.0.0-SNAPSHOT",
ScalariformKeys.preferences := FormattingPreferences().setPreference(AlignSingleLineCaseStatements, true),
libraryDependencies ++= Sensible.testLibs() ++ Seq(
"org.scala-lang" % "scala-compiler" % scalaVersion.value,
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.ensime" %% "pcplod" % "1.0.0" % "test"
),
dependencyOverrides += "org.scala-lang" % "scala-compiler" % scalaVersion.value,
javaOptions in Test ++= Seq(
"-Dlogback.configurationFile=../logback-test.xml"
)
) ++ Sensible.settings ++ SonatypeSupport.sonatype("fommil", "scala-compiler-plugin", SonatypeSupport.Apache2)
}