2016-09-25 04:06:36 +00:00
|
|
|
import sbt._
|
|
|
|
import Keys._
|
|
|
|
|
|
|
|
import scala.util.Properties.envOrNone
|
|
|
|
|
|
|
|
import com.typesafe.sbt.site._
|
|
|
|
|
|
|
|
import Helpers._
|
|
|
|
|
|
|
|
sealed trait Basics {
|
|
|
|
final val buildOrganization = "org.gerweck.scalafx"
|
|
|
|
final val buildOrganizationName = "Sarah Gerweck"
|
|
|
|
final val buildOrganizationUrl = Some("https://github.com/sarahgerweck")
|
2016-09-26 00:54:31 +00:00
|
|
|
final val githubOrganization = "sarahgerweck"
|
|
|
|
final val githubProject = "scalafx-utils"
|
|
|
|
final val projectDescription = "ScalaFX Utilities"
|
|
|
|
final val projectStartYear = 2015
|
2016-09-25 04:06:36 +00:00
|
|
|
|
|
|
|
final val buildScalaVersion = "2.11.8"
|
|
|
|
final val extraScalaVersions = Seq.empty
|
|
|
|
final val minimumJavaVersion = "1.8"
|
2016-09-26 00:54:31 +00:00
|
|
|
final val defaultOptimize = false
|
2016-09-25 04:06:36 +00:00
|
|
|
|
2016-09-26 00:54:31 +00:00
|
|
|
final val parallelBuild = false
|
|
|
|
final val cachedResolution = true
|
|
|
|
|
|
|
|
final val defaultNewBackend = false
|
2016-09-25 04:06:36 +00:00
|
|
|
|
|
|
|
/* Metadata definitions */
|
2016-09-26 00:54:31 +00:00
|
|
|
lazy val githubPage = url(s"https://github.com/${githubOrganization}/${githubProject}")
|
2016-09-25 04:06:36 +00:00
|
|
|
lazy val buildMetadata = Vector(
|
|
|
|
licenses := Seq("Apache License, Version 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")),
|
2016-09-26 00:54:31 +00:00
|
|
|
homepage := Some(githubPage),
|
|
|
|
description := projectDescription,
|
|
|
|
startYear := Some(projectStartYear),
|
|
|
|
scmInfo := Some(ScmInfo(githubPage, s"scm:git:git@github.com:${githubOrganization}/${githubProject}.git"))
|
2016-09-25 04:06:36 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
lazy val developerInfo = {
|
|
|
|
<developers>
|
|
|
|
<developer>
|
|
|
|
<id>sarah</id>
|
|
|
|
<name>Sarah Gerweck</name>
|
|
|
|
<email>sarah.a180@gmail.com</email>
|
|
|
|
<url>https://github.com/sarahgerweck</url>
|
|
|
|
<timezone>America/Los_Angeles</timezone>
|
|
|
|
</developer>
|
|
|
|
</developers>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
object BasicSettings extends AutoPlugin with Basics {
|
|
|
|
override def requires = SiteScaladocPlugin
|
|
|
|
|
|
|
|
override lazy val projectSettings = (
|
|
|
|
buildMetadata ++
|
|
|
|
Seq (
|
|
|
|
organization := buildOrganization,
|
|
|
|
organizationName := buildOrganizationName,
|
|
|
|
organizationHomepage := buildOrganizationUrl map { url _ },
|
|
|
|
|
|
|
|
scalaVersion := buildScalaVersion,
|
|
|
|
crossScalaVersions := buildScalaVersions,
|
|
|
|
|
|
|
|
scalacOptions ++= buildScalacOptions,
|
|
|
|
javacOptions ++= buildJavacOptions,
|
|
|
|
autoAPIMappings := true,
|
|
|
|
|
|
|
|
updateOptions := updateOptions.value.withCachedResolution(cachedResolution),
|
|
|
|
parallelExecution := parallelBuild,
|
|
|
|
|
|
|
|
evictionWarningOptions in update :=
|
|
|
|
EvictionWarningOptions.default.withWarnTransitiveEvictions(false).withWarnDirectEvictions(false).withWarnScalaVersionEviction(false)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
/* Overridable flags */
|
|
|
|
lazy val optimize = boolFlag("OPTIMIZE") orElse boolFlag("OPTIMISE") getOrElse defaultOptimize
|
|
|
|
lazy val deprecation = boolFlag("NO_DEPRECATION") map (!_) getOrElse true
|
|
|
|
lazy val inlineWarn = boolFlag("INLINE_WARNINGS") getOrElse false
|
|
|
|
lazy val debug = boolFlag("DEBUGGER") getOrElse false
|
|
|
|
lazy val debugPort = envOrNone("DEBUGGER_PORT") map { _.toInt } getOrElse 5050
|
|
|
|
lazy val debugSuspend = boolFlag("DEBUGGER_SUSPEND") getOrElse true
|
|
|
|
lazy val unusedWarn = boolFlag("UNUSED_WARNINGS") getOrElse false
|
|
|
|
lazy val importWarn = boolFlag("IMPORT_WARNINGS") getOrElse false
|
2016-09-26 00:54:31 +00:00
|
|
|
lazy val java8Flag = boolFlag("BUILD_JAVA_8") getOrElse false
|
|
|
|
lazy val newBackend = boolFlag("NEW_BCODE_BACKEND") getOrElse defaultNewBackend
|
2016-09-25 04:06:36 +00:00
|
|
|
|
|
|
|
lazy val buildScalaVersions = buildScalaVersion +: extraScalaVersions
|
2016-09-26 00:54:31 +00:00
|
|
|
|
2016-09-25 04:06:36 +00:00
|
|
|
val buildScalacOptions = Seq (
|
|
|
|
"-unchecked",
|
|
|
|
"-feature",
|
|
|
|
"-target:jvm-" + minimumJavaVersion
|
|
|
|
) ++ (
|
|
|
|
if (deprecation) Seq("-deprecation") else Seq.empty
|
|
|
|
) ++ (
|
|
|
|
if (optimize) Seq("-optimize") else Seq.empty
|
|
|
|
) ++ (
|
|
|
|
if (inlineWarn) Seq("-Yinline-warnings") else Seq.empty
|
|
|
|
) ++ (
|
|
|
|
if (unusedWarn) Seq("-Ywarn-unused") else Seq.empty
|
|
|
|
) ++ (
|
|
|
|
if (importWarn) Seq("-Ywarn-unused-import") else Seq.empty
|
2016-09-26 00:54:31 +00:00
|
|
|
) ++ (
|
|
|
|
if (newBackend) Seq("-Ybackend:GenBCode", "-Yopt:l:classpath") else Seq.empty
|
2016-09-25 04:06:36 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
/* Java build setup */
|
|
|
|
val buildJavacOptions = Seq(
|
|
|
|
"-target", minimumJavaVersion,
|
|
|
|
"-source", minimumJavaVersion
|
|
|
|
) ++ (
|
|
|
|
if (deprecation) Seq("-Xlint:deprecation") else Seq.empty
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|