2019-11-28 18:34:46 -07:00
|
|
|
import play.sbt.PlayImport._
|
2017-02-14 08:12:00 -07:00
|
|
|
import sbt._, Keys._
|
2020-08-01 01:36:51 -06:00
|
|
|
import bloop.integrations.sbt.BloopKeys.bloopGenerate
|
2013-03-14 12:16:36 -06:00
|
|
|
|
|
|
|
object BuildSettings {
|
|
|
|
|
|
|
|
import Dependencies._
|
|
|
|
|
2020-09-05 07:27:23 -06:00
|
|
|
val lilaVersion = "3.2"
|
2021-05-17 06:02:32 -06:00
|
|
|
val globalScalaVersion = "2.13.6"
|
2015-01-08 08:22:26 -07:00
|
|
|
|
2019-12-19 21:49:44 -07:00
|
|
|
val useEpoll = sys.props.get("epoll").fold(false)(_.toBoolean)
|
|
|
|
if (useEpoll) println("--- epoll build ---")
|
|
|
|
|
2020-05-05 22:11:15 -06:00
|
|
|
def buildSettings =
|
|
|
|
Defaults.coreDefaultSettings ++ Seq(
|
|
|
|
version := lilaVersion,
|
|
|
|
organization := "org.lichess",
|
2020-08-12 09:23:37 -06:00
|
|
|
resolvers += lilaMaven,
|
2020-05-05 22:11:15 -06:00
|
|
|
scalaVersion := globalScalaVersion,
|
|
|
|
scalacOptions ++= compilerOptions,
|
2020-08-01 01:36:51 -06:00
|
|
|
// No bloop project for tests
|
2021-04-09 01:15:28 -06:00
|
|
|
Test / bloopGenerate := None,
|
2020-08-14 03:02:57 -06:00
|
|
|
// disable publishing doc and sources
|
2021-04-10 01:11:17 -06:00
|
|
|
Compile / doc / sources := Seq.empty,
|
|
|
|
Compile / packageDoc / publishArtifact := false,
|
|
|
|
Compile / packageSrc / publishArtifact := false,
|
2021-08-26 04:19:21 -06:00
|
|
|
javaOptions ++= Seq("-Xms64m", "-Xmx256m"),
|
|
|
|
// com.typesafe.play:play-ahc-ws-standalone_2.13:2.1.3 brings in 0.9.0, but we want 1.0.0:
|
|
|
|
libraryDependencySchemes += "org.scala-lang.modules" %% "scala-java8-compat" % "always"
|
2020-05-05 22:11:15 -06:00
|
|
|
)
|
2013-03-14 12:16:36 -06:00
|
|
|
|
2020-08-12 09:23:37 -06:00
|
|
|
lazy val defaultLibs: Seq[ModuleID] =
|
|
|
|
akka.bundle ++ macwire.bundle ++ Seq(
|
2020-05-05 22:11:15 -06:00
|
|
|
play.api,
|
|
|
|
chess,
|
|
|
|
scalalib,
|
|
|
|
jodaTime,
|
|
|
|
autoconfig
|
2020-08-07 09:51:07 -06:00
|
|
|
)
|
2013-03-14 12:16:36 -06:00
|
|
|
|
2020-08-12 09:23:37 -06:00
|
|
|
def smallModule(
|
2019-12-12 22:03:38 -07:00
|
|
|
name: String,
|
|
|
|
deps: Seq[sbt.ClasspathDep[sbt.ProjectReference]],
|
|
|
|
libs: Seq[ModuleID]
|
2019-12-07 20:23:31 -07:00
|
|
|
) =
|
2013-03-14 12:16:36 -06:00
|
|
|
Project(
|
|
|
|
name,
|
2017-08-23 18:47:35 -06:00
|
|
|
file("modules/" + name)
|
2019-12-12 22:03:38 -07:00
|
|
|
).dependsOn(deps: _*)
|
2017-08-23 17:39:19 -06:00
|
|
|
.settings(
|
2020-08-12 09:23:37 -06:00
|
|
|
libraryDependencies ++= libs,
|
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
|
|
|
|
2020-08-12 09:23:37 -06:00
|
|
|
def module(
|
2020-08-06 07:24:22 -06:00
|
|
|
name: String,
|
|
|
|
deps: Seq[sbt.ClasspathDep[sbt.ProjectReference]],
|
|
|
|
libs: Seq[ModuleID]
|
|
|
|
) =
|
2020-08-12 09:23:37 -06:00
|
|
|
smallModule(name, deps, defaultLibs ++ libs)
|
2020-08-06 07:24:22 -06:00
|
|
|
|
2016-03-16 07:52:46 -06:00
|
|
|
val compilerOptions = Seq(
|
2020-07-08 04:40:14 -06:00
|
|
|
"-explaintypes",
|
|
|
|
"-feature",
|
|
|
|
"-language:higherKinds",
|
2019-11-28 11:20:59 -07:00
|
|
|
"-language:implicitConversions",
|
2019-11-28 17:50:19 -07:00
|
|
|
"-language:postfixOps",
|
2020-07-08 04:40:14 -06:00
|
|
|
"-Ymacro-annotations",
|
|
|
|
// Warnings as errors!
|
2021-04-09 03:03:24 -06:00
|
|
|
"-Xfatal-warnings",
|
2020-07-08 04:40:14 -06:00
|
|
|
// Linting options
|
2019-12-08 11:21:43 -07:00
|
|
|
"-unchecked",
|
2020-07-08 04:40:14 -06:00
|
|
|
"-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",
|
2020-07-08 12:34:57 -06:00
|
|
|
// "-Wnumeric-widen",
|
2020-11-11 02:08:19 -07:00
|
|
|
// "-Wunused:imports",
|
|
|
|
// "-Wunused:locals",
|
2020-09-28 15:35:17 -06:00
|
|
|
"-Wunused:patvars",
|
2021-04-09 03:03:24 -06:00
|
|
|
// "-Wunused:privates", // unfortunately doesn't work with wire macros
|
|
|
|
// "-Wunused:implicits", // unfortunately doesn't work with wire macros
|
|
|
|
// "-Wunused:params" // unfortunately doesn't work with wire macros
|
2020-09-28 15:35:17 -06:00
|
|
|
"-Wvalue-discard"
|
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(
|
2021-04-09 01:15:28 -06:00
|
|
|
Compile / scalaSource := (Compile / sourceDirectory).value,
|
|
|
|
Test / scalaSource := (Test / sourceDirectory).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
|
|
|
}
|