lila/project/BuildSettings.scala

68 lines
2.2 KiB
Scala
Raw Normal View History

2017-10-21 09:37:37 -06:00
import com.typesafe.sbt.SbtScalariform.autoImport.scalariformPreferences
2017-02-14 08:12:00 -07:00
import play.sbt.Play.autoImport._
import sbt._, Keys._
2017-10-21 09:54:37 -06:00
import scalariform.formatter.preferences._
2013-03-14 12:16:36 -06:00
object BuildSettings {
import Dependencies._
val globalScalaVersion = "2.11.12"
2015-01-08 08:22:26 -07:00
def buildSettings = Defaults.coreDefaultSettings ++ Seq(
2013-03-14 12:16:36 -06:00
organization := "org.lichess",
2015-01-08 08:22:26 -07:00
scalaVersion := globalScalaVersion,
2013-03-14 12:16:36 -06:00
resolvers ++= Dependencies.Resolvers.commons,
2017-10-21 09:28:56 -06:00
scalacOptions ++= compilerOptions,
javacOptions += "-Xlint:unchecked",
2014-12-06 02:23:51 -07:00
incOptions := incOptions.value.withNameHashing(true),
2015-06-10 04:17:35 -06:00
updateOptions := updateOptions.value.withCachedResolution(true),
2015-07-22 03:33:40 -06:00
sources in doc in Compile := List(),
2015-07-22 03:36:41 -06:00
// disable publishing the main API jar
publishArtifact in (Compile, packageDoc) := false,
2015-07-22 03:33:40 -06:00
// disable publishing the main sources jar
2017-10-21 09:37:37 -06:00
publishArtifact in (Compile, packageSrc) := false,
2017-10-22 07:24:06 -06:00
scalariformPreferences := scalariformPrefs(scalariformPreferences.value)
2017-08-23 18:47:35 -06:00
)
2013-03-14 12:16:36 -06:00
2017-10-21 09:37:37 -06:00
def scalariformPrefs(prefs: IFormattingPreferences) = prefs
.setPreference(DanglingCloseParenthesis, Force)
.setPreference(DoubleIndentConstructorArguments, true)
2018-03-06 13:57:11 -07:00
def defaultDeps = Seq(scalaz, chess, scalalib, jodaTime, ws, java8compat, specs2, specs2Scalaz)
2013-03-14 12:16:36 -06:00
def compile(deps: ModuleID*): Seq[ModuleID] = deps map (_ % "compile")
def provided(deps: ModuleID*): Seq[ModuleID] = deps map (_ % "provided")
2017-08-23 18:43:12 -06:00
def module(name: String, deps: Seq[sbt.ClasspathDep[sbt.ProjectReference]] = Seq.empty) =
2013-03-14 12:16:36 -06:00
Project(
name,
2017-08-23 18:47:35 -06:00
file("modules/" + name)
)
2017-08-23 17:39:19 -06:00
.dependsOn(deps: _*)
.settings(
version := "2.0",
2017-10-21 12:33:22 -06:00
libraryDependencies ++= defaultDeps,
2017-08-23 17:39:19 -06:00
buildSettings,
2017-08-23 18:47:35 -06:00
srcMain
)
2013-03-14 12:16:36 -06:00
val compilerOptions = Seq(
"-deprecation", "-unchecked", "-feature", "-language:_",
"-Xfatal-warnings",
2017-01-15 05:56:49 -07:00
"-Ywarn-dead-code",
2017-01-15 06:01:12 -07:00
// "-Ywarn-unused-import",
// "-Ywarn-unused",
2017-01-15 05:56:49 -07:00
// "-Xlint:missing-interpolator",
2017-10-21 14:01:50 -06:00
// "-Ywarn-unused-import",
"-Ybackend:GenBCode", "-Ydelambdafy:method", "-target:jvm-1.8"
2017-08-23 17:39:19 -06:00
)
2013-05-04 12:00:55 -06:00
2013-03-14 12:16:36 -06:00
val srcMain = Seq(
scalaSource in Compile := (sourceDirectory in Compile).value,
scalaSource in Test := (sourceDirectory in Test).value
2013-03-14 12:16:36 -06:00
)
2013-04-01 19:21:22 -06:00
2013-07-30 10:38:29 -06:00
def projectToRef(p: Project): ProjectReference = LocalProject(p.id)
2013-03-14 12:16:36 -06:00
}