103 lines
2.5 KiB
Scala
103 lines
2.5 KiB
Scala
import play.sbt.PlayImport._
|
|
import sbt._, Keys._
|
|
|
|
object BuildSettings {
|
|
|
|
import Dependencies._
|
|
|
|
val lilaVersion = "3.0"
|
|
val globalScalaVersion = "2.13.3"
|
|
|
|
val useEpoll = sys.props.get("epoll").fold(false)(_.toBoolean)
|
|
if (useEpoll) println("--- epoll build ---")
|
|
|
|
def buildSettings =
|
|
Defaults.coreDefaultSettings ++ Seq(
|
|
version := lilaVersion,
|
|
organization := "org.lichess",
|
|
scalaVersion := globalScalaVersion,
|
|
resolvers ++= Dependencies.Resolvers.commons,
|
|
scalacOptions ++= compilerOptions,
|
|
sources in (Compile, doc) := Seq.empty,
|
|
publishArtifact in (Compile, packageDoc) := false,
|
|
// disable publishing the main sources jar
|
|
publishArtifact in (Compile, packageSrc) := false
|
|
)
|
|
|
|
def defaultLibs: Seq[ModuleID] =
|
|
akka.bundle ++ Seq(
|
|
play.api,
|
|
scalaz,
|
|
chess,
|
|
scalalib,
|
|
jodaTime,
|
|
ws,
|
|
macwire.macros,
|
|
macwire.util,
|
|
autoconfig
|
|
)
|
|
|
|
def module(
|
|
name: String,
|
|
deps: Seq[sbt.ClasspathDep[sbt.ProjectReference]],
|
|
libs: Seq[ModuleID]
|
|
) =
|
|
Project(
|
|
name,
|
|
file("modules/" + name)
|
|
).dependsOn(deps: _*)
|
|
.settings(
|
|
libraryDependencies ++= defaultLibs ++ libs,
|
|
buildSettings,
|
|
srcMain
|
|
)
|
|
|
|
val compilerOptions = Seq(
|
|
"-encoding", "utf-8",
|
|
"-explaintypes",
|
|
"-feature",
|
|
"-language:higherKinds",
|
|
"-language:implicitConversions",
|
|
"-language:postfixOps",
|
|
"-Ymacro-annotations",
|
|
|
|
// Warnings as errors!
|
|
// "-Xfatal-warnings",
|
|
|
|
// Linting options
|
|
"-unchecked",
|
|
"-Xcheckinit",
|
|
"-Xlint:adapted-args",
|
|
"-Xlint:constant",
|
|
"-Xlint:delayedinit-select",
|
|
"-Xlint:deprecation",
|
|
"-Xlint:inaccessible",
|
|
"-Xlint:infer-any",
|
|
"-Xlint:missing-interpolator",
|
|
"-Xlint:nullary-unit",
|
|
"-Xlint:option-implicit",
|
|
"-Xlint:package-object-classes",
|
|
"-Xlint:poly-implicit-overload",
|
|
"-Xlint:private-shadow",
|
|
"-Xlint:stars-align",
|
|
"-Xlint:type-parameter-shadow",
|
|
"-Wdead-code",
|
|
"-Wextra-implicit",
|
|
"-Wnumeric-widen",
|
|
"-Wunused:imports",
|
|
"-Wunused:locals",
|
|
"-Wunused:patvars",
|
|
// "-Wunused:privates", // unfortunately doesn't work with macros
|
|
// "-Wunused:implicits",
|
|
// "-Wunused:params",
|
|
// "-Wvalue-discard",
|
|
)
|
|
|
|
val srcMain = Seq(
|
|
scalaSource in Compile := (sourceDirectory in Compile).value,
|
|
scalaSource in Test := (sourceDirectory in Test).value
|
|
)
|
|
|
|
def projectToRef(p: Project): ProjectReference = LocalProject(p.id)
|
|
}
|