Merge branch 'develop' into background-jobs

This commit is contained in:
Ethan Atkins 2019-12-02 08:58:24 -08:00 committed by GitHub
commit abb3f61ff1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 209 additions and 105 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

@ -515,17 +515,14 @@ object EvaluateTask {
state: State,
root: Task[T]
): (State, Result[T]) = {
val newState = results(root) match {
case Value(KeyValue(_, st: StateTransform) :: Nil) => st.state
case _ => stateTransform(results)(state)
}
(newState, results(root))
(stateTransform(results)(state), results(root))
}
def stateTransform(results: RMap[Task, Result]): State => State =
Function.chain(
results.toTypedSeq flatMap {
case results.TPair(Task(info, _), Value(v)) => info.post(v) get transformState
case _ => Nil
case results.TPair(_, Value(KeyValue(_, st: StateTransform))) => Some(st.transform)
case results.TPair(Task(info, _), Value(v)) => info.post(v) get transformState
case _ => Nil
}
)

View File

@ -496,6 +496,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

@ -7,14 +7,43 @@
package sbt
final class StateTransform(val state: State) {
override def equals(o: Any): Boolean = o match {
case that: StateTransform => this.state == that.state
case _ => false
}
override def hashCode: Int = state.hashCode
override def toString: String = s"StateTransform($state)"
/**
* Provides a mechanism for a task to transform the state based on the result of the task. For
* example:
* {{{
* val foo = AttributeKey[String]("foo")
* val setFoo = taskKey[StateTransform]("")
* setFoo := {
* state.value.get(foo) match {
* case None => StateTransform(_.put(foo, "foo"))
* case _ => StateTransform(identity)
* }
* }
* val getFoo = taskKey[Option[String]]
* getFoo := state.value.get(foo)
* }}}
* Prior to a call to `setFoo`, `getFoo` will return `None`. After a call to `setFoo`, `getFoo` will
* return `Some("foo")`.
*/
final class StateTransform private (val transform: State => State, stateProxy: () => State) {
@deprecated("Exists only for binary compatibility with 1.3.x.", "1.4.0")
private[sbt] def state: State = stateProxy()
@deprecated("1.4.0", "Use the constructor that takes a transform function.")
private[sbt] def this(state: State) = this((_: State) => state, () => state)
}
object StateTransform {
@deprecated("Exists only for binary compatibility with 1.3.x", "1.4.0")
def apply(state: State): State = state
/**
* Create an instance of [[StateTransform]].
* @param transform the transformation to apply after task evaluation has completed
* @return the [[StateTransform]].
*/
def apply(transform: State => State) =
new StateTransform(
transform,
() => throw new IllegalStateException("No state was added to the StateTransform.")
)
}

View File

@ -117,7 +117,8 @@ private[sbt] object Continuous extends DeprecatedContinuous {
private[sbt] def continuousTask: Def.Initialize[InputTask[StateTransform]] =
Def.inputTask {
val (initialCount, commands) = continuousParser.parsed
new StateTransform(runToTermination(state.value, commands, initialCount, isCommand = false))
val newState = runToTermination(state.value, commands, initialCount, isCommand = false)
StateTransform(_ => newState)
}
private[sbt] val dynamicInputs = taskKey[Option[mutable.Set[DynamicInput]]](

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

@ -24,7 +24,7 @@ private[sbt] object CheckBuildSources {
val st: State = state.value
val firstTime = st.get(hasCheckedMetaBuild).fold(true)(_.compareAndSet(false, true))
(onChangedBuildSource in Scope.Global).value match {
case IgnoreSourceChanges => new StateTransform(st)
case IgnoreSourceChanges => StateTransform(identity)
case o =>
import sbt.nio.FileStamp.Formats._
logger.debug("Checking for meta build source updates")
@ -47,16 +47,16 @@ private[sbt] object CheckBuildSources {
logger.info(s"$prefix\nReloading sbt...")
val remaining =
Exec("reload", None, None) :: st.currentCommand.toList ::: st.remainingCommands
new StateTransform(st.copy(currentCommand = None, remainingCommands = remaining))
StateTransform(_.copy(currentCommand = None, remainingCommands = remaining))
} else {
val tail = "Apply these changes by running `reload`.\nAutomatically reload the " +
"build when source changes are detected by setting " +
"`Global / onChangedBuildSource := ReloadOnSourceChanges`.\nDisable this " +
"warning by setting `Global / onChangedBuildSource := IgnoreSourceChanges`."
logger.warn(s"$prefix\n$tail")
new StateTransform(st)
StateTransform(identity)
}
case _ => new StateTransform(st)
case _ => StateTransform(identity)
}
}
}

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

@ -0,0 +1,31 @@
import complete.DefaultParsers._
import complete.Parser
import sbt.Def.Initialize
val keep = taskKey[Int]("")
val checkKeep = inputKey[Unit]("")
keep := (getPrevious(keep) map { case None => 3; case Some(x) => x + 1 } keepAs keep).value
checkKeep := inputCheck((ctx, s) => Space ~> str(getFromContext(keep, ctx, s))).evaluated
val foo = AttributeKey[Int]("foo")
val transform = taskKey[StateTransform]("")
transform := {
keep.value
StateTransform(_.put(foo, 1))
}
def inputCheck[T](f: (ScopedKey[_], State) => Parser[T]): Initialize[InputTask[Unit]] =
InputTask(resolvedScoped(ctx => (s: State) => f(ctx, s)))(dummyTask)
val checkTransform = taskKey[Unit]("")
checkTransform := {
assert(state.value.get(foo).contains(1))
}
def dummyTask: Any => Initialize[Task[Unit]] =
(_: Any) =>
maxErrors map { _ =>
()
}
def str(o: Option[Int]) = o match { case None => "blue"; case Some(i) => i.toString }

View File

@ -0,0 +1,13 @@
> checkKeep blue
-> checkTransform
> transform
> checkKeep 3
> checkTransform
> transform
> checkKeep 4

View File

@ -38,8 +38,8 @@ object Build {
checkStringValue := checkStringValueImpl.evaluated,
watchOnFileInputEvent := { (_, _) => Watch.CancelWatch },
watchTasks := Def.inputTask {
val prev = watchTasks.evaluated
new StateTransform(prev.state.fail)
watchTasks.evaluated
StateTransform(_.fail)
}.evaluated
)
}

View File

@ -25,7 +25,7 @@ object Build {
watchOnFileInputEvent := { (_, _) => Watch.CancelWatch },
watchTasks := Def.inputTask {
val prev = watchTasks.evaluated
new StateTransform(prev.state.fail)
StateTransform(_.fail)
}.evaluated
)
}

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()
}