2014-12-18 13:57:05 +01:00
|
|
|
import Dependencies._
|
2015-08-20 06:18:02 +02:00
|
|
|
import Util._
|
2017-07-31 12:35:52 +02:00
|
|
|
//import com.typesafe.tools.mima.core._, ProblemFilters._
|
2015-08-20 06:18:02 +02:00
|
|
|
|
2017-06-27 05:43:21 +02:00
|
|
|
def baseVersion = "1.0.0-SNAPSHOT"
|
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(
|
2017-01-18 12:54:15 +01:00
|
|
|
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"),
|
2015-03-24 21:16:55 +01:00
|
|
|
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"),
|
2016-12-22 20:34:37 +01:00
|
|
|
javacOptions in compile ++= Seq("-Xlint", "-Xlint:-serial"),
|
2016-12-22 17:50:53 +01:00
|
|
|
crossScalaVersions := Seq(scala211, scala212),
|
2016-12-23 04:30:45 +01:00
|
|
|
scalacOptions := {
|
|
|
|
|
val old = scalacOptions.value
|
|
|
|
|
scalaVersion.value match {
|
2017-08-10 12:24:29 +02:00
|
|
|
case sv if sv.startsWith("2.10") =>
|
|
|
|
|
old diff List("-Xfuture", "-Ywarn-unused", "-Ywarn-unused-import")
|
2017-06-14 07:30:26 +02:00
|
|
|
case sv if sv.startsWith("2.11") => old ++ List("-Ywarn-unused", "-Ywarn-unused-import")
|
|
|
|
|
case _ => old ++ List("-Ywarn-unused", "-Ywarn-unused-import", "-YdisableFlatCpCaching")
|
2016-12-23 04:30:45 +01:00
|
|
|
}
|
|
|
|
|
},
|
2016-11-28 18:16:20 +01:00
|
|
|
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(
|
2017-08-26 19:13:04 +02:00
|
|
|
organization.value % moduleName.value % "1.0.0"
|
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,
|
|
|
|
|
utilTesting,
|
2015-12-23 09:36:38 +01:00
|
|
|
utilScripted
|
2017-08-10 12:24:29 +02:00
|
|
|
)
|
|
|
|
|
.settings(
|
|
|
|
|
inThisBuild(
|
|
|
|
|
Seq(
|
|
|
|
|
git.baseVersion := baseVersion,
|
|
|
|
|
version := {
|
|
|
|
|
val v = version.value
|
|
|
|
|
if (v contains "SNAPSHOT") git.baseVersion.value
|
|
|
|
|
else v
|
|
|
|
|
},
|
|
|
|
|
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")),
|
|
|
|
|
scalafmtOnCompile := true,
|
2017-08-25 23:14:41 +02:00
|
|
|
scalafmtOnCompile in Sbt := false,
|
2017-08-14 16:25:36 +02:00
|
|
|
scalafmtVersion := "1.2.0",
|
2017-08-10 12:24:29 +02:00
|
|
|
)),
|
2015-08-20 06:18:02 +02:00
|
|
|
commonSettings,
|
|
|
|
|
name := "Util Root",
|
2015-02-06 20:35:32 +01:00
|
|
|
publish := {},
|
2015-08-31 09:19:51 +02:00
|
|
|
publishLocal := {},
|
2015-09-05 07:42:34 +02:00
|
|
|
publishArtifact in Compile := false,
|
|
|
|
|
publishArtifact in Test := false,
|
|
|
|
|
publishArtifact := false,
|
|
|
|
|
customCommands
|
2015-03-24 21:12:51 +01:00
|
|
|
)
|
|
|
|
|
|
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
|
|
|
|
2017-06-23 15:12:02 +02:00
|
|
|
val utilPosition = (project in file("internal") / "util-position").settings(
|
|
|
|
|
commonSettings,
|
2017-07-20 18:09:06 +02:00
|
|
|
name := "Util Position",
|
|
|
|
|
mimaSettings,
|
2017-06-23 15:12:02 +02:00
|
|
|
)
|
|
|
|
|
|
2014-12-18 05:38:10 +01:00
|
|
|
// logging
|
2017-08-10 12:24:29 +02:00
|
|
|
lazy val utilLogging = (project in internalPath / "util-logging")
|
|
|
|
|
.enablePlugins(ContrabandPlugin, JsonCodecPlugin)
|
|
|
|
|
.dependsOn(utilInterface, utilTesting % Test)
|
|
|
|
|
.settings(
|
2015-09-04 23:40:48 +02:00
|
|
|
commonSettings,
|
2016-12-23 04:30:45 +01:00
|
|
|
crossScalaVersions := Seq(scala210, scala211, scala212),
|
2015-08-20 06:18:02 +02:00
|
|
|
name := "Util Logging",
|
2017-08-10 12:24:29 +02:00
|
|
|
libraryDependencies ++=
|
|
|
|
|
Seq(jline, log4jApi, log4jCore, disruptor, sjsonnewScalaJson.value, scalaReflect.value),
|
2017-06-27 05:43:21 +02:00
|
|
|
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,
|
2015-07-15 10:01:11 +02:00
|
|
|
)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
// Relation
|
2017-08-10 12:24:29 +02:00
|
|
|
lazy val utilRelation = (project in internalPath / "util-relation")
|
|
|
|
|
.dependsOn(utilTesting % Test)
|
|
|
|
|
.settings(
|
2015-09-04 23:40:48 +02:00
|
|
|
commonSettings,
|
2017-07-20 18:09:06 +02:00
|
|
|
name := "Util Relation",
|
|
|
|
|
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"))
|
|
|
|
|
.dependsOn(utilTesting % Test)
|
|
|
|
|
.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),
|
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, utilTesting % Test)
|
|
|
|
|
.settings(
|
2015-08-20 06:18:02 +02:00
|
|
|
commonSettings,
|
2017-07-20 18:09:06 +02:00
|
|
|
name := "Util Tracking",
|
|
|
|
|
mimaSettings,
|
2017-08-10 12:24:29 +02:00
|
|
|
)
|
|
|
|
|
.configure(addSbtIO)
|
2015-09-04 23:40:48 +02:00
|
|
|
|
|
|
|
|
// Internal utility for testing
|
2017-08-10 12:24:29 +02:00
|
|
|
lazy val utilTesting = (project in internalPath / "util-testing")
|
|
|
|
|
.settings(
|
2015-09-04 23:40:48 +02:00
|
|
|
commonSettings,
|
2016-12-23 04:30:45 +01:00
|
|
|
crossScalaVersions := Seq(scala210, scala211, scala212),
|
2015-09-04 23:40:48 +02:00
|
|
|
name := "Util Testing",
|
2017-07-20 18:09:06 +02:00
|
|
|
libraryDependencies ++= Seq(scalaCheck, scalatest),
|
|
|
|
|
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 ++= {
|
2016-12-22 17:50:53 +01:00
|
|
|
scalaVersion.value match {
|
|
|
|
|
case sv if sv startsWith "2.11" => Seq(parserCombinator211)
|
|
|
|
|
case sv if sv startsWith "2.12" => Seq(parserCombinator211)
|
2017-08-10 12:24:29 +02:00
|
|
|
case _ => Seq()
|
2016-12-22 17:50:53 +01:00
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
)
|