2014-12-18 05:38:10 +01:00
|
|
|
import Util._
|
2014-12-18 13:57:05 +01:00
|
|
|
import Dependencies._
|
2014-12-18 05:38:10 +01:00
|
|
|
import Sxr.sxr
|
2017-08-28 06:42:26 +02:00
|
|
|
import com.typesafe.tools.mima.core._, ProblemFilters._
|
2018-07-31 02:28:42 +02:00
|
|
|
import local.Scripted
|
2019-05-11 09:42:06 +02:00
|
|
|
import scala.xml.{ Node => XmlNode, NodeSeq => XmlNodeSeq, _ }
|
|
|
|
|
import scala.xml.transform.{ RewriteRule, RuleTransformer }
|
2019-07-27 21:47:00 +02:00
|
|
|
import scala.util.Try
|
2014-12-18 05:38:10 +01:00
|
|
|
|
2019-05-13 19:59:58 +02:00
|
|
|
ThisBuild / version := {
|
|
|
|
|
val v = "1.3.0-SNAPSHOT"
|
|
|
|
|
nightlyVersion.getOrElse(v)
|
|
|
|
|
}
|
2019-05-17 20:51:07 +02:00
|
|
|
ThisBuild / scalafmtOnCompile := !(Global / insideCI).value
|
|
|
|
|
ThisBuild / Test / scalafmtOnCompile := !(Global / insideCI).value
|
2019-05-13 19:59:58 +02:00
|
|
|
|
2015-02-06 19:48:12 +01:00
|
|
|
// ThisBuild settings take lower precedence,
|
|
|
|
|
// but can be shared across the multi projects.
|
2017-04-21 09:14:31 +02:00
|
|
|
def buildLevelSettings: Seq[Setting[_]] =
|
|
|
|
|
inThisBuild(
|
|
|
|
|
Seq(
|
|
|
|
|
organization := "org.scala-sbt",
|
|
|
|
|
description := "sbt is an interactive build tool",
|
|
|
|
|
bintrayOrganization := Some("sbt"),
|
|
|
|
|
bintrayRepository := {
|
|
|
|
|
if (publishStatus.value == "releases") "maven-releases"
|
|
|
|
|
else "maven-snapshots"
|
|
|
|
|
},
|
|
|
|
|
bintrayPackage := "sbt",
|
|
|
|
|
bintrayReleaseOnPublish := false,
|
2018-09-14 09:38:58 +02:00
|
|
|
licenses := List("Apache-2.0" -> url("https://github.com/sbt/sbt/blob/0.13/LICENSE")),
|
2019-06-04 00:03:22 +02:00
|
|
|
javacOptions ++= Seq("-source", "1.8", "-target", "1.8"),
|
|
|
|
|
Compile / doc / javacOptions := Nil,
|
2017-04-21 09:14:31 +02:00
|
|
|
developers := List(
|
|
|
|
|
Developer("harrah", "Mark Harrah", "@harrah", url("https://github.com/harrah")),
|
|
|
|
|
Developer("eed3si9n", "Eugene Yokota", "@eed3si9n", url("https://github.com/eed3si9n")),
|
|
|
|
|
Developer("jsuereth", "Josh Suereth", "@jsuereth", url("https://github.com/jsuereth")),
|
|
|
|
|
Developer("dwijnand", "Dale Wijnand", "@dwijnand", url("https://github.com/dwijnand")),
|
2019-03-22 20:14:52 +01:00
|
|
|
Developer("eatkins", "Ethan Atkins", "@eatkins", url("https://github.com/eatkins")),
|
2018-01-26 15:19:14 +01:00
|
|
|
Developer(
|
|
|
|
|
"gkossakowski",
|
|
|
|
|
"Grzegorz Kossakowski",
|
|
|
|
|
"@gkossakowski",
|
|
|
|
|
url("https://github.com/gkossakowski")
|
|
|
|
|
),
|
2017-04-21 09:14:31 +02:00
|
|
|
Developer("Duhemm", "Martin Duhem", "@Duhemm", url("https://github.com/Duhemm"))
|
|
|
|
|
),
|
|
|
|
|
homepage := Some(url("https://github.com/sbt/sbt")),
|
|
|
|
|
scmInfo := Some(ScmInfo(url("https://github.com/sbt/sbt"), "git@github.com:sbt/sbt.git")),
|
2017-06-16 22:11:33 +02:00
|
|
|
resolvers += Resolver.mavenLocal,
|
2019-05-11 09:42:06 +02:00
|
|
|
)
|
|
|
|
|
)
|
2017-04-21 09:14:31 +02:00
|
|
|
|
2018-03-06 20:20:31 +01:00
|
|
|
def commonSettings: Seq[Setting[_]] = Def.settings(
|
2019-05-11 09:42:06 +02:00
|
|
|
headerLicense := Some(
|
|
|
|
|
HeaderLicense.Custom(
|
|
|
|
|
"""|sbt
|
2018-09-14 09:38:58 +02:00
|
|
|
|Copyright 2011 - 2018, Lightbend, Inc.
|
2018-02-01 15:53:05 +01:00
|
|
|
|Copyright 2008 - 2010, Mark Harrah
|
2018-09-14 09:38:58 +02:00
|
|
|
|Licensed under Apache License 2.0 (see LICENSE)
|
2018-02-01 15:53:05 +01:00
|
|
|
|""".stripMargin
|
2019-05-11 09:42:06 +02:00
|
|
|
)
|
|
|
|
|
),
|
2018-02-01 15:53:05 +01:00
|
|
|
scalaVersion := baseScalaVersion,
|
|
|
|
|
componentID := None,
|
2019-07-09 22:55:04 +02:00
|
|
|
resolvers += Resolver.typesafeIvyRepo("releases").withName("typesafe-sbt-build-ivy-releases"),
|
2018-02-01 15:53:05 +01:00
|
|
|
resolvers += Resolver.sonatypeRepo("snapshots"),
|
|
|
|
|
resolvers += "bintray-sbt-maven-releases" at "https://dl.bintray.com/sbt/maven-releases/",
|
|
|
|
|
addCompilerPlugin("org.spire-math" % "kind-projector" % "0.9.4" cross CrossVersion.binary),
|
|
|
|
|
concurrentRestrictions in Global += Util.testExclusiveRestriction,
|
|
|
|
|
testOptions in Test += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"),
|
|
|
|
|
testOptions in Test += Tests.Argument(TestFrameworks.ScalaCheck, "-verbosity", "2"),
|
|
|
|
|
javacOptions in compile ++= Seq("-Xlint", "-Xlint:-serial"),
|
2019-03-22 07:28:14 +01:00
|
|
|
Compile / doc / scalacOptions ++= {
|
|
|
|
|
import scala.sys.process._
|
|
|
|
|
val devnull = ProcessLogger(_ => ())
|
|
|
|
|
val tagOrSha = ("git describe --exact-match" #|| "git rev-parse HEAD").lineStream(devnull).head
|
2018-02-22 02:33:45 +01:00
|
|
|
Seq(
|
|
|
|
|
"-sourcepath",
|
|
|
|
|
(baseDirectory in LocalRootProject).value.getAbsolutePath,
|
|
|
|
|
"-doc-source-url",
|
2019-03-22 07:28:14 +01:00
|
|
|
s"https://github.com/sbt/sbt/tree/$tagOrSha€{FILE_PATH}.scala"
|
2018-02-22 02:33:45 +01:00
|
|
|
)
|
|
|
|
|
},
|
2018-02-01 15:53:05 +01:00
|
|
|
crossScalaVersions := Seq(baseScalaVersion),
|
|
|
|
|
bintrayPackage := (bintrayPackage in ThisBuild).value,
|
|
|
|
|
bintrayRepository := (bintrayRepository in ThisBuild).value,
|
|
|
|
|
publishArtifact in Test := false,
|
|
|
|
|
fork in compile := true,
|
|
|
|
|
fork in run := true
|
|
|
|
|
)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
def minimalSettings: Seq[Setting[_]] =
|
2015-02-15 04:29:24 +01:00
|
|
|
commonSettings ++ customCommands ++
|
2017-04-21 09:14:31 +02:00
|
|
|
publishPomSettings ++ Release.javaVersionCheckSettings
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
def baseSettings: Seq[Setting[_]] =
|
2017-04-20 01:56:35 +02:00
|
|
|
minimalSettings ++ Seq(projectComponent) ++ baseScalacOptions ++ Licensed.settings
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
def testedBaseSettings: Seq[Setting[_]] =
|
|
|
|
|
baseSettings ++ testDependencies
|
|
|
|
|
|
2019-05-11 09:42:06 +02:00
|
|
|
def sbt10Plus =
|
|
|
|
|
Seq(
|
|
|
|
|
"1.0.0",
|
|
|
|
|
"1.0.1",
|
|
|
|
|
"1.0.2",
|
|
|
|
|
"1.0.3",
|
|
|
|
|
"1.0.4",
|
|
|
|
|
"1.1.0",
|
|
|
|
|
"1.1.1",
|
|
|
|
|
"1.1.2",
|
|
|
|
|
"1.1.3",
|
|
|
|
|
"1.1.4",
|
|
|
|
|
"1.1.5",
|
|
|
|
|
"1.1.6",
|
|
|
|
|
"1.2.0",
|
|
|
|
|
"1.2.1", /*DOA,*/ "1.2.3",
|
|
|
|
|
"1.2.4", /*DOA,*/ "1.2.6",
|
|
|
|
|
"1.2.7",
|
|
|
|
|
"1.2.8",
|
|
|
|
|
) ++ sbt13Plus
|
2019-04-18 09:14:04 +02:00
|
|
|
def sbt13Plus = Seq() // Add sbt 1.3+ stable versions when released
|
|
|
|
|
|
|
|
|
|
def mimaSettings = mimaSettingsSince(sbt10Plus)
|
|
|
|
|
def mimaSettingsSince(versions: Seq[String]) = Def settings (
|
2018-01-10 04:48:07 +01:00
|
|
|
mimaPreviousArtifacts := {
|
2019-04-18 09:14:04 +02:00
|
|
|
val crossVersion = if (crossPaths.value) CrossVersion.binary else CrossVersion.disabled
|
|
|
|
|
versions.map(v => organization.value % moduleName.value % v cross crossVersion).toSet
|
2018-03-12 18:21:22 +01:00
|
|
|
},
|
|
|
|
|
mimaBinaryIssueFilters ++= Seq(
|
2018-08-08 08:57:34 +02:00
|
|
|
// Changes in the internal package
|
2018-03-12 18:21:22 +01:00
|
|
|
exclude[DirectMissingMethodProblem]("sbt.internal.*"),
|
|
|
|
|
exclude[FinalClassProblem]("sbt.internal.*"),
|
|
|
|
|
exclude[FinalMethodProblem]("sbt.internal.*"),
|
|
|
|
|
exclude[IncompatibleResultTypeProblem]("sbt.internal.*"),
|
2018-10-02 16:51:20 +02:00
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.internal.*")
|
2018-03-12 18:21:22 +01:00
|
|
|
),
|
2017-07-20 18:31:39 +02:00
|
|
|
)
|
|
|
|
|
|
2018-07-10 06:58:45 +02:00
|
|
|
val scriptedSbtReduxMimaSettings = Def settings (
|
|
|
|
|
mimaPreviousArtifacts := Set()
|
|
|
|
|
)
|
|
|
|
|
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val sbtRoot: Project = (project in file("."))
|
2017-05-03 16:52:36 +02:00
|
|
|
.enablePlugins(ScriptedPlugin) // , SiteScaladocPlugin, GhpagesPlugin)
|
2017-07-20 04:00:42 +02:00
|
|
|
.configs(Sxr.SxrConf)
|
|
|
|
|
.aggregate(nonRoots: _*)
|
2017-04-21 09:14:31 +02:00
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
buildLevelSettings,
|
|
|
|
|
minimalSettings,
|
2018-10-05 09:04:22 +02:00
|
|
|
onLoadMessage := {
|
2019-03-23 17:31:22 +01:00
|
|
|
val version = sys.props("java.specification.version")
|
2018-10-05 09:04:22 +02:00
|
|
|
""" __ __
|
|
|
|
|
| _____/ /_ / /_
|
|
|
|
|
| / ___/ __ \/ __/
|
|
|
|
|
| (__ ) /_/ / /_
|
|
|
|
|
| /____/_.___/\__/
|
|
|
|
|
|Welcome to the build for sbt.
|
|
|
|
|
|""".stripMargin +
|
2019-05-11 09:42:06 +02:00
|
|
|
(if (version != "1.8")
|
|
|
|
|
s"""!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
2019-03-23 17:31:22 +01:00
|
|
|
| Java version is $version. We recommend java 8.
|
2018-10-05 09:04:22 +02:00
|
|
|
|!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!""".stripMargin
|
2019-05-11 09:42:06 +02:00
|
|
|
else "")
|
2018-10-05 09:04:22 +02:00
|
|
|
},
|
2017-05-08 15:34:41 +02:00
|
|
|
Util.baseScalacOptions,
|
|
|
|
|
Docs.settings,
|
|
|
|
|
Sxr.settings,
|
|
|
|
|
scalacOptions += "-Ymacro-expand:none", // for both sxr and doc
|
|
|
|
|
sources in sxr := {
|
|
|
|
|
val allSources = (sources ?? Nil).all(docProjects).value
|
|
|
|
|
allSources.flatten.distinct
|
|
|
|
|
}, //sxr
|
|
|
|
|
sources in (Compile, doc) := (sources in sxr).value, // doc
|
|
|
|
|
Sxr.sourceDirectories := {
|
|
|
|
|
val allSourceDirectories = (sourceDirectories ?? Nil).all(docProjects).value
|
|
|
|
|
allSourceDirectories.flatten
|
|
|
|
|
},
|
|
|
|
|
fullClasspath in sxr := (externalDependencyClasspath in Compile in sbtProj).value,
|
|
|
|
|
dependencyClasspath in (Compile, doc) := (fullClasspath in sxr).value,
|
|
|
|
|
Util.publishPomSettings,
|
|
|
|
|
otherRootSettings,
|
|
|
|
|
Transform.conscriptSettings(bundledLauncherProj),
|
2015-02-06 20:35:32 +01:00
|
|
|
publish := {},
|
2017-05-30 08:44:13 +02:00
|
|
|
publishLocal := {},
|
2017-11-29 22:45:02 +01:00
|
|
|
skip in publish := true,
|
2019-05-11 09:42:06 +02:00
|
|
|
commands in Global += Command
|
|
|
|
|
.single("sbtOn")((state, dir) => s"sbtProj/test:runMain sbt.RunFromSourceMain $dir" :: state),
|
2015-03-24 21:12:51 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// This is used to configure an sbt-launcher for this version of sbt.
|
|
|
|
|
lazy val bundledLauncherProj =
|
2017-04-21 09:14:31 +02:00
|
|
|
(project in file("launch"))
|
|
|
|
|
.settings(
|
|
|
|
|
minimalSettings,
|
|
|
|
|
inConfig(Compile)(Transform.configSettings),
|
|
|
|
|
Release.launcherSettings(sbtLaunchJar)
|
|
|
|
|
)
|
|
|
|
|
.enablePlugins(SbtLauncherPlugin)
|
|
|
|
|
.settings(
|
|
|
|
|
name := "sbt-launch",
|
|
|
|
|
moduleName := "sbt-launch",
|
|
|
|
|
description := "sbt application launcher",
|
|
|
|
|
autoScalaLibrary := false,
|
|
|
|
|
crossPaths := false,
|
2017-07-20 18:31:39 +02:00
|
|
|
// mimaSettings, // TODO: Configure MiMa, deal with Proguard
|
2017-04-21 09:14:31 +02:00
|
|
|
publish := Release.deployLauncher.value,
|
|
|
|
|
publishLauncher := Release.deployLauncher.value,
|
|
|
|
|
packageBin in Compile := sbtLaunchJar.value
|
|
|
|
|
)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
2014-12-18 19:14:04 +01:00
|
|
|
/* ** subproject declarations ** */
|
2014-12-18 05:38:10 +01:00
|
|
|
|
2017-06-26 12:38:37 +02:00
|
|
|
val collectionProj = (project in file("internal") / "util-collection")
|
|
|
|
|
.settings(
|
|
|
|
|
testedBaseSettings,
|
|
|
|
|
Util.keywordsSettings,
|
|
|
|
|
name := "Collections",
|
2017-07-20 18:31:39 +02:00
|
|
|
libraryDependencies ++= Seq(sjsonNewScalaJson.value),
|
|
|
|
|
mimaSettings,
|
2017-09-22 05:05:48 +02:00
|
|
|
mimaBinaryIssueFilters ++= Seq(
|
|
|
|
|
// Added private[sbt] method to capture State attributes.
|
|
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.internal.util.AttributeMap.setCond"),
|
2017-10-19 02:10:29 +02:00
|
|
|
// Dropped in favour of kind-projector's inline type lambda syntax
|
|
|
|
|
exclude[MissingClassProblem]("sbt.internal.util.TypeFunctions$P1of2"),
|
2017-10-20 00:19:16 +02:00
|
|
|
// Dropped in favour of kind-projector's polymorphic lambda literals
|
|
|
|
|
exclude[MissingClassProblem]("sbt.internal.util.Param"),
|
|
|
|
|
exclude[MissingClassProblem]("sbt.internal.util.Param$"),
|
2017-10-20 05:18:43 +02:00
|
|
|
// Dropped in favour of plain scala.Function, and its compose method
|
|
|
|
|
exclude[MissingClassProblem]("sbt.internal.util.Fn1"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.internal.util.TypeFunctions.toFn1"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.internal.util.Types.toFn1"),
|
2017-12-04 16:50:45 +01:00
|
|
|
// Instead of defining foldr in KList & overriding in KCons,
|
|
|
|
|
// it's now abstract in KList and defined in both KCons & KNil.
|
|
|
|
|
exclude[FinalMethodProblem]("sbt.internal.util.KNil.foldr"),
|
|
|
|
|
exclude[DirectAbstractMethodProblem]("sbt.internal.util.KList.foldr"),
|
2017-09-22 05:05:48 +02:00
|
|
|
),
|
2017-06-26 12:38:37 +02:00
|
|
|
)
|
|
|
|
|
.configure(addSbtUtilPosition)
|
|
|
|
|
|
|
|
|
|
// Command line-related utilities.
|
|
|
|
|
val completeProj = (project in file("internal") / "util-complete")
|
|
|
|
|
.dependsOn(collectionProj)
|
|
|
|
|
.settings(
|
|
|
|
|
testedBaseSettings,
|
|
|
|
|
name := "Completion",
|
2017-07-20 18:31:39 +02:00
|
|
|
libraryDependencies += jline,
|
|
|
|
|
mimaSettings,
|
2018-07-16 04:28:55 +02:00
|
|
|
// Parser is used publicly, so we can't break bincompat.
|
|
|
|
|
mimaBinaryIssueFilters := Seq(
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.internal.util.complete.History.this"),
|
2017-12-04 17:18:08 +01:00
|
|
|
),
|
2017-06-26 12:38:37 +02:00
|
|
|
)
|
2018-11-17 08:05:51 +01:00
|
|
|
.configure(addSbtIO, addSbtUtilControl, addSbtUtilLogging)
|
2017-06-26 12:38:37 +02:00
|
|
|
|
|
|
|
|
// A logic with restricted negation as failure for a unique, stable model
|
|
|
|
|
val logicProj = (project in file("internal") / "util-logic")
|
|
|
|
|
.dependsOn(collectionProj)
|
|
|
|
|
.settings(
|
|
|
|
|
testedBaseSettings,
|
2017-07-20 18:31:39 +02:00
|
|
|
name := "Logic",
|
|
|
|
|
mimaSettings,
|
2017-06-26 12:38:37 +02:00
|
|
|
)
|
|
|
|
|
.configure(addSbtUtilRelation)
|
|
|
|
|
|
2014-12-18 05:38:10 +01:00
|
|
|
/* **** Intermediate-level Modules **** */
|
|
|
|
|
|
|
|
|
|
// Runner for uniform test interface
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val testingProj = (project in file("testing"))
|
|
|
|
|
.enablePlugins(ContrabandPlugin, JsonCodecPlugin)
|
|
|
|
|
.dependsOn(testAgentProj)
|
|
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
baseSettings,
|
2014-12-18 05:38:10 +01:00
|
|
|
name := "Testing",
|
2019-05-11 09:42:06 +02:00
|
|
|
libraryDependencies ++= scalaXml.value ++ Seq(
|
|
|
|
|
testInterface,
|
|
|
|
|
launcherInterface,
|
|
|
|
|
sjsonNewScalaJson.value
|
|
|
|
|
),
|
2018-09-18 17:47:55 +02:00
|
|
|
Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates",
|
2017-04-19 07:50:18 +02:00
|
|
|
managedSourceDirectories in Compile +=
|
|
|
|
|
baseDirectory.value / "src" / "main" / "contraband-scala",
|
2017-04-01 23:19:45 +02:00
|
|
|
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
|
2017-07-20 18:31:39 +02:00
|
|
|
contrabandFormatsForType in generateContrabands in Compile := ContrabandConfig.getFormats,
|
|
|
|
|
mimaSettings,
|
2018-03-07 21:31:24 +01:00
|
|
|
mimaBinaryIssueFilters ++= Seq(
|
|
|
|
|
// private[sbt]
|
2018-03-27 15:12:01 +02:00
|
|
|
exclude[IncompatibleMethTypeProblem]("sbt.TestStatus.write"),
|
|
|
|
|
exclude[IncompatibleResultTypeProblem]("sbt.TestStatus.read"),
|
2018-03-12 16:18:42 +01:00
|
|
|
// copy method was never meant to be public
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.testing.EndTestGroupErrorEvent.copy"),
|
2019-05-11 09:42:06 +02:00
|
|
|
exclude[DirectMissingMethodProblem](
|
|
|
|
|
"sbt.protocol.testing.EndTestGroupErrorEvent.copy$default$*"
|
|
|
|
|
),
|
2018-03-12 16:18:42 +01:00
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.testing.EndTestGroupEvent.copy"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.testing.EndTestGroupEvent.copy$default$*"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.testing.StartTestGroupEvent.copy"),
|
2019-05-11 09:42:06 +02:00
|
|
|
exclude[DirectMissingMethodProblem](
|
|
|
|
|
"sbt.protocol.testing.StartTestGroupEvent.copy$default$*"
|
|
|
|
|
),
|
2018-03-12 16:18:42 +01:00
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.testing.TestCompleteEvent.copy"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.testing.TestCompleteEvent.copy$default$*"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.testing.TestInitEvent.copy"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.testing.TestItemDetail.copy"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.testing.TestItemDetail.copy$default$*"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.testing.TestItemEvent.copy"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.testing.TestItemEvent.copy$default$*"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.testing.TestStringEvent.copy"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.testing.TestStringEvent.copy$default$1"),
|
2018-04-23 19:46:08 +02:00
|
|
|
//no reason to use
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.JUnitXmlTestsListener.testSuite"),
|
2018-03-12 16:18:42 +01:00
|
|
|
)
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
|
|
|
|
.configure(addSbtIO, addSbtCompilerClasspath, addSbtUtilLogging)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
// Testing agent for running tests in a separate process.
|
2017-05-24 11:15:22 +02:00
|
|
|
lazy val testAgentProj = (project in file("testing") / "agent")
|
|
|
|
|
.settings(
|
|
|
|
|
minimalSettings,
|
|
|
|
|
crossScalaVersions := Seq(baseScalaVersion),
|
|
|
|
|
crossPaths := false,
|
|
|
|
|
autoScalaLibrary := false,
|
|
|
|
|
name := "Test Agent",
|
2017-07-20 18:31:39 +02:00
|
|
|
libraryDependencies += testInterface,
|
|
|
|
|
mimaSettings,
|
2017-05-24 11:15:22 +02:00
|
|
|
)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
// Basic task engine
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val taskProj = (project in file("tasks"))
|
2017-06-26 12:38:37 +02:00
|
|
|
.dependsOn(collectionProj)
|
2017-04-21 09:14:31 +02:00
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
testedBaseSettings,
|
2017-07-20 18:31:39 +02:00
|
|
|
name := "Tasks",
|
|
|
|
|
mimaSettings,
|
2019-03-08 21:26:15 +01:00
|
|
|
mimaBinaryIssueFilters ++= Seq(
|
2019-03-18 02:17:39 +01:00
|
|
|
// ok because sbt.ExecuteProgress has been under private[sbt]
|
|
|
|
|
exclude[IncompatibleResultTypeProblem]("sbt.ExecuteProgress.initial"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.ExecuteProgress.*"),
|
|
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.ExecuteProgress.*"),
|
2019-03-08 21:26:15 +01:00
|
|
|
)
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
2017-06-26 12:38:37 +02:00
|
|
|
.configure(addSbtUtilControl)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
// Standard task system. This provides map, flatMap, join, and more on top of the basic task model.
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val stdTaskProj = (project in file("tasks-standard"))
|
2017-06-26 12:38:37 +02:00
|
|
|
.dependsOn(collectionProj)
|
2017-04-21 09:14:31 +02:00
|
|
|
.dependsOn(taskProj % "compile;test->test")
|
|
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
testedBaseSettings,
|
2014-12-18 05:38:10 +01:00
|
|
|
name := "Task System",
|
2017-07-20 18:31:39 +02:00
|
|
|
testExclusive,
|
|
|
|
|
mimaSettings,
|
2019-05-29 15:43:14 +02:00
|
|
|
mimaBinaryIssueFilters ++= Seq(
|
|
|
|
|
// unused private[sbt]
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.Task.mapTask"),
|
|
|
|
|
),
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
2017-06-26 12:38:37 +02:00
|
|
|
.configure(addSbtIO, addSbtUtilLogging, addSbtUtilCache)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
// Embedded Scala code runner
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val runProj = (project in file("run"))
|
2017-06-16 22:11:33 +02:00
|
|
|
.enablePlugins(ContrabandPlugin)
|
2017-07-22 09:34:10 +02:00
|
|
|
.dependsOn(collectionProj)
|
2017-04-21 09:14:31 +02:00
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
testedBaseSettings,
|
2017-05-12 00:33:12 +02:00
|
|
|
name := "Run",
|
2018-09-18 17:47:55 +02:00
|
|
|
Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates",
|
2017-05-12 00:33:12 +02:00
|
|
|
managedSourceDirectories in Compile +=
|
|
|
|
|
baseDirectory.value / "src" / "main" / "contraband-scala",
|
2017-07-20 18:31:39 +02:00
|
|
|
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
|
|
|
|
|
mimaSettings,
|
2018-03-12 16:18:42 +01:00
|
|
|
mimaBinaryIssueFilters ++= Seq(
|
|
|
|
|
// copy method was never meant to be public
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.ForkOptions.copy"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.ForkOptions.copy$default$*"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.OutputStrategy#BufferedOutput.copy"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.OutputStrategy#BufferedOutput.copy$default$*"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.OutputStrategy#CustomOutput.copy"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.OutputStrategy#CustomOutput.copy$default$*"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.OutputStrategy#LoggedOutput.copy"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.OutputStrategy#LoggedOutput.copy$default$*"),
|
|
|
|
|
)
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
2018-06-27 13:09:59 +02:00
|
|
|
.configure(addSbtIO, addSbtUtilLogging, addSbtUtilControl, addSbtCompilerClasspath)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
2018-02-01 15:53:11 +01:00
|
|
|
val sbtProjDepsCompileScopeFilter =
|
2019-05-11 09:42:06 +02:00
|
|
|
ScopeFilter(
|
|
|
|
|
inDependencies(LocalProject("sbtProj"), includeRoot = false),
|
|
|
|
|
inConfigurations(Compile)
|
|
|
|
|
)
|
2018-02-01 15:53:11 +01:00
|
|
|
|
2018-07-10 06:58:45 +02:00
|
|
|
lazy val scriptedSbtReduxProj = (project in file("scripted-sbt-redux"))
|
2017-04-21 09:14:31 +02:00
|
|
|
.dependsOn(commandProj)
|
|
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
baseSettings,
|
2018-07-10 06:58:45 +02:00
|
|
|
name := "Scripted sbt Redux",
|
2017-07-20 18:31:39 +02:00
|
|
|
libraryDependencies ++= Seq(launcherInterface % "provided"),
|
2018-02-01 15:53:11 +01:00
|
|
|
resourceGenerators in Compile += Def task {
|
|
|
|
|
val mainClassDir = (classDirectory in Compile in LocalProject("sbtProj")).value
|
|
|
|
|
val testClassDir = (classDirectory in Test in LocalProject("sbtProj")).value
|
|
|
|
|
val classDirs = (classDirectory all sbtProjDepsCompileScopeFilter).value
|
|
|
|
|
val extDepsCp = (externalDependencyClasspath in Compile in LocalProject("sbtProj")).value
|
|
|
|
|
val cpStrings = (mainClassDir +: testClassDir +: classDirs) ++ extDepsCp.files map (_.toString)
|
|
|
|
|
val file = (resourceManaged in Compile).value / "RunFromSource.classpath"
|
2019-07-27 21:47:00 +02:00
|
|
|
if (!file.exists || Try(IO.readLines(file)).getOrElse(Nil).toSet != cpStrings.toSet) {
|
|
|
|
|
IO.writeLines(file, cpStrings)
|
|
|
|
|
}
|
2018-02-01 15:53:11 +01:00
|
|
|
List(file)
|
|
|
|
|
},
|
2017-07-20 18:31:39 +02:00
|
|
|
mimaSettings,
|
2018-07-10 06:58:45 +02:00
|
|
|
scriptedSbtReduxMimaSettings,
|
|
|
|
|
)
|
|
|
|
|
.configure(addSbtIO, addSbtUtilLogging, addSbtCompilerInterface, addSbtUtilScripted, addSbtLmCore)
|
|
|
|
|
|
|
|
|
|
lazy val scriptedSbtOldProj = (project in file("scripted-sbt-old"))
|
|
|
|
|
.dependsOn(scriptedSbtReduxProj)
|
|
|
|
|
.settings(
|
|
|
|
|
baseSettings,
|
|
|
|
|
name := "Scripted sbt",
|
|
|
|
|
mimaSettings,
|
2018-01-13 23:08:48 +01:00
|
|
|
mimaBinaryIssueFilters ++= Seq(
|
|
|
|
|
// sbt.test package is renamed to sbt.scriptedtest.
|
|
|
|
|
exclude[MissingClassProblem]("sbt.test.*"),
|
2018-07-10 06:58:45 +02:00
|
|
|
exclude[DirectMissingMethodProblem]("sbt.test.*"),
|
|
|
|
|
exclude[IncompatibleMethTypeProblem]("sbt.test.*"),
|
2018-01-13 23:08:48 +01:00
|
|
|
),
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
2018-07-10 06:58:45 +02:00
|
|
|
lazy val scriptedPluginProj = (project in file("scripted-plugin"))
|
2017-04-21 09:14:31 +02:00
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
baseSettings,
|
2017-07-20 18:31:39 +02:00
|
|
|
name := "Scripted Plugin",
|
|
|
|
|
mimaSettings,
|
2018-01-13 20:28:06 +01:00
|
|
|
mimaBinaryIssueFilters ++= Seq(
|
2018-01-13 23:08:48 +01:00
|
|
|
// scripted plugin has moved into sbt mothership.
|
|
|
|
|
exclude[MissingClassProblem]("sbt.ScriptedPlugin*")
|
2018-01-13 20:28:06 +01:00
|
|
|
),
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
// Implementation and support code for defining actions.
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val actionsProj = (project in file("main-actions"))
|
2017-06-26 12:38:37 +02:00
|
|
|
.dependsOn(completeProj, runProj, stdTaskProj, taskProj, testingProj)
|
2017-04-21 09:14:31 +02:00
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
testedBaseSettings,
|
2016-11-30 14:42:51 +01:00
|
|
|
name := "Actions",
|
2017-07-20 18:31:39 +02:00
|
|
|
libraryDependencies += sjsonNewScalaJson.value,
|
|
|
|
|
mimaSettings,
|
2017-12-05 17:16:26 +01:00
|
|
|
mimaBinaryIssueFilters ++= Seq(
|
|
|
|
|
// Removed unused private[sbt] nested class
|
|
|
|
|
exclude[MissingClassProblem]("sbt.Doc$Scaladoc"),
|
|
|
|
|
// Removed no longer used private[sbt] method
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.Doc.generate"),
|
2018-04-05 08:14:00 +02:00
|
|
|
exclude[DirectMissingMethodProblem]("sbt.compiler.Eval.filesModifiedBytes"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.compiler.Eval.fileModifiedBytes"),
|
2017-12-05 17:16:26 +01:00
|
|
|
),
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
|
|
|
|
.configure(
|
|
|
|
|
addSbtIO,
|
|
|
|
|
addSbtUtilLogging,
|
|
|
|
|
addSbtUtilRelation,
|
2017-07-16 00:09:40 +02:00
|
|
|
addSbtUtilTracking,
|
2017-06-26 12:38:37 +02:00
|
|
|
addSbtCompilerInterface,
|
|
|
|
|
addSbtCompilerClasspath,
|
|
|
|
|
addSbtCompilerApiInfo,
|
2017-07-16 00:09:40 +02:00
|
|
|
addSbtLmCore,
|
2017-06-26 12:38:37 +02:00
|
|
|
addSbtZinc
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
lazy val protocolProj = (project in file("protocol"))
|
2017-06-16 22:11:33 +02:00
|
|
|
.enablePlugins(ContrabandPlugin, JsonCodecPlugin)
|
2018-01-24 09:56:42 +01:00
|
|
|
.dependsOn(collectionProj)
|
2017-04-21 09:14:31 +02:00
|
|
|
.settings(
|
2016-12-01 09:14:07 +01:00
|
|
|
testedBaseSettings,
|
|
|
|
|
name := "Protocol",
|
2018-01-30 06:43:30 +01:00
|
|
|
libraryDependencies ++= Seq(sjsonNewScalaJson.value, ipcSocket),
|
2018-09-18 17:47:55 +02:00
|
|
|
Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates",
|
2017-04-19 07:50:18 +02:00
|
|
|
managedSourceDirectories in Compile +=
|
|
|
|
|
baseDirectory.value / "src" / "main" / "contraband-scala",
|
2017-03-20 17:44:57 +01:00
|
|
|
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
|
2017-07-20 18:31:39 +02:00
|
|
|
contrabandFormatsForType in generateContrabands in Compile := ContrabandConfig.getFormats,
|
|
|
|
|
mimaSettings,
|
2018-03-12 16:18:42 +01:00
|
|
|
mimaBinaryIssueFilters ++= Seq(
|
|
|
|
|
// copy method was never meant to be public
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.ChannelAcceptedEvent.copy"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.ChannelAcceptedEvent.copy$default$1"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.ExecCommand.copy"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.ExecCommand.copy$default$1"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.ExecCommand.copy$default$2"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.ExecStatusEvent.copy"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.ExecStatusEvent.copy$default$*"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.ExecutionEvent.copy"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.ExecutionEvent.copy$default$*"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.InitCommand.copy"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.InitCommand.copy$default$*"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.LogEvent.copy"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.LogEvent.copy$default$*"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.SettingQuery.copy"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.SettingQuery.copy$default$1"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.SettingQueryFailure.copy"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.SettingQueryFailure.copy$default$*"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.SettingQuerySuccess.copy"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.protocol.SettingQuerySuccess.copy$default$*"),
|
|
|
|
|
// ignore missing methods in sbt.internal
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.internal.*"),
|
|
|
|
|
)
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
|
|
|
|
.configure(addSbtUtilLogging)
|
2016-12-01 09:14:07 +01:00
|
|
|
|
2014-12-18 05:38:10 +01:00
|
|
|
// General command support and core commands not specific to a build system
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val commandProj = (project in file("main-command"))
|
2017-06-16 22:11:33 +02:00
|
|
|
.enablePlugins(ContrabandPlugin, JsonCodecPlugin)
|
2017-06-26 12:38:37 +02:00
|
|
|
.dependsOn(protocolProj, completeProj)
|
2017-04-21 09:14:31 +02:00
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
testedBaseSettings,
|
2015-03-24 16:14:13 +01:00
|
|
|
name := "Command",
|
2017-12-19 06:44:31 +01:00
|
|
|
libraryDependencies ++= Seq(launcherInterface, sjsonNewScalaJson.value, templateResolverApi),
|
2018-09-18 17:47:55 +02:00
|
|
|
Compile / scalacOptions += "-Ywarn-unused:-locals,-explicits,-privates",
|
2018-08-24 22:10:18 +02:00
|
|
|
// Removing -Xfatal-warnings is necessary because BasicKeys contains a Key for a deprecated class.
|
|
|
|
|
Compile / scalacOptions -= "-Xfatal-warnings",
|
2017-04-19 07:50:18 +02:00
|
|
|
managedSourceDirectories in Compile +=
|
|
|
|
|
baseDirectory.value / "src" / "main" / "contraband-scala",
|
2016-11-30 14:42:51 +01:00
|
|
|
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
|
2017-07-20 18:31:39 +02:00
|
|
|
contrabandFormatsForType in generateContrabands in Compile := ContrabandConfig.getFormats,
|
|
|
|
|
mimaSettings,
|
2017-09-18 01:08:45 +02:00
|
|
|
mimaBinaryIssueFilters ++= Vector(
|
2018-04-26 15:03:35 +02:00
|
|
|
// dropped private[sbt] method
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.BasicCommands.compatCommands"),
|
|
|
|
|
// dropped mainly internal command strings holder
|
|
|
|
|
exclude[MissingClassProblem]("sbt.BasicCommandStrings$Compat$"),
|
2018-01-10 04:48:07 +01:00
|
|
|
exclude[DirectMissingMethodProblem]("sbt.BasicCommands.rebootOptionParser"),
|
2017-09-18 01:08:45 +02:00
|
|
|
// Changed the signature of Server method. nacho cheese.
|
2017-09-22 05:05:48 +02:00
|
|
|
exclude[DirectMissingMethodProblem]("sbt.internal.server.Server.*"),
|
|
|
|
|
// Added method to ServerInstance. This is also internal.
|
|
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.internal.server.ServerInstance.*"),
|
2017-10-02 21:52:02 +02:00
|
|
|
// Added method to CommandChannel. internal.
|
|
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.internal.CommandChannel.*"),
|
2017-10-21 08:27:40 +02:00
|
|
|
// Added an overload to reboot. The overload is private[sbt].
|
|
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.StateOps.reboot"),
|
2018-01-30 06:43:30 +01:00
|
|
|
// Replace nailgun socket stuff
|
|
|
|
|
exclude[MissingClassProblem]("sbt.internal.NG*"),
|
|
|
|
|
exclude[MissingClassProblem]("sbt.internal.ReferenceCountedFileDescriptor"),
|
2018-03-12 18:13:17 +01:00
|
|
|
// made private[sbt] method private[this]
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.State.handleException"),
|
2018-03-12 16:18:42 +01:00
|
|
|
// copy method was never meant to be public
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.CommandSource.copy"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.CommandSource.copy$default$*"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.Exec.copy"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.Exec.copy$default$*"),
|
2018-06-26 04:34:55 +02:00
|
|
|
// internal
|
|
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.internal.client.ServerConnection.*"),
|
2017-11-28 03:37:31 +01:00
|
|
|
),
|
|
|
|
|
unmanagedSources in (Compile, headerCreate) := {
|
|
|
|
|
val old = (unmanagedSources in (Compile, headerCreate)).value
|
2019-05-11 09:42:06 +02:00
|
|
|
old filterNot { x =>
|
|
|
|
|
(x.getName startsWith "NG") || (x.getName == "ReferenceCountedFileDescriptor.java")
|
|
|
|
|
}
|
2017-11-28 03:37:31 +01:00
|
|
|
},
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
2017-06-23 18:58:00 +02:00
|
|
|
.configure(
|
|
|
|
|
addSbtIO,
|
|
|
|
|
addSbtUtilLogging,
|
2017-06-26 12:38:37 +02:00
|
|
|
addSbtCompilerInterface,
|
2017-06-23 18:58:00 +02:00
|
|
|
addSbtCompilerClasspath,
|
Add global file repository task
Every time that the compile task is run, there are potentially a large
number of iops that must occur in order for sbt to generate the source
file list as well as for zinc to check which files have changed since
the last build. This can lead to a noticeable delay between when a build
is started (either manually or by triggered execution) and when
compilation actually begins. To reduce this latency, I am adding a
global view of the file system that will be stored in
BasicKeys.globalFileTreeView.
To make this work, I introduce the StampedFile trait, which augments the
java.io.File class with a stamp method that returns the zinc stamp for
the file. For source files, this will be a hash of the file, while for
binaries, it is just the last modified time. In order to gain access to
the sbt.internal.inc.Stamper class, I had to append addSbtZinc to the
commandProj configurations.
This view may or may not use an in-memory cache of the file system tree
to return the results. Because there is always the risk of the cache
getting out of sync with the actual file system, I both make it optional
to use a cache and provide a mechanism for flushing the cache. Moreover,
the in-memory cache implementation in sbt.io, which is backed by a
swoval FileTreeRepository, has the property that touching a monitored
directory invalidates the entire directory within the cache, so the
flush command isn't even strictly needed in general.
Because caching is optional, the global is of a FileTreeDataView, which
doesn't specify a caching strategy. Subsequent commits will make use of
this to potentially speed up incremental compilation by caching the
Stamps of the source files so that zinc does not need to compute the
hashes itself and will allow for continuous builds to use the cache to
monitor events instead of creating a new, standalone FileEventMonitor.
2018-08-26 01:43:48 +02:00
|
|
|
addSbtLmCore,
|
|
|
|
|
addSbtZinc
|
2017-06-23 18:58:00 +02:00
|
|
|
)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
2017-05-23 23:48:20 +02:00
|
|
|
// The core macro project defines the main logic of the DSL, abstracted
|
2019-07-28 05:49:24 +02:00
|
|
|
// away from several sbt implementors (tasks, settings, et cetera).
|
2017-05-23 23:53:04 +02:00
|
|
|
lazy val coreMacrosProj = (project in file("core-macros"))
|
2017-06-26 12:38:37 +02:00
|
|
|
.dependsOn(collectionProj)
|
2017-05-23 23:53:04 +02:00
|
|
|
.settings(
|
2017-12-04 16:56:07 +01:00
|
|
|
baseSettings,
|
2017-05-23 23:48:20 +02:00
|
|
|
name := "Core Macros",
|
2017-07-20 18:31:39 +02:00
|
|
|
libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value,
|
|
|
|
|
mimaSettings,
|
2017-05-23 23:48:20 +02:00
|
|
|
)
|
|
|
|
|
|
2014-12-18 05:38:10 +01:00
|
|
|
// Fixes scope=Scope for Setting (core defined in collectionProj) to define the settings system used in build definitions
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val mainSettingsProj = (project in file("main-settings"))
|
2017-06-26 12:38:37 +02:00
|
|
|
.dependsOn(completeProj, commandProj, stdTaskProj, coreMacrosProj)
|
2017-04-21 09:14:31 +02:00
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
testedBaseSettings,
|
2017-05-24 10:27:51 +02:00
|
|
|
name := "Main Settings",
|
2018-01-26 17:02:30 +01:00
|
|
|
BuildInfoPlugin.buildInfoDefaultSettings,
|
|
|
|
|
addBuildInfoToConfig(Test),
|
|
|
|
|
buildInfoObject in Test := "TestBuildInfo",
|
|
|
|
|
buildInfoKeys in Test := Seq[BuildInfoKey](
|
|
|
|
|
classDirectory in Compile,
|
|
|
|
|
classDirectory in Test,
|
|
|
|
|
// WORKAROUND https://github.com/sbt/sbt-buildinfo/issues/117
|
2019-05-11 09:42:06 +02:00
|
|
|
BuildInfoKey.map((dependencyClasspath in Compile).taskValue) {
|
|
|
|
|
case (ident, cp) => ident -> cp.files
|
|
|
|
|
},
|
2018-01-26 17:02:30 +01:00
|
|
|
),
|
2017-07-20 18:31:39 +02:00
|
|
|
mimaSettings,
|
2018-01-10 04:48:07 +01:00
|
|
|
mimaBinaryIssueFilters ++= Seq(
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.Scope.display012StyleMasked"),
|
2018-03-27 02:36:41 +02:00
|
|
|
// added a method to a sealed trait
|
|
|
|
|
exclude[InheritedNewAbstractMethodProblem]("sbt.Scoped.canEqual"),
|
|
|
|
|
exclude[InheritedNewAbstractMethodProblem]("sbt.ScopedTaskable.canEqual"),
|
2018-01-10 04:48:07 +01:00
|
|
|
),
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
|
|
|
|
.configure(
|
2017-06-26 12:38:37 +02:00
|
|
|
addSbtIO,
|
|
|
|
|
addSbtUtilLogging,
|
2017-04-21 09:14:31 +02:00
|
|
|
addSbtUtilCache,
|
|
|
|
|
addSbtUtilRelation,
|
2017-06-26 12:38:37 +02:00
|
|
|
addSbtCompilerInterface,
|
2017-04-21 09:14:31 +02:00
|
|
|
addSbtCompilerClasspath,
|
2017-07-16 00:09:40 +02:00
|
|
|
addSbtLmCore
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
2019-04-18 09:14:04 +02:00
|
|
|
lazy val zincLmIntegrationProj = (project in file("zinc-lm-integration"))
|
|
|
|
|
.enablePlugins(BuildInfoPlugin)
|
|
|
|
|
.settings(
|
|
|
|
|
name := "Zinc LM Integration",
|
|
|
|
|
testedBaseSettings,
|
|
|
|
|
buildInfo in Compile := Nil, // Only generate build info for tests
|
|
|
|
|
BuildInfoPlugin.buildInfoScopedSettings(Test),
|
|
|
|
|
buildInfoPackage in Test := "sbt.internal.inc",
|
|
|
|
|
buildInfoObject in Test := "ZincLmIntegrationBuildInfo",
|
|
|
|
|
buildInfoKeys in Test := List[BuildInfoKey]("zincVersion" -> zincVersion),
|
|
|
|
|
mimaSettingsSince(sbt13Plus),
|
2019-05-09 03:26:15 +02:00
|
|
|
libraryDependencies += launcherInterface,
|
2019-04-18 09:14:04 +02:00
|
|
|
)
|
|
|
|
|
.configure(addSbtZincCompileCore, addSbtLmCore, addSbtLmIvyTest)
|
|
|
|
|
|
2016-11-23 16:17:34 +01:00
|
|
|
// The main integration project for sbt. It brings all of the projects together, configures them, and provides for overriding conventions.
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val mainProj = (project in file("main"))
|
2017-06-16 22:11:33 +02:00
|
|
|
.enablePlugins(ContrabandPlugin)
|
2019-05-11 09:42:06 +02:00
|
|
|
.dependsOn(
|
|
|
|
|
logicProj,
|
|
|
|
|
actionsProj,
|
|
|
|
|
mainSettingsProj,
|
|
|
|
|
runProj,
|
|
|
|
|
commandProj,
|
|
|
|
|
collectionProj,
|
|
|
|
|
scriptedSbtReduxProj,
|
|
|
|
|
scriptedPluginProj,
|
|
|
|
|
zincLmIntegrationProj
|
|
|
|
|
)
|
2017-04-21 09:14:31 +02:00
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
testedBaseSettings,
|
2014-12-18 05:38:10 +01:00
|
|
|
name := "Main",
|
2018-10-05 19:32:40 +02:00
|
|
|
checkPluginCross := {
|
|
|
|
|
val sv = scalaVersion.value
|
2019-05-11 09:42:06 +02:00
|
|
|
val xs =
|
|
|
|
|
IO.readLines(baseDirectory.value / "src" / "main" / "scala" / "sbt" / "PluginCross.scala")
|
|
|
|
|
if (xs exists { s =>
|
|
|
|
|
s.contains(s""""$sv"""")
|
|
|
|
|
}) ()
|
2018-10-05 19:32:40 +02:00
|
|
|
else sys.error("PluginCross.scala does not match up with the scalaVersion " + sv)
|
|
|
|
|
},
|
2019-03-09 02:15:04 +01:00
|
|
|
libraryDependencies ++= {
|
|
|
|
|
scalaXml.value ++
|
2019-05-11 09:42:06 +02:00
|
|
|
Seq(launcherInterface) ++
|
|
|
|
|
log4jDependencies ++
|
|
|
|
|
Seq(scalaCacheCaffeine, lmCoursierShaded)
|
2019-03-09 02:15:04 +01:00
|
|
|
},
|
2018-09-18 17:47:55 +02:00
|
|
|
Compile / scalacOptions -= "-Xfatal-warnings",
|
2017-05-13 14:01:51 +02:00
|
|
|
managedSourceDirectories in Compile +=
|
|
|
|
|
baseDirectory.value / "src" / "main" / "contraband-scala",
|
2017-07-20 18:31:39 +02:00
|
|
|
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
|
2019-05-11 09:41:41 +02:00
|
|
|
testOptions in Test += Tests
|
2019-05-11 10:52:42 +02:00
|
|
|
.Argument(TestFrameworks.ScalaCheck, "-minSuccessfulTests", "1000"),
|
2017-07-20 18:31:39 +02:00
|
|
|
mimaSettings,
|
2017-09-22 05:05:48 +02:00
|
|
|
mimaBinaryIssueFilters ++= Vector(
|
2017-09-27 08:21:56 +02:00
|
|
|
// New and changed methods on KeyIndex. internal.
|
|
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.internal.KeyIndex.*"),
|
2019-01-04 15:55:28 +01:00
|
|
|
// internal
|
|
|
|
|
exclude[IncompatibleMethTypeProblem]("sbt.internal.server.LanguageServerReporter.*"),
|
2017-12-14 14:41:40 +01:00
|
|
|
// Changed signature or removed private[sbt] methods
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.Classpaths.unmanagedLibs0"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.Defaults.allTestGroupsTask"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.Plugins.topologicalSort"),
|
|
|
|
|
exclude[IncompatibleMethTypeProblem]("sbt.Defaults.allTestGroupsTask"),
|
2019-05-13 20:39:34 +02:00
|
|
|
exclude[DirectMissingMethodProblem]("sbt.StandardMain.shutdownHook")
|
2017-09-22 05:05:48 +02:00
|
|
|
)
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
2017-06-23 18:58:00 +02:00
|
|
|
.configure(
|
|
|
|
|
addSbtIO,
|
|
|
|
|
addSbtUtilLogging,
|
2017-07-16 00:09:40 +02:00
|
|
|
addSbtLmCore,
|
2018-10-02 17:24:28 +02:00
|
|
|
addSbtLmImpl,
|
2017-06-26 12:38:37 +02:00
|
|
|
addSbtCompilerInterface,
|
2017-08-10 17:23:15 +02:00
|
|
|
addSbtZincCompile
|
|
|
|
|
)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
// Strictly for bringing implicits and aliases from subsystems into the top-level sbt namespace through a single package object
|
|
|
|
|
// technically, we need a dependency on all of mainProj's dependencies, but we don't do that since this is strictly an integration project
|
|
|
|
|
// with the sole purpose of providing certain identifiers without qualification (with a package object)
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val sbtProj = (project in file("sbt"))
|
2018-07-10 06:58:45 +02:00
|
|
|
.dependsOn(mainProj, scriptedSbtReduxProj % "test->test")
|
2017-04-21 09:14:31 +02:00
|
|
|
.settings(
|
2018-01-24 09:56:42 +01:00
|
|
|
testedBaseSettings,
|
2014-12-18 05:38:10 +01:00
|
|
|
name := "sbt",
|
2015-09-14 09:27:22 +02:00
|
|
|
normalizedName := "sbt",
|
2017-01-15 07:44:05 +01:00
|
|
|
crossScalaVersions := Seq(baseScalaVersion),
|
2017-07-20 18:31:39 +02:00
|
|
|
crossPaths := false,
|
2017-11-23 15:58:26 +01:00
|
|
|
javaOptions ++= Seq("-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"),
|
2017-07-20 18:31:39 +02:00
|
|
|
mimaSettings,
|
2017-08-28 06:42:26 +02:00
|
|
|
mimaBinaryIssueFilters ++= sbtIgnoredProblems,
|
2017-12-26 08:32:29 +01:00
|
|
|
BuildInfoPlugin.buildInfoDefaultSettings,
|
2017-11-23 15:58:26 +01:00
|
|
|
addBuildInfoToConfig(Test),
|
2017-12-26 08:32:29 +01:00
|
|
|
BuildInfoPlugin.buildInfoDefaultSettings,
|
2017-11-23 15:58:26 +01:00
|
|
|
buildInfoObject in Test := "TestBuildInfo",
|
2018-02-01 14:38:00 +01:00
|
|
|
buildInfoKeys in Test := Seq[BuildInfoKey](
|
2018-04-29 20:31:30 +02:00
|
|
|
version,
|
2018-02-22 17:48:09 +01:00
|
|
|
// WORKAROUND https://github.com/sbt/sbt-buildinfo/issues/117
|
2019-05-11 09:42:06 +02:00
|
|
|
BuildInfoKey.map((fullClasspath in Compile).taskValue) {
|
|
|
|
|
case (ident, cp) => ident -> cp.files
|
|
|
|
|
},
|
|
|
|
|
BuildInfoKey.map((dependencyClasspath in Compile).taskValue) {
|
|
|
|
|
case (ident, cp) => ident -> cp.files
|
|
|
|
|
},
|
2018-03-23 18:07:28 +01:00
|
|
|
classDirectory in Compile,
|
|
|
|
|
classDirectory in Test,
|
2018-02-01 14:38:00 +01:00
|
|
|
),
|
2018-03-26 16:37:25 +02:00
|
|
|
Test / run / connectInput := true,
|
|
|
|
|
Test / run / outputStrategy := Some(StdoutOutput),
|
|
|
|
|
Test / run / fork := true,
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
2019-02-18 23:00:48 +01:00
|
|
|
.configure(addSbtIO, addSbtCompilerBridge)
|
2017-10-20 05:18:43 +02:00
|
|
|
|
2019-03-09 02:15:04 +01:00
|
|
|
/*
|
2018-10-24 17:19:28 +02:00
|
|
|
lazy val sbtBig = (project in file(".big"))
|
|
|
|
|
.dependsOn(sbtProj)
|
|
|
|
|
.settings(
|
|
|
|
|
name := "sbt-big",
|
|
|
|
|
normalizedName := "sbt-big",
|
|
|
|
|
crossPaths := false,
|
|
|
|
|
assemblyShadeRules.in(assembly) := {
|
|
|
|
|
val packagesToBeShaded = Seq(
|
|
|
|
|
"fastparse",
|
|
|
|
|
"jawn",
|
|
|
|
|
"scalapb",
|
|
|
|
|
)
|
|
|
|
|
packagesToBeShaded.map( prefix => {
|
|
|
|
|
ShadeRule.rename(s"$prefix.**" -> s"sbt.internal.$prefix.@1").inAll
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
assemblyMergeStrategy in assembly := {
|
|
|
|
|
case "LICENSE" | "NOTICE" => MergeStrategy.first
|
|
|
|
|
case x => (assemblyMergeStrategy in assembly).value(x)
|
|
|
|
|
},
|
|
|
|
|
artifact.in(Compile, packageBin) := artifact.in(Compile, assembly).value,
|
|
|
|
|
assemblyOption.in(assembly) ~= { _.copy(includeScala = false) },
|
|
|
|
|
addArtifact(artifact.in(Compile, packageBin), assembly),
|
|
|
|
|
pomPostProcess := { node =>
|
|
|
|
|
new RuleTransformer(new RewriteRule {
|
|
|
|
|
override def transform(node: XmlNode): XmlNodeSeq = node match {
|
|
|
|
|
case e: Elem if node.label == "dependency" =>
|
|
|
|
|
Comment(
|
|
|
|
|
"the dependency that was here has been absorbed via sbt-assembly"
|
|
|
|
|
)
|
|
|
|
|
case _ => node
|
|
|
|
|
}
|
|
|
|
|
}).transform(node).head
|
|
|
|
|
},
|
|
|
|
|
)
|
2019-05-11 09:42:06 +02:00
|
|
|
*/
|
2018-10-24 17:19:28 +02:00
|
|
|
|
2017-08-28 06:42:26 +02:00
|
|
|
lazy val sbtIgnoredProblems = {
|
2017-11-29 22:45:02 +01:00
|
|
|
Vector(
|
2018-01-10 04:48:07 +01:00
|
|
|
exclude[MissingClassProblem]("buildinfo.BuildInfo"),
|
|
|
|
|
exclude[MissingClassProblem]("buildinfo.BuildInfo$"),
|
2017-08-28 06:42:26 +02:00
|
|
|
// Added more items to Import trait.
|
|
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.Import.sbt$Import$_setter_$WatchSource_="),
|
2017-11-29 22:45:02 +01:00
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.Import.WatchSource"),
|
Add support for managed task inputs
In my recent changes to watch, I have been moving towards a world in
which sbt manages the file inputs and outputs at the task level. The
main idea is that we want to enable a user to specify the inputs and
outputs of a task and have sbt able to track those inputs across
multiple task evaluations. Sbt should be able to automatically trigger a
build when the inputs change and it also should be able to avoid task
evaluation if non of the inputs have changed.
The former case of having sbt automatically watch the file inputs of a
task has been present since watch was refactored. In this commit, I
make it possible for the user to retrieve the lists of new, modified and
deleted files. The user can then avoid task evaluation if none of the
inputs have changed.
To implement this, I inject a number of new settings during project
load if the fileInputs setting is defined for a task. The injected
settings are:
allPathsAndAttributes -- this retrieves all of the paths described by
the fileInputs for the task along with their attributes
fileStamps -- this retrieves all of the file stamps for the files
returned by allPathsAndAttributes
Using these two injected tasks, I also inject a number of derived tasks,
such as allFiles, which returns all of the regular files returned by
allPathsAndAttributes and changedFiles, which returns all of the regular
files that have been modified since the last run.
Using these injected settings, the user is able to write tasks that
avoid evaluation if the inputs haven't changed.
foo / fileInputs += baseDirectory.value.toGlob / ** / "*.scala"
foo := {
foo.previous match {
case Some(p) if (foo / changedFiles).value.isEmpty => p
case _ => fooImpl((foo / allFiles).value
}
}
To make this whole mechanism work, I add a private task key:
val fileAttributeMap = taskKey[java.util.HashMap[Path, Stamp]]("...")
This keeps track of the stamps for all of the files that are managed by
sbt. The fileStamps task will first look for the stamp in the attribute
map and, only if it is not present, it will update the cache. This
allows us to ensure that a given file will only be stamped once per task
evaluation run no matter how the file inputs are specified. Moreover, in
a continuous build, I'm able to reuse the attribute map which can
significantly reduce latency because the default file stamping
implementation used by zinc is fairly expensive (it can take anywhere
between 300-1500ms to stamp 5000 8kb source files on my mac).
I also renamed some of the watch related keys to be a bit more clear.
2019-04-24 02:00:13 +02:00
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.Import.AnyPath"),
|
|
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.Import.sbt$Import$_setter_$**_="),
|
|
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.Import.sbt$Import$_setter_$*_="),
|
2019-04-30 21:02:28 +02:00
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.Import.sbt$Import$_setter_$ChangedFiles_="),
|
Add support for managed task inputs
In my recent changes to watch, I have been moving towards a world in
which sbt manages the file inputs and outputs at the task level. The
main idea is that we want to enable a user to specify the inputs and
outputs of a task and have sbt able to track those inputs across
multiple task evaluations. Sbt should be able to automatically trigger a
build when the inputs change and it also should be able to avoid task
evaluation if non of the inputs have changed.
The former case of having sbt automatically watch the file inputs of a
task has been present since watch was refactored. In this commit, I
make it possible for the user to retrieve the lists of new, modified and
deleted files. The user can then avoid task evaluation if none of the
inputs have changed.
To implement this, I inject a number of new settings during project
load if the fileInputs setting is defined for a task. The injected
settings are:
allPathsAndAttributes -- this retrieves all of the paths described by
the fileInputs for the task along with their attributes
fileStamps -- this retrieves all of the file stamps for the files
returned by allPathsAndAttributes
Using these two injected tasks, I also inject a number of derived tasks,
such as allFiles, which returns all of the regular files returned by
allPathsAndAttributes and changedFiles, which returns all of the regular
files that have been modified since the last run.
Using these injected settings, the user is able to write tasks that
avoid evaluation if the inputs haven't changed.
foo / fileInputs += baseDirectory.value.toGlob / ** / "*.scala"
foo := {
foo.previous match {
case Some(p) if (foo / changedFiles).value.isEmpty => p
case _ => fooImpl((foo / allFiles).value
}
}
To make this whole mechanism work, I add a private task key:
val fileAttributeMap = taskKey[java.util.HashMap[Path, Stamp]]("...")
This keeps track of the stamps for all of the files that are managed by
sbt. The fileStamps task will first look for the stamp in the attribute
map and, only if it is not present, it will update the cache. This
allows us to ensure that a given file will only be stamped once per task
evaluation run no matter how the file inputs are specified. Moreover, in
a continuous build, I'm able to reuse the attribute map which can
significantly reduce latency because the default file stamping
implementation used by zinc is fairly expensive (it can take anywhere
between 300-1500ms to stamp 5000 8kb source files on my mac).
I also renamed some of the watch related keys to be a bit more clear.
2019-04-24 02:00:13 +02:00
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.Import.sbt$Import$_setter_$AnyPath_="),
|
|
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.Import.sbt$Import$_setter_$Glob_="),
|
|
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.Import.sbt$Import$_setter_$RecursiveGlob_="),
|
|
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.Import.sbt$Import$_setter_$RelativeGlob_="),
|
|
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.Import.*"),
|
|
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.Import.**"),
|
2019-04-30 21:02:28 +02:00
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.Import.ChangedFiles"),
|
Add support for managed task inputs
In my recent changes to watch, I have been moving towards a world in
which sbt manages the file inputs and outputs at the task level. The
main idea is that we want to enable a user to specify the inputs and
outputs of a task and have sbt able to track those inputs across
multiple task evaluations. Sbt should be able to automatically trigger a
build when the inputs change and it also should be able to avoid task
evaluation if non of the inputs have changed.
The former case of having sbt automatically watch the file inputs of a
task has been present since watch was refactored. In this commit, I
make it possible for the user to retrieve the lists of new, modified and
deleted files. The user can then avoid task evaluation if none of the
inputs have changed.
To implement this, I inject a number of new settings during project
load if the fileInputs setting is defined for a task. The injected
settings are:
allPathsAndAttributes -- this retrieves all of the paths described by
the fileInputs for the task along with their attributes
fileStamps -- this retrieves all of the file stamps for the files
returned by allPathsAndAttributes
Using these two injected tasks, I also inject a number of derived tasks,
such as allFiles, which returns all of the regular files returned by
allPathsAndAttributes and changedFiles, which returns all of the regular
files that have been modified since the last run.
Using these injected settings, the user is able to write tasks that
avoid evaluation if the inputs haven't changed.
foo / fileInputs += baseDirectory.value.toGlob / ** / "*.scala"
foo := {
foo.previous match {
case Some(p) if (foo / changedFiles).value.isEmpty => p
case _ => fooImpl((foo / allFiles).value
}
}
To make this whole mechanism work, I add a private task key:
val fileAttributeMap = taskKey[java.util.HashMap[Path, Stamp]]("...")
This keeps track of the stamps for all of the files that are managed by
sbt. The fileStamps task will first look for the stamp in the attribute
map and, only if it is not present, it will update the cache. This
allows us to ensure that a given file will only be stamped once per task
evaluation run no matter how the file inputs are specified. Moreover, in
a continuous build, I'm able to reuse the attribute map which can
significantly reduce latency because the default file stamping
implementation used by zinc is fairly expensive (it can take anywhere
between 300-1500ms to stamp 5000 8kb source files on my mac).
I also renamed some of the watch related keys to be a bit more clear.
2019-04-24 02:00:13 +02:00
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.Import.RecursiveGlob"),
|
|
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.Import.Glob"),
|
|
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.Import.RelativeGlob"),
|
2017-11-29 22:45:02 +01:00
|
|
|
// Dropped in favour of kind-projector's polymorphic lambda literals
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.Import.Param"),
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.package.Param"),
|
2018-07-01 09:13:09 +02:00
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.Import.SemanticSelector"),
|
|
|
|
|
exclude[ReversedMissingMethodProblem]("sbt.Import.sbt$Import$_setter_$SemanticSelector_="),
|
2017-11-29 22:45:02 +01:00
|
|
|
// Dropped in favour of plain scala.Function, and its compose method
|
|
|
|
|
exclude[DirectMissingMethodProblem]("sbt.package.toFn1"),
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
2017-08-28 06:42:26 +02:00
|
|
|
}
|
2014-12-18 05:38:10 +01:00
|
|
|
|
2017-10-29 14:37:53 +01:00
|
|
|
def runNpm(command: String, base: File, log: sbt.internal.util.ManagedLogger) = {
|
|
|
|
|
import scala.sys.process._
|
|
|
|
|
try {
|
2017-12-19 06:17:46 +01:00
|
|
|
val exitCode = Process(s"npm $command", Option(base)) ! log
|
2017-10-29 14:37:53 +01:00
|
|
|
if (exitCode != 0) throw new Exception("Process returned exit code: " + exitCode)
|
|
|
|
|
} catch {
|
|
|
|
|
case e: java.io.IOException => log.warn("failed to run npm " + e.getMessage)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-02 09:33:29 +02:00
|
|
|
lazy val vscodePlugin = (project in file("vscode-sbt-scala"))
|
|
|
|
|
.settings(
|
|
|
|
|
crossPaths := false,
|
|
|
|
|
crossScalaVersions := Seq(baseScalaVersion),
|
|
|
|
|
skip in publish := true,
|
|
|
|
|
compile in Compile := {
|
|
|
|
|
val u = update.value
|
2017-10-29 14:37:53 +01:00
|
|
|
runNpm("run compile", baseDirectory.value, streams.value.log)
|
|
|
|
|
sbt.internal.inc.Analysis.empty
|
2017-10-02 09:33:29 +02:00
|
|
|
},
|
|
|
|
|
update := {
|
|
|
|
|
val old = update.value
|
|
|
|
|
val t = target.value / "updated"
|
|
|
|
|
val base = baseDirectory.value
|
2017-10-06 02:26:59 +02:00
|
|
|
val log = streams.value.log
|
2017-10-02 09:33:29 +02:00
|
|
|
if (t.exists) ()
|
|
|
|
|
else {
|
2017-10-29 14:37:53 +01:00
|
|
|
runNpm("install", base, log)
|
2017-10-02 09:33:29 +02:00
|
|
|
IO.touch(t)
|
|
|
|
|
}
|
|
|
|
|
old
|
|
|
|
|
},
|
|
|
|
|
cleanFiles ++= {
|
|
|
|
|
val base = baseDirectory.value
|
|
|
|
|
Vector(
|
|
|
|
|
target.value / "updated",
|
2019-05-11 09:42:06 +02:00
|
|
|
base / "node_modules",
|
|
|
|
|
base / "client" / "node_modules",
|
2017-10-02 09:33:29 +02:00
|
|
|
base / "client" / "server",
|
|
|
|
|
base / "client" / "out",
|
2019-05-11 09:42:06 +02:00
|
|
|
base / "server" / "node_modules"
|
|
|
|
|
) filter { _.exists }
|
2017-10-02 09:33:29 +02:00
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
2015-07-10 11:53:48 +02:00
|
|
|
def scriptedTask: Def.Initialize[InputTask[Unit]] = Def.inputTask {
|
2017-05-03 16:52:36 +02:00
|
|
|
// publishLocalBinAll.value // TODO: Restore scripted needing only binary jars.
|
|
|
|
|
publishAll.value
|
2018-02-01 15:53:11 +01:00
|
|
|
(sbtProj / Test / compile).value // make sure sbt.RunFromSourceMain is compiled
|
2017-04-21 09:14:31 +02:00
|
|
|
Scripted.doScripted(
|
|
|
|
|
(sbtLaunchJar in bundledLauncherProj).value,
|
2018-07-10 06:58:45 +02:00
|
|
|
(fullClasspath in scriptedSbtReduxProj in Test).value,
|
|
|
|
|
(scalaInstance in scriptedSbtReduxProj).value,
|
2017-04-21 09:14:31 +02:00
|
|
|
scriptedSource.value,
|
|
|
|
|
scriptedBufferLog.value,
|
2018-01-24 14:42:18 +01:00
|
|
|
Def.setting(Scripted.scriptedParser(scriptedSource.value)).parsed,
|
2017-04-21 09:14:31 +02:00
|
|
|
scriptedPrescripted.value,
|
|
|
|
|
scriptedLaunchOpts.value
|
|
|
|
|
)
|
2014-12-18 05:38:10 +01:00
|
|
|
}
|
|
|
|
|
|
2015-07-10 11:53:48 +02:00
|
|
|
def scriptedUnpublishedTask: Def.Initialize[InputTask[Unit]] = Def.inputTask {
|
2017-04-21 09:14:31 +02:00
|
|
|
Scripted.doScripted(
|
|
|
|
|
(sbtLaunchJar in bundledLauncherProj).value,
|
2018-07-10 06:58:45 +02:00
|
|
|
(fullClasspath in scriptedSbtReduxProj in Test).value,
|
|
|
|
|
(scalaInstance in scriptedSbtReduxProj).value,
|
2017-04-21 09:14:31 +02:00
|
|
|
scriptedSource.value,
|
|
|
|
|
scriptedBufferLog.value,
|
2018-01-24 14:42:18 +01:00
|
|
|
Def.setting(Scripted.scriptedParser(scriptedSource.value)).parsed,
|
2017-04-21 09:14:31 +02:00
|
|
|
scriptedPrescripted.value,
|
|
|
|
|
scriptedLaunchOpts.value
|
|
|
|
|
)
|
2014-12-18 05:38:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lazy val publishLauncher = TaskKey[Unit]("publish-launcher")
|
|
|
|
|
|
2017-04-21 09:14:31 +02:00
|
|
|
def allProjects =
|
|
|
|
|
Seq(
|
2017-06-26 12:38:37 +02:00
|
|
|
collectionProj,
|
|
|
|
|
logicProj,
|
|
|
|
|
completeProj,
|
2017-04-21 09:14:31 +02:00
|
|
|
testingProj,
|
|
|
|
|
testAgentProj,
|
|
|
|
|
taskProj,
|
|
|
|
|
stdTaskProj,
|
|
|
|
|
runProj,
|
2018-07-10 06:58:45 +02:00
|
|
|
scriptedSbtReduxProj,
|
|
|
|
|
scriptedSbtOldProj,
|
2017-04-21 09:14:31 +02:00
|
|
|
scriptedPluginProj,
|
|
|
|
|
protocolProj,
|
|
|
|
|
actionsProj,
|
|
|
|
|
commandProj,
|
|
|
|
|
mainSettingsProj,
|
2019-04-18 09:14:04 +02:00
|
|
|
zincLmIntegrationProj,
|
2017-04-21 09:14:31 +02:00
|
|
|
mainProj,
|
|
|
|
|
sbtProj,
|
2017-05-26 06:59:49 +02:00
|
|
|
bundledLauncherProj,
|
|
|
|
|
coreMacrosProj
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
2015-02-03 04:44:02 +01:00
|
|
|
|
2017-05-08 15:08:40 +02:00
|
|
|
lazy val nonRoots = allProjects.map(p => LocalProject(p.id))
|
2014-12-18 05:38:10 +01:00
|
|
|
|
2018-07-31 02:28:42 +02:00
|
|
|
ThisBuild / scriptedBufferLog := true
|
2019-05-11 09:42:06 +02:00
|
|
|
ThisBuild / scriptedPrescripted := { _ =>
|
|
|
|
|
}
|
2018-07-31 02:28:42 +02:00
|
|
|
|
2017-04-21 09:14:31 +02:00
|
|
|
def otherRootSettings =
|
|
|
|
|
Seq(
|
|
|
|
|
scripted := scriptedTask.evaluated,
|
|
|
|
|
scriptedUnpublished := scriptedUnpublishedTask.evaluated,
|
|
|
|
|
scriptedSource := (sourceDirectory in sbtProj).value / "sbt-test",
|
2019-05-25 20:28:34 +02:00
|
|
|
watchTriggers in scripted += scriptedSource.value.toGlob / **,
|
2017-05-03 00:59:51 +02:00
|
|
|
scriptedLaunchOpts := List("-Xmx1500M", "-Xms512M", "-server"),
|
2017-04-21 09:14:31 +02:00
|
|
|
publishAll := { val _ = (publishLocal).all(ScopeFilter(inAnyProject)).value },
|
|
|
|
|
publishLocalBinAll := { val _ = (publishLocalBin).all(ScopeFilter(inAnyProject)).value },
|
|
|
|
|
aggregate in bintrayRelease := false
|
|
|
|
|
) ++ inConfig(Scripted.RepoOverrideTest)(
|
|
|
|
|
Seq(
|
2017-06-23 18:58:00 +02:00
|
|
|
scriptedLaunchOpts := List(
|
|
|
|
|
"-Xmx1500M",
|
|
|
|
|
"-Xms512M",
|
|
|
|
|
"-server",
|
|
|
|
|
"-Dsbt.override.build.repos=true",
|
|
|
|
|
s"""-Dsbt.repository.config=${scriptedSource.value / "repo.config"}"""
|
|
|
|
|
),
|
2017-04-21 09:14:31 +02:00
|
|
|
scripted := scriptedTask.evaluated,
|
|
|
|
|
scriptedUnpublished := scriptedUnpublishedTask.evaluated,
|
|
|
|
|
scriptedSource := (sourceDirectory in sbtProj).value / "repo-override-test"
|
2019-05-11 09:42:06 +02:00
|
|
|
)
|
|
|
|
|
)
|
2016-04-24 20:23:48 +02:00
|
|
|
|
2014-12-18 19:14:04 +01:00
|
|
|
lazy val docProjects: ScopeFilter = ScopeFilter(
|
2019-05-11 09:42:06 +02:00
|
|
|
inAnyProject -- inProjects(
|
|
|
|
|
sbtRoot,
|
|
|
|
|
sbtProj,
|
|
|
|
|
scriptedSbtReduxProj,
|
|
|
|
|
scriptedSbtOldProj,
|
|
|
|
|
scriptedPluginProj
|
|
|
|
|
),
|
2014-12-18 19:14:04 +01:00
|
|
|
inConfigurations(Compile)
|
2014-12-18 05:38:10 +01:00
|
|
|
)
|
2014-12-18 23:40:20 +01:00
|
|
|
lazy val safeUnitTests = taskKey[Unit]("Known working tests (for both 2.10 and 2.11)")
|
|
|
|
|
lazy val safeProjects: ScopeFilter = ScopeFilter(
|
2018-06-18 10:20:50 +02:00
|
|
|
inAnyProject -- inProjects(sbtRoot, sbtProj),
|
2014-12-18 23:40:20 +01:00
|
|
|
inConfigurations(Test)
|
|
|
|
|
)
|
2015-06-20 20:21:16 +02:00
|
|
|
lazy val otherUnitTests = taskKey[Unit]("Unit test other projects")
|
|
|
|
|
lazy val otherProjects: ScopeFilter = ScopeFilter(
|
2017-06-23 18:58:00 +02:00
|
|
|
inProjects(
|
|
|
|
|
sbtProj
|
|
|
|
|
),
|
2015-06-20 20:21:16 +02:00
|
|
|
inConfigurations(Test)
|
|
|
|
|
)
|
2014-12-18 23:40:20 +01:00
|
|
|
|
|
|
|
|
def customCommands: Seq[Setting[_]] = Seq(
|
2017-01-15 07:44:05 +01:00
|
|
|
commands += Command.command("setupBuildScala212") { state =>
|
|
|
|
|
s"""set scalaVersion in ThisBuild := "$scala212" """ ::
|
2014-12-18 23:40:20 +01:00
|
|
|
state
|
|
|
|
|
},
|
|
|
|
|
safeUnitTests := {
|
|
|
|
|
test.all(safeProjects).value
|
|
|
|
|
},
|
2015-06-20 20:21:16 +02:00
|
|
|
otherUnitTests := {
|
2016-02-24 16:02:22 +01:00
|
|
|
test.all(otherProjects).value
|
2015-06-20 20:42:26 +02:00
|
|
|
},
|
2018-12-14 01:31:56 +01:00
|
|
|
commands += Command.command("whitesourceOnPush") { state =>
|
|
|
|
|
sys.env.get("TRAVIS_EVENT_TYPE") match {
|
|
|
|
|
case Some("push") =>
|
|
|
|
|
"whitesourceCheckPolicies" ::
|
2019-05-11 09:42:06 +02:00
|
|
|
"whitesourceUpdate" ::
|
|
|
|
|
state
|
2018-12-14 01:31:56 +01:00
|
|
|
case _ => state
|
|
|
|
|
}
|
|
|
|
|
},
|
2014-12-18 23:40:20 +01:00
|
|
|
commands += Command.command("release-sbt-local") { state =>
|
2015-02-25 18:31:21 +01:00
|
|
|
"clean" ::
|
2017-04-21 09:14:31 +02:00
|
|
|
"so compile" ::
|
|
|
|
|
"so publishLocal" ::
|
|
|
|
|
"reload" ::
|
|
|
|
|
state
|
2014-12-18 23:40:20 +01:00
|
|
|
},
|
2018-02-21 08:28:33 +01:00
|
|
|
commands += Command.command("publishLocalAllModule") { state =>
|
|
|
|
|
val extracted = Project.extract(state)
|
|
|
|
|
import extracted._
|
2019-05-11 09:42:06 +02:00
|
|
|
val sv = get(scalaVersion)
|
|
|
|
|
val projs = structure.allProjectRefs
|
|
|
|
|
val ioOpt = projs find { case ProjectRef(_, id) => id == "ioRoot"; case _ => false }
|
2018-02-21 08:28:33 +01:00
|
|
|
val utilOpt = projs find { case ProjectRef(_, id) => id == "utilRoot"; case _ => false }
|
2019-05-11 09:42:06 +02:00
|
|
|
val lmOpt = projs find { case ProjectRef(_, id) => id == "lmRoot"; case _ => false }
|
2018-02-21 08:28:33 +01:00
|
|
|
val zincOpt = projs find { case ProjectRef(_, id) => id == "zincRoot"; case _ => false }
|
2019-05-11 09:42:06 +02:00
|
|
|
(ioOpt map { case ProjectRef(build, _) => "{" + build.toString + "}/publishLocal" }).toList :::
|
|
|
|
|
(utilOpt map { case ProjectRef(build, _) => "{" + build.toString + "}/publishLocal" }).toList :::
|
|
|
|
|
(lmOpt map { case ProjectRef(build, _) => "{" + build.toString + "}/publishLocal" }).toList :::
|
|
|
|
|
(zincOpt map {
|
|
|
|
|
case ProjectRef(build, _) =>
|
|
|
|
|
val zincSv = get(scalaVersion in ProjectRef(build, "zinc"))
|
|
|
|
|
val csv = get(crossScalaVersions in ProjectRef(build, "compilerBridge")).toList
|
|
|
|
|
(csv flatMap { bridgeSv =>
|
|
|
|
|
s"++$bridgeSv" :: ("{" + build.toString + "}compilerBridge/publishLocal") :: Nil
|
|
|
|
|
}) :::
|
|
|
|
|
List(s"++$zincSv", "{" + build.toString + "}/publishLocal")
|
|
|
|
|
}).getOrElse(Nil) :::
|
|
|
|
|
List(s"++$sv", "publishLocal") :::
|
|
|
|
|
state
|
2018-02-21 08:28:33 +01:00
|
|
|
},
|
2015-02-17 19:33:54 +01:00
|
|
|
/** There are several complications with sbt's build.
|
|
|
|
|
* First is the fact that interface project is a Java-only project
|
2015-12-14 11:26:34 +01:00
|
|
|
* that uses source generator from datatype subproject in Scala 2.10.6.
|
2015-02-17 19:33:54 +01:00
|
|
|
*
|
2015-07-16 13:53:10 +02:00
|
|
|
* Second is the fact that all subprojects are released with crossPaths
|
2015-12-14 11:26:34 +01:00
|
|
|
* turned off for the sbt's Scala version 2.10.6, but some of them are also
|
2015-02-17 19:33:54 +01:00
|
|
|
* cross published against 2.11.1 with crossPaths turned on.
|
|
|
|
|
*
|
2015-07-16 13:53:10 +02:00
|
|
|
* `so compile` handles 2.10.x/2.11.x cross building.
|
2015-02-17 19:33:54 +01:00
|
|
|
*/
|
2014-12-18 23:40:20 +01:00
|
|
|
commands += Command.command("release-sbt") { state =>
|
|
|
|
|
// TODO - Any sort of validation
|
2015-02-25 18:31:21 +01:00
|
|
|
"clean" ::
|
2017-05-30 08:44:13 +02:00
|
|
|
"conscriptConfigs" ::
|
|
|
|
|
"compile" ::
|
|
|
|
|
"publishSigned" ::
|
2015-03-24 23:32:56 +01:00
|
|
|
"bundledLauncherProj/publishLauncher" ::
|
2015-02-21 03:09:43 +01:00
|
|
|
state
|
|
|
|
|
},
|
2015-02-25 18:31:21 +01:00
|
|
|
// stamp-version doesn't work with ++ or "so".
|
2015-02-21 03:09:43 +01:00
|
|
|
commands += Command.command("release-nightly") { state =>
|
|
|
|
|
"stamp-version" ::
|
2015-02-25 18:31:21 +01:00
|
|
|
"clean" ::
|
|
|
|
|
"compile" ::
|
|
|
|
|
"publish" ::
|
2015-04-22 06:28:47 +02:00
|
|
|
"bintrayRelease" ::
|
2014-12-18 23:40:20 +01:00
|
|
|
state
|
|
|
|
|
}
|
|
|
|
|
)
|
2018-01-11 15:13:21 +01:00
|
|
|
|
2019-05-11 09:42:06 +02:00
|
|
|
ThisBuild / whitesourceProduct := "Lightbend Reactive Platform"
|
2018-12-14 01:31:56 +01:00
|
|
|
ThisBuild / whitesourceAggregateProjectName := {
|
|
|
|
|
// note this can get detached on tag build etc
|
|
|
|
|
val b = (ThisBuild / git.gitCurrentBranch).value
|
|
|
|
|
val Stable = """1\.([0-9]+)\.x""".r
|
|
|
|
|
b match {
|
|
|
|
|
case Stable(y) => "sbt-1." + y.toString + "-stable"
|
|
|
|
|
case _ => "sbt-master"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ThisBuild / whitesourceAggregateProjectToken := {
|
|
|
|
|
(ThisBuild / whitesourceAggregateProjectName).value match {
|
|
|
|
|
case "sbt-master" => "e7a1e55518c0489a98e9c7430c8b2ccd53d9f97c12ed46148b592ebe4c8bf128"
|
|
|
|
|
case "sbt-1.2-stable" => "54f2313767aa47198971e65595670ee16e1ad0000d20458588e72d3ac2c34763"
|
|
|
|
|
case _ => "" // it's ok to fail here
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-05-11 09:42:06 +02:00
|
|
|
ThisBuild / whitesourceIgnoredScopes ++= Seq("plugin", "scalafmt", "sxr")
|
|
|
|
|
ThisBuild / whitesourceFailOnError := sys.env.contains("WHITESOURCE_PASSWORD") // fail if pwd is present
|
2018-12-14 01:31:56 +01:00
|
|
|
ThisBuild / whitesourceForceCheckAllDependencies := true
|