Merge branch 'develop' into state-transform

This commit is contained in:
Ethan Atkins 2019-12-02 08:03:46 -08:00 committed by GitHub
commit 1a7d6a84f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 116 additions and 83 deletions

View File

@ -1,4 +1,4 @@
version = 2.0.0
version = 2.2.1
maxColumn = 100
project.git = true
project.excludeFilters = [ "\\Wsbt-test\\W", "\\Winput_sources\\W", "\\Wcontraband-scala\\W" ]

View File

@ -8,7 +8,7 @@ env:
# WHITESOURCE_PASSWORD=
- secure: d3bu2KNwsVHwfhbGgO+gmRfDKBJhfICdCJFGWKf2w3Gv86AJZX9nuTYRxz0KtdvEHO5Xw8WTBZLPb2thSJqhw9OCm4J8TBAVqCP0ruUj4+aqBUFy4bVexQ6WKE6nWHs4JPzPk8c6uC1LG3hMuzlC8RGETXtL/n81Ef1u7NjyXjs=
matrix:
- SBT_CMD=";mimaReportBinaryIssues ;scalafmtCheckAll ;headerCheck ;test:headerCheck ;whitesourceOnPush ;test:compile; publishLocal ;mainSettingsProj/test ;safeUnitTests ;otherUnitTests; doc"
- SBT_CMD="mimaReportBinaryIssues ;scalafmtCheckAll ; scalafmtSbtCheck; headerCheck ;test:headerCheck ;whitesourceOnPush ;test:compile; publishLocal ;mainSettingsProj/test ;safeUnitTests ;otherUnitTests; doc"
- SBT_CMD="scripted actions/* apiinfo/* compiler-project/* ivy-deps-management/* reporter/* tests/* watch/* classloader-cache/* package/*"
- SBT_CMD="scripted dependency-management/* plugins/* project-load/* java/* run/* nio/*"
- SBT_CMD="repoOverrideTest:scripted dependency-management/*; scripted source-dependencies/* project/*"

View File

@ -67,7 +67,10 @@ def commonSettings: Seq[Setting[_]] = Def.settings(
resolvers += Resolver.typesafeIvyRepo("releases").withName("typesafe-sbt-build-ivy-releases"),
resolvers += Resolver.sonatypeRepo("snapshots"),
resolvers += "bintray-sbt-maven-releases" at "https://dl.bintray.com/sbt/maven-releases/",
resolvers += Resolver.url("bintray-scala-hedgehog", url("https://dl.bintray.com/hedgehogqa/scala-hedgehog"))(Resolver.ivyStylePatterns),
resolvers += Resolver.url(
"bintray-scala-hedgehog",
url("https://dl.bintray.com/hedgehogqa/scala-hedgehog")
)(Resolver.ivyStylePatterns),
addCompilerPlugin("org.spire-math" % "kind-projector" % "0.9.4" cross CrossVersion.binary),
testFrameworks += TestFramework("hedgehog.sbt.Framework"),
concurrentRestrictions in Global += Util.testExclusiveRestriction,
@ -242,7 +245,6 @@ val collectionProj = (project in file("internal") / "util-collection")
// 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"),
exclude[IncompatibleSignatureProblem]("sbt.internal.util.Init*.*"),
exclude[IncompatibleSignatureProblem]("sbt.internal.util.Settings0.*"),
exclude[IncompatibleSignatureProblem]("sbt.internal.util.EvaluateSettings#INode.*"),
@ -251,7 +253,9 @@ val collectionProj = (project in file("internal") / "util-collection")
exclude[IncompatibleSignatureProblem]("sbt.internal.util.Settings.*"),
exclude[IncompatibleSignatureProblem]("sbt.internal.util.EvaluateSettings#MixedNode.*"),
exclude[IncompatibleSignatureProblem]("sbt.internal.util.EvaluateSettings#BindNode.this"),
exclude[IncompatibleSignatureProblem]("sbt.internal.util.EvaluateSettings#BindNode.dependsOn"),
exclude[IncompatibleSignatureProblem](
"sbt.internal.util.EvaluateSettings#BindNode.dependsOn"
),
exclude[IncompatibleSignatureProblem]("sbt.internal.util.Types.some")
),
)
@ -736,7 +740,6 @@ lazy val mainProj = (project in file("main"))
exclude[ReversedMissingMethodProblem]("sbt.internal.KeyIndex.*"),
// internal
exclude[IncompatibleMethTypeProblem]("sbt.internal.server.LanguageServerReporter.*"),
// Changed signature or removed private[sbt] methods
exclude[DirectMissingMethodProblem]("sbt.Classpaths.unmanagedLibs0"),
exclude[DirectMissingMethodProblem]("sbt.Defaults.allTestGroupsTask"),
@ -755,11 +758,14 @@ lazy val mainProj = (project in file("main"))
exclude[IncompatibleSignatureProblem]("sbt.plugins.SbtPlugin.*Settings"),
// Removed private internal classes
exclude[MissingClassProblem]("sbt.internal.ReverseLookupClassLoaderHolder$BottomClassLoader"),
exclude[MissingClassProblem]("sbt.internal.ReverseLookupClassLoaderHolder$ReverseLookupClassLoader$ResourceLoader"),
exclude[MissingClassProblem](
"sbt.internal.ReverseLookupClassLoaderHolder$ReverseLookupClassLoader$ResourceLoader"
),
exclude[MissingClassProblem]("sbt.internal.ReverseLookupClassLoaderHolder$ClassLoadingLock"),
exclude[MissingClassProblem]("sbt.internal.ReverseLookupClassLoaderHolder$ReverseLookupClassLoader"),
exclude[MissingClassProblem](
"sbt.internal.ReverseLookupClassLoaderHolder$ReverseLookupClassLoader"
),
exclude[MissingClassProblem]("sbt.internal.LayeredClassLoaderImpl"),
// false positives
exclude[DirectMissingMethodProblem]("sbt.plugins.IvyPlugin.requires"),
exclude[DirectMissingMethodProblem]("sbt.plugins.JUnitXmlReportPlugin.requires"),
@ -769,17 +775,19 @@ lazy val mainProj = (project in file("main"))
exclude[DirectMissingMethodProblem]("sbt.ResolvedClasspathDependency.apply"),
exclude[DirectMissingMethodProblem]("sbt.ClasspathDependency.apply"),
exclude[IncompatibleSignatureProblem]("sbt.plugins.SemanticdbPlugin.globalSettings"),
// File -> Source
exclude[DirectMissingMethodProblem]("sbt.Defaults.cleanFilesTask"),
exclude[IncompatibleSignatureProblem]("sbt.Defaults.resourceConfigPaths"),
exclude[IncompatibleSignatureProblem]("sbt.Defaults.sourceConfigPaths"),
exclude[IncompatibleSignatureProblem]("sbt.Defaults.configPaths"),
exclude[IncompatibleSignatureProblem]("sbt.Defaults.paths"),
exclude[IncompatibleSignatureProblem]("sbt.Keys.csrPublications"),
exclude[IncompatibleSignatureProblem]("sbt.coursierint.CoursierArtifactsTasks.coursierPublicationsTask"),
exclude[IncompatibleSignatureProblem]("sbt.coursierint.CoursierArtifactsTasks.coursierPublicationsTask"),
exclude[IncompatibleSignatureProblem](
"sbt.coursierint.CoursierArtifactsTasks.coursierPublicationsTask"
),
exclude[IncompatibleSignatureProblem](
"sbt.coursierint.CoursierArtifactsTasks.coursierPublicationsTask"
),
exclude[IncompatibleSignatureProblem]("sbt.coursierint.LMCoursier.coursierConfiguration"),
exclude[IncompatibleSignatureProblem]("sbt.coursierint.LMCoursier.publicationsSetting"),
exclude[IncompatibleSignatureProblem]("sbt.Project.inThisBuild"),
@ -790,7 +798,6 @@ lazy val mainProj = (project in file("main"))
exclude[IncompatibleSignatureProblem]("sbt.ProjectExtra.inConfig"),
exclude[IncompatibleSignatureProblem]("sbt.ProjectExtra.inTask"),
exclude[IncompatibleSignatureProblem]("sbt.ProjectExtra.inScope"),
exclude[MissingTypesProblem]("sbt.internal.Load*"),
exclude[IncompatibleSignatureProblem]("sbt.internal.Load*"),
)

View File

@ -495,6 +495,7 @@ object Keys {
val lintUnused = inputKey[Unit]("Check for keys unused by other settings and tasks.")
val excludeLintKeys = settingKey[Set[Def.KeyedInitialize[_]]]("Keys excluded from lintUnused task")
val includeLintKeys = settingKey[Set[Def.KeyedInitialize[_]]]("Task keys that are included into lintUnused task")
val lintUnusedKeysOnLoad = settingKey[Boolean]("Toggles whether or not to check for unused keys during startup")
val stateStreams = AttributeKey[Streams]("stateStreams", "Streams manager, which provides streams for different contexts. Setting this on State will override the default Streams implementation.")
val resolvedScoped = Def.resolvedScoped

View File

@ -354,8 +354,9 @@ object Project extends ProjectExtra {
validProjectID(id).foreach(errMsg => sys.error(s"Invalid project ID: $errMsg"))
val plugins = Plugins.empty
val origin = ProjectOrigin.GenericRoot
new ProjectDef(id, base, aggregate, Nil, Nil, Nil, plugins, Nil, origin) with Project
with GeneratedRootProject
new ProjectDef(id, base, aggregate, Nil, Nil, Nil, plugins, Nil, origin)
with Project
with GeneratedRootProject
}
/** Returns None if `id` is a valid Project ID or Some containing the parser error message if it is not.*/

View File

@ -39,6 +39,7 @@ object LintUnused {
ivyConfiguration,
),
Keys.lintUnused := lintUnusedTask.evaluated,
Keys.lintUnusedKeysOnLoad := true,
)
// input task version of the lintUnused
@ -59,8 +60,10 @@ object LintUnused {
val extracted = Project.extract(s)
val includeKeys = extracted.get(includeLintKeys in Global) map { _.scopedKey.key.label }
val excludeKeys = extracted.get(excludeLintKeys in Global) map { _.scopedKey.key.label }
val result = lintUnused(s, includeKeys, excludeKeys)
lintResultLines(result) foreach { log.warn(_) }
if (extracted.get(lintUnusedKeysOnLoad in Global)) {
val result = lintUnused(s, includeKeys, excludeKeys)
lintResultLines(result) foreach { log.warn(_) }
}
s
}
@ -70,26 +73,29 @@ object LintUnused {
import scala.collection.mutable.ListBuffer
val buffer = ListBuffer.empty[String]
val size = result.size
if (size == 1) buffer.append("there's a key that's not used by any other settings/tasks:")
else buffer.append(s"there are $size keys that are not used by any other settings/tasks:")
buffer.append(" ")
result foreach {
case (_, str, positions) =>
buffer.append(s"* $str")
positions foreach {
case pos: FilePosition => buffer.append(s" +- ${pos.path}:${pos.startLine}")
case _ => ()
}
if (result.isEmpty) Vector.empty
else {
val size = result.size
if (size == 1) buffer.append("there's a key that's not used by any other settings/tasks:")
else buffer.append(s"there are $size keys that are not used by any other settings/tasks:")
buffer.append(" ")
result foreach {
case (_, str, positions) =>
buffer.append(s"* $str")
positions foreach {
case pos: FilePosition => buffer.append(s" +- ${pos.path}:${pos.startLine}")
case _ => ()
}
}
buffer.append(" ")
buffer.append(
"note: a setting might still be used by a command; to exclude a key from this `lintUnused` check"
)
buffer.append(
"either append it to `Global / excludeLintKeys` or call .withRank(KeyRanks.Invisible) on the key"
)
buffer.toVector
}
buffer.append(" ")
buffer.append(
"note: a setting might still be used by a command; to exclude a key from this `lintUnused` check"
)
buffer.append(
"either append it to `Global / excludeLintKeys` or call .withRank(KeyRanks.Invisible) on the key"
)
buffer.toVector
}
def lintUnused(

View File

@ -148,7 +148,8 @@ private[sbt] object SettingsGraph {
case _ => Some(Left(s))
}
case _ => None
} else {
}
else {
None
}
}.toSeq

View File

@ -111,7 +111,8 @@ private[sbt] object Definition {
case h :: _ if h.length < fragment.length => fragment :: Nil
case h :: _ if h.length == fragment.length => fragment :: z
case _ => z
} else z
}
else z
}
.headOption
}

View File

@ -8,7 +8,8 @@ object Release {
lazy val launcherRemotePath = SettingKey[String]("launcher-remote-path")
lazy val deployLauncher = TaskKey[Unit](
"deploy-launcher",
"Upload the launcher to its traditional location for compatibility with existing scripts.")
"Upload the launcher to its traditional location for compatibility with existing scripts."
)
def launcherSettings(launcher: TaskKey[File]): Seq[Setting[_]] = Seq(
launcherRemotePath := {
@ -17,11 +18,13 @@ object Release {
},
deployLauncher := {
val repo = bintrayRepo.value
repo.upload(bintrayPackage.value,
version.value,
launcherRemotePath.value,
launcher.value,
sLog.value)
repo.upload(
bintrayPackage.value,
version.value,
launcherRemotePath.value,
launcher.value,
sLog.value
)
}
)

View File

@ -45,8 +45,7 @@ object SbtLauncherPlugin extends AutoPlugin {
// TODO - is the ok for creating a jar?
val rebase: File => Seq[(File, String)] = {
val path = dir.toPath
f =>
if (f != dir) f -> path.relativize(f.toPath).toString :: Nil else Nil
f => if (f != dir) f -> path.relativize(f.toPath).toString :: Nil else Nil
}
IO.zip(dir.allPaths.get().flatMap(rebase), target)
}

View File

@ -31,10 +31,12 @@ object StatusPlugin extends AutoPlugin {
val status = extracted.get(publishStatus)
// Set new version AND lock down the publishStatus to what it was, as
// our release regexes no longer support ivy data format, due to other issues.
extracted.appendWithSession((version in ThisBuild ~= stamp) ::
(publishStatus in ThisBuild := status) ::
Nil,
state)
extracted.appendWithSession(
(version in ThisBuild ~= stamp) ::
(publishStatus in ThisBuild := status) ::
Nil,
state
)
}
def stamp(v: String): String = {
val Snapshot = "-SNAPSHOT"

View File

@ -38,11 +38,12 @@ object Transform {
def get(key: String) = props.getOrElse(key, sys.error(s"No value defined for key '$key'"))
val Property = """\$\{\{([\w.-]+)\}\}""".r
val catcher = scala.util.control.Exception.catching(classOf[java.io.IOException])
rs.map { case (in, out) =>
val newString = Property.replaceAllIn(IO.read(in), mtch => get(mtch.group(1)))
if (Some(newString) != catcher.opt(IO.read(out)))
IO.write(out, newString)
out
rs.map {
case (in, out) =>
val newString = Property.replaceAllIn(IO.read(in), mtch => get(mtch.group(1)))
if (Some(newString) != catcher.opt(IO.read(out)))
IO.write(out, newString)
out
}
}.taskValue,
)

View File

@ -44,24 +44,28 @@ object Util {
lazy val apiDefinitions = TaskKey[Seq[File]]("api-definitions")
def generateAPICached(defs: Seq[File],
cp: Classpath,
out: File,
main: Option[String],
run: ScalaRun,
s: TaskStreams): Seq[File] = {
def generateAPICached(
defs: Seq[File],
cp: Classpath,
out: File,
main: Option[String],
run: ScalaRun,
s: TaskStreams
): Seq[File] = {
def gen() = generateAPI(defs, cp, out, main, run, s)
val f = FileFunction.cached(s.cacheDirectory / "gen-api", FilesInfo.hash) { _ =>
gen().toSet
} // TODO: check if output directory changed
f(defs.toSet).toSeq
}
def generateAPI(defs: Seq[File],
cp: Classpath,
out: File,
main: Option[String],
run: ScalaRun,
s: TaskStreams): Seq[File] = {
def generateAPI(
defs: Seq[File],
cp: Classpath,
out: File,
main: Option[String],
run: ScalaRun,
s: TaskStreams
): Seq[File] = {
IO.delete(out)
IO.createDirectory(out)
val args = "xsbti.api" :: out.getAbsolutePath :: defs.map(_.getAbsolutePath).toList
@ -73,10 +77,12 @@ object Util {
val lastCompilation = analysis.compilations.allCompilations.lastOption
lastCompilation.map(_.getStartTime) getOrElse 0L
}
def generateVersionFile(version: String,
dir: File,
s: TaskStreams,
analysis: Analysis): Seq[File] = {
def generateVersionFile(
version: String,
dir: File,
s: TaskStreams,
analysis: Analysis
): Seq[File] = {
import java.util.{ Date, TimeZone }
val formatter = new java.text.SimpleDateFormat("yyyyMMdd'T'HHmmss")
formatter.setTimeZone(TimeZone.getTimeZone("GMT"))
@ -105,8 +111,7 @@ object Util {
def cleanPom(pomNode: scala.xml.Node) = {
import scala.xml._
def cleanNodes(nodes: Seq[Node]): Seq[Node] = nodes flatMap {
case elem @ Elem(_, "dependency", _, _, _*)
if excludePomDependency(elem) =>
case elem @ Elem(_, "dependency", _, _, _*) if excludePomDependency(elem) =>
NodeSeq.Empty
case Elem(_, "classifier", _, _, _*) =>
NodeSeq.Empty
@ -178,14 +183,18 @@ object Licensed {
def settings: Seq[Setting[_]] = Seq(
notice := (baseDirectory.value / "NOTICE"),
unmanagedResources in Compile ++= notice.value +: extractLicenses.value,
extractLicenses := extractLicenses0((baseDirectory in ThisBuild).value,
notice.value,
streams.value)
extractLicenses := extractLicenses0(
(baseDirectory in ThisBuild).value,
notice.value,
streams.value
)
)
def extractLicenses0(base: File, note: File, s: TaskStreams): Seq[File] =
if (!note.exists) Nil
else
try { seePaths(base, IO.read(note)) } catch {
try {
seePaths(base, IO.read(note))
} catch {
case NonFatal(_) => s.log.warn("Could not read NOTICE"); Nil
}
}

View File

@ -1 +1 @@
sbt.version=1.3.0
sbt.version=1.3.4

View File

@ -3,7 +3,7 @@ scalacOptions ++= Seq("-feature", "-language:postfixOps", "-Ywarn-unused:_,-impo
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.0.0")
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.5")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.0.2")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.2.1")
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.4.1")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "3.0.2")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")

View File

@ -176,7 +176,8 @@ object Serialization {
Converter.fromJson[JsonRpcRequestMessage](json) match {
case Success(request) => Right(request)
case Failure(e) => Left(s"Conversion error: ${e.getMessage}")
} else
}
else
Converter.fromJson[JsonRpcNotificationMessage](json) match {
case Success(notification) => Right(notification)
case Failure(e) => Left(s"Conversion error: ${e.getMessage}")

View File

@ -179,7 +179,8 @@ final class ScriptedTests(
case ("nio", "make-clone") => true // uses gcc which isn't set up on all systems
case _ => false
}
} else _ => false
}
else _ => false
private def determineRemoteSbtCreatorKind(testName: (String, String)): RemoteSbtCreatorKind = {
import RemoteSbtCreatorKind._
val (group, name) = testName
@ -417,7 +418,7 @@ final class ScriptedTests(
if (t.isInstanceOf[TestException]) {
t.getCause match {
case null | _: SocketException => log.error(s" Cause of test exception: ${t.getMessage}")
case _ => t.printStackTrace()
case _ => if (!pending) t.printStackTrace()
}
log.play()
}