sbt/build.sbt

197 lines
6.8 KiB
Plaintext
Raw Normal View History

2014-12-18 13:57:05 +01:00
import Dependencies._
2015-08-20 06:18:02 +02:00
import Util._
import com.typesafe.tools.mima.core._, ProblemFilters._
2015-08-20 06:18:02 +02:00
ThisBuild / git.baseVersion := "1.3.0"
ThisBuild / version := {
val old = (ThisBuild / version).value
nightlyVersion match {
case Some(v) => v
case _ =>
if (old contains "SNAPSHOT") git.baseVersion.value + "-SNAPSHOT"
else old
}
}
2017-08-10 12:24:29 +02:00
def internalPath = file("internal")
2014-12-18 05:38:10 +01:00
def commonSettings: Seq[Setting[_]] = Seq(
scalaVersion := scala212,
2015-08-20 06:18:02 +02:00
// publishArtifact in packageDoc := false,
2014-12-18 05:38:10 +01:00
resolvers += Resolver.typesafeIvyRepo("releases"),
resolvers += Resolver.sonatypeRepo("snapshots"),
2016-12-06 16:34:03 +01:00
resolvers += Resolver.mavenLocal,
2015-08-20 06:18:02 +02:00
// concurrentRestrictions in Global += Util.testExclusiveRestriction,
2014-12-18 05:38:10 +01:00
testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"),
javacOptions in compile ++= Seq("-Xlint", "-Xlint:-serial"),
crossScalaVersions := Seq(scala212),
scalacOptions in console in Compile -= "-Ywarn-unused-import",
2017-08-10 12:24:29 +02:00
scalacOptions in console in Test -= "-Ywarn-unused-import",
2015-09-04 07:48:44 +02:00
publishArtifact in Compile := true,
2016-05-11 17:30:40 +02:00
publishArtifact in Test := false
2014-12-18 05:38:10 +01:00
)
2017-07-20 18:09:06 +02:00
val mimaSettings = Def settings (
2017-08-10 12:24:29 +02:00
mimaPreviousArtifacts := Set(
"1.0.0", "1.0.1", "1.0.2", "1.0.3",
2018-08-01 06:16:15 +02:00
"1.1.0", "1.1.1", "1.1.2", "1.1.3",
2018-08-27 18:18:00 +02:00
"1.2.0", "1.2.1"
) map (version =>
organization.value %% moduleName.value % version
2017-08-10 12:24:29 +02:00
cross (if (crossPaths.value) CrossVersion.binary else CrossVersion.disabled)
),
2017-07-20 18:09:06 +02:00
)
2017-08-10 12:24:29 +02:00
lazy val utilRoot: Project = (project in file("."))
.aggregate(
utilInterface,
utilControl,
utilPosition,
utilLogging,
utilRelation,
utilCache,
utilTracking,
2015-12-23 09:36:38 +01:00
utilScripted
2017-08-10 12:24:29 +02:00
)
.settings(
inThisBuild(
Seq(
bintrayPackage := "util",
homepage := Some(url("https://github.com/sbt/util")),
description := "Util module for sbt",
scmInfo := Some(ScmInfo(url("https://github.com/sbt/util"), "git@github.com:sbt/util.git")),
)),
2015-08-20 06:18:02 +02:00
commonSettings,
name := "Util Root",
2019-03-08 00:19:12 +01:00
publish / skip := true,
2015-09-05 07:42:34 +02:00
customCommands
)
2014-12-18 05:38:10 +01:00
// defines Java structures used across Scala versions, such as the API structures and relationships extracted by
// the analysis compiler phases and passed back to sbt. The API structures are defined in a simple
// format from which Java sources are generated by the datatype generator Projproject
2017-08-10 12:24:29 +02:00
lazy val utilInterface = (project in internalPath / "util-interface").settings(
commonSettings,
javaOnlySettings,
name := "Util Interface",
exportJars := true,
mimaSettings,
)
2015-08-20 06:18:02 +02:00
2017-08-10 12:24:29 +02:00
lazy val utilControl = (project in internalPath / "util-control").settings(
commonSettings,
name := "Util Control",
mimaSettings,
)
2014-12-18 05:38:10 +01:00
val utilPosition = (project in file("internal") / "util-position")
.settings(
commonSettings,
name := "Util Position",
scalacOptions += "-language:experimental.macros",
libraryDependencies ++= Seq(scalaReflect.value, scalaTest),
mimaSettings,
)
2017-08-10 12:24:29 +02:00
lazy val utilLogging = (project in internalPath / "util-logging")
.enablePlugins(ContrabandPlugin, JsonCodecPlugin)
.dependsOn(utilInterface)
2017-08-10 12:24:29 +02:00
.settings(
2015-09-04 23:40:48 +02:00
commonSettings,
crossScalaVersions := Seq(scala212),
2015-08-20 06:18:02 +02:00
name := "Util Logging",
2017-08-10 12:24:29 +02:00
libraryDependencies ++=
2018-09-22 06:35:20 +02:00
Seq(jline, log4jApi, log4jCore, disruptor, sjsonnewScalaJson.value, scalaReflect.value),
libraryDependencies ++= Seq(scalaCheck, scalaTest),
2018-09-22 06:35:20 +02:00
libraryDependencies ++= (scalaVersion.value match {
case v if v.startsWith("2.12.") => List(compilerPlugin(silencerPlugin))
case _ => List()
}),
2018-09-20 06:36:32 +02:00
Compile / scalacOptions ++= (scalaVersion.value match {
case v if v.startsWith("2.12.") => List("-Ywarn-unused:-locals,-explicits,-privates")
case _ => List()
}),
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
contrabandFormatsForType in generateContrabands in Compile := { tpe =>
val old = (contrabandFormatsForType in generateContrabands in Compile).value
val name = tpe.removeTypeParameters.name
if (name == "Throwable") Nil
else old(tpe)
},
2017-07-20 18:09:06 +02:00
mimaSettings,
mimaBinaryIssueFilters ++= Seq(
exclude[DirectMissingMethodProblem]("sbt.internal.util.SuccessEvent.copy*"),
exclude[DirectMissingMethodProblem]("sbt.internal.util.TraceEvent.copy*"),
exclude[DirectMissingMethodProblem]("sbt.internal.util.StringEvent.copy*"),
// Private final class constructors changed
exclude[DirectMissingMethodProblem]("sbt.util.InterfaceUtil#ConcretePosition.this"),
exclude[DirectMissingMethodProblem]("sbt.util.InterfaceUtil#ConcreteProblem.this"),
exclude[ReversedMissingMethodProblem]("sbt.internal.util.ConsoleOut.flush"),
// This affects Scala 2.11 only it seems, so it's ok?
exclude[InheritedNewAbstractMethodProblem]("sbt.internal.util.codec.JsonProtocol.LogOptionFormat"),
exclude[InheritedNewAbstractMethodProblem]("sbt.internal.util.codec.JsonProtocol.ProgressItemFormat"),
exclude[InheritedNewAbstractMethodProblem]("sbt.internal.util.codec.JsonProtocol.ProgressEventFormat"),
),
)
.configure(addSbtIO)
2014-12-18 05:38:10 +01:00
2017-08-10 12:24:29 +02:00
lazy val utilRelation = (project in internalPath / "util-relation")
.settings(
2015-09-04 23:40:48 +02:00
commonSettings,
2017-07-20 18:09:06 +02:00
name := "Util Relation",
libraryDependencies ++= Seq(scalaCheck),
2017-07-20 18:09:06 +02:00
mimaSettings,
2014-12-18 05:38:10 +01:00
)
2016-06-27 15:27:42 +02:00
// Persisted caching based on sjson-new
2017-08-10 12:24:29 +02:00
lazy val utilCache = (project in file("util-cache"))
.settings(
2015-08-20 06:18:02 +02:00
commonSettings,
name := "Util Cache",
2017-08-10 12:24:29 +02:00
libraryDependencies ++=
Seq(sjsonnewScalaJson.value, sjsonnewMurmurhash.value, scalaReflect.value),
libraryDependencies ++= Seq(scalaTest),
2017-07-20 18:09:06 +02:00
mimaSettings,
2017-08-10 12:24:29 +02:00
)
.configure(addSbtIO)
2014-12-18 05:38:10 +01:00
// Builds on cache to provide caching for filesystem-related operations
2017-08-10 12:24:29 +02:00
lazy val utilTracking = (project in file("util-tracking"))
.dependsOn(utilCache)
2017-08-10 12:24:29 +02:00
.settings(
2015-08-20 06:18:02 +02:00
commonSettings,
2017-07-20 18:09:06 +02:00
name := "Util Tracking",
libraryDependencies ++= Seq(scalaTest),
2017-07-20 18:09:06 +02:00
mimaSettings,
2017-08-10 12:24:29 +02:00
)
.configure(addSbtIO)
2015-09-05 07:42:34 +02:00
2017-08-10 12:24:29 +02:00
lazy val utilScripted = (project in internalPath / "util-scripted")
.dependsOn(utilLogging, utilInterface)
.settings(
2015-12-23 09:36:38 +01:00
commonSettings,
name := "Util Scripted",
libraryDependencies += parserCombinator,
2017-07-20 18:09:06 +02:00
mimaSettings,
2017-08-10 12:24:29 +02:00
)
.configure(addSbtIO)
2015-12-23 09:36:38 +01:00
2015-09-05 07:42:34 +02:00
def customCommands: Seq[Setting[_]] = Seq(
commands += Command.command("release") { state =>
// "clean" ::
2017-07-06 14:25:05 +02:00
"+compile" ::
2017-08-10 12:24:29 +02:00
"+publishSigned" ::
"reload" ::
state
2015-09-05 07:42:34 +02:00
}
)
inThisBuild(Seq(
whitesourceProduct := "Lightbend Reactive Platform",
whitesourceAggregateProjectName := "sbt-util-master",
whitesourceAggregateProjectToken := "b9b11b2f43d34c44b28d8922624eef07a3f1b20d95ad45a5b5d973513ab173f4",
whitesourceIgnoredScopes += "scalafmt",
whitesourceFailOnError := sys.env.contains("WHITESOURCE_PASSWORD"), // fail if pwd is present
whitesourceForceCheckAllDependencies := true,
))