Merge pull request #3303 from sbt/wip/watchservice

Adapt to use the new `WatchService`
This commit is contained in:
Dale Wijnand 2017-07-06 13:14:39 +01:00 committed by GitHub
commit d464383722
64 changed files with 134 additions and 105 deletions

View File

@ -133,7 +133,7 @@ lazy val testingProj = (project in file("testing"))
.settings(
baseSettings,
name := "Testing",
libraryDependencies ++= Seq(testInterface, launcherInterface, sjsonNewScalaJson),
libraryDependencies ++= Seq(testInterface, launcherInterface, sjsonNewScalaJson.value),
managedSourceDirectories in Compile +=
baseDirectory.value / "src" / "main" / "contraband-scala",
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
@ -205,7 +205,7 @@ lazy val actionsProj = (project in file("main-actions"))
.settings(
testedBaseSettings,
name := "Actions",
libraryDependencies += sjsonNewScalaJson
libraryDependencies += sjsonNewScalaJson.value
)
.configure(
addSbtCompilerClasspath,
@ -226,7 +226,7 @@ lazy val protocolProj = (project in file("protocol"))
.settings(
testedBaseSettings,
name := "Protocol",
libraryDependencies ++= Seq(sjsonNewScalaJson),
libraryDependencies ++= Seq(sjsonNewScalaJson.value),
managedSourceDirectories in Compile +=
baseDirectory.value / "src" / "main" / "contraband-scala",
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
@ -241,7 +241,7 @@ lazy val commandProj = (project in file("main-command"))
.settings(
testedBaseSettings,
name := "Command",
libraryDependencies ++= Seq(launcherInterface, sjsonNewScalaJson, templateResolverApi),
libraryDependencies ++= Seq(launcherInterface, sjsonNewScalaJson.value, templateResolverApi),
managedSourceDirectories in Compile +=
baseDirectory.value / "src" / "main" / "contraband-scala",
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",

View File

@ -120,7 +120,7 @@ object Package {
"Input file mappings:\n\t" + (sources map { case (f, s) => s + "\n\t " + f } mkString ("\n\t"))
implicit def manifestEquiv: Equiv[Manifest] = defaultEquiv
implicit def manifestFormat: JsonFormat[Manifest] = project[Manifest, Array[Byte]](
implicit def manifestFormat: JsonFormat[Manifest] = projectFormat[Manifest, Array[Byte]](
m => {
val bos = new java.io.ByteArrayOutputStream()
m write bos

View File

@ -12,7 +12,7 @@ class CacheIvyTest extends Properties("CacheIvy") {
import sjsonnew._
import sjsonnew.support.scalajson.unsafe.Converter
import scala.json.ast.unsafe.JValue
import scalajson.ast.unsafe.JValue
private class InMemoryStore(converter: SupportConverter[JValue]) extends CacheStore {
private var content: JValue = _

View File

@ -3,7 +3,7 @@
*/
// DO NOT EDIT MANUALLY
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait CommandSourceFormats { self: sjsonnew.BasicJsonProtocol =>
implicit lazy val CommandSourceFormat: JsonFormat[sbt.CommandSource] = new JsonFormat[sbt.CommandSource] {
override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.CommandSource = {

View File

@ -3,7 +3,7 @@
*/
// DO NOT EDIT MANUALLY
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait ExecFormats { self: CommandSourceFormats with sjsonnew.BasicJsonProtocol =>
implicit lazy val ExecFormat: JsonFormat[sbt.Exec] = new JsonFormat[sbt.Exec] {
override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.Exec = {

View File

@ -14,7 +14,7 @@ final class CommandSource private (
case _ => false
}
override def hashCode: Int = {
37 * (17 + channelName.##)
37 * (37 * (17 + "CommandSource".##) + channelName.##)
}
override def toString: String = {
"CommandSource(" + channelName + ")"

View File

@ -16,7 +16,7 @@ final class Exec private (
case _ => false
}
override def hashCode: Int = {
37 * (37 * (37 * (17 + commandLine.##) + execId.##) + source.##)
37 * (37 * (37 * (37 * (17 + "Exec".##) + commandLine.##) + execId.##) + source.##)
}
override def toString: String = {
"Exec(" + commandLine + ", " + execId + ", " + source + ")"

View File

@ -6,30 +6,35 @@ package sbt
import BasicCommandStrings.ClearOnFailure
import State.FailureWall
import annotation.tailrec
import java.io.File
import java.nio.file.FileSystems
import sbt.io.PathFinder
import sbt.internal.io.{ SourceModificationWatch, WatchState }
import scala.concurrent.duration._
import sbt.io.WatchService
import sbt.internal.io.{ Source, SourceModificationWatch, WatchState }
import sbt.internal.util.AttributeKey
import sbt.internal.util.Types.const
trait Watched {
/** The files watched when an action is run with a preceeding ~ */
def watchPaths(s: State): Seq[File] = Nil
def watchSources(s: State): Seq[Source] = Nil
def terminateWatch(key: Int): Boolean = Watched.isEnter(key)
/**
* The time in milliseconds between checking for changes. The actual time between the last change made to a file and the
* execution time is between `pollInterval` and `pollInterval*2`.
*/
def pollInterval: Int = Watched.PollDelayMillis
def pollInterval: FiniteDuration = Watched.PollDelay
/** The message to show when triggered execution waits for sources to change.*/
private[sbt] def watchingMessage(s: WatchState): String = Watched.defaultWatchingMessage(s)
/** The message to show before an action is run. */
private[sbt] def triggeredMessage(s: WatchState): String = Watched.defaultTriggeredMessage(s)
/** The `WatchService` to use to monitor the file system. */
private[sbt] def watchService(): WatchService = FileSystems.getDefault.newWatchService()
}
object Watched {
@ -43,7 +48,7 @@ object Watched {
def multi(base: Watched, paths: Seq[Watched]): Watched =
new AWatched {
override def watchPaths(s: State) = (base.watchPaths(s) /: paths)(_ ++ _.watchPaths(s))
override def watchSources(s: State) = (base.watchSources(s) /: paths)(_ ++ _.watchSources(s))
override def terminateWatch(key: Int): Boolean = base.terminateWatch(key)
override val pollInterval = (base +: paths).map(_.pollInterval).min
override def watchingMessage(s: WatchState) = base.watchingMessage(s)
@ -51,15 +56,16 @@ object Watched {
}
def empty: Watched = new AWatched
val PollDelayMillis = 500
val PollDelay: FiniteDuration = 500.milliseconds
def isEnter(key: Int): Boolean = key == 10 || key == 13
def printIfDefined(msg: String) = if (!msg.isEmpty) System.out.println(msg)
def executeContinuously(watched: Watched, s: State, next: String, repeat: String): State = {
@tailrec def shouldTerminate: Boolean =
(System.in.available > 0) && (watched.terminateWatch(System.in.read()) || shouldTerminate)
val sourcesFinder = PathFinder { watched watchPaths s }
val watchState = s get ContinuousState getOrElse WatchState.empty
val sources = watched.watchSources(s)
val service = watched.watchService()
val watchState = s get ContinuousState getOrElse WatchState.empty(service, sources)
if (watchState.count > 0)
printIfDefined(watched watchingMessage watchState)
@ -67,8 +73,7 @@ object Watched {
val (triggered, newWatchState) =
try {
val (triggered, newWatchState) =
SourceModificationWatch.watch(sourcesFinder, watched.pollInterval, watchState)(
shouldTerminate)
SourceModificationWatch.watch(watched.pollInterval, watchState)(shouldTerminate)
(triggered, newWatchState)
} catch {
case e: Exception =>
@ -84,7 +89,8 @@ object Watched {
(ClearOnFailure :: next :: FailureWall :: repeat :: s).put(ContinuousState, newWatchState)
} else {
while (System.in.available() > 0) System.in.read()
s.put(ContinuousState, WatchState.empty)
service.close()
s.remove(ContinuousState)
}
}
val ContinuousState =

View File

@ -5,6 +5,7 @@ package sbt
import Def.{ Initialize, ScopedKey, Setting, SettingsDefinition }
import java.io.{ File, PrintWriter }
import java.nio.file.FileSystems
import java.net.{ URI, URL }
import java.util.Optional
import java.util.concurrent.{ TimeUnit, Callable }
@ -23,7 +24,7 @@ import sbt.internal._
import sbt.internal.CommandStrings.ExportStream
import sbt.internal.inc.ZincUtil
import sbt.internal.inc.JavaInterfaceUtil._
import sbt.internal.io.WatchState
import sbt.internal.io.{ Source, WatchState }
import sbt.internal.librarymanagement._
import sbt.internal.librarymanagement.mavenint.{
PomExtraDependencyAttributes,
@ -47,7 +48,8 @@ import sbt.io.{
PathFinder,
SimpleFileFilter,
DirectoryFilter,
Hash
Hash,
WatchService
}, Path._
import sbt.librarymanagement.Artifact.{ DocClassifier, SourceClassifier }
import sbt.librarymanagement.Configurations.{
@ -250,7 +252,10 @@ object Defaults extends BuildCommon {
Previous.references :== new Previous.References,
concurrentRestrictions := defaultRestrictions.value,
parallelExecution :== true,
pollInterval :== 500,
pollInterval :== new FiniteDuration(500, TimeUnit.MILLISECONDS),
watchService :== { () =>
FileSystems.getDefault.newWatchService
},
logBuffered :== false,
commands :== Nil,
showSuccess :== true,
@ -317,7 +322,12 @@ object Defaults extends BuildCommon {
unmanagedSources := collectFiles(unmanagedSourceDirectories,
includeFilter in unmanagedSources,
excludeFilter in unmanagedSources).value,
watchSources in ConfigGlobal ++= unmanagedSources.value,
watchSources in ConfigGlobal ++= {
val bases = unmanagedSourceDirectories.value
val include = (includeFilter in unmanagedSources).value
val exclude = (excludeFilter in unmanagedSources).value
bases.map(b => new Source(b, include, exclude))
},
managedSourceDirectories := Seq(sourceManaged.value),
managedSources := generate(sourceGenerators).value,
sourceGenerators :== Nil,
@ -337,7 +347,12 @@ object Defaults extends BuildCommon {
unmanagedResources := collectFiles(unmanagedResourceDirectories,
includeFilter in unmanagedResources,
excludeFilter in unmanagedResources).value,
watchSources in ConfigGlobal ++= unmanagedResources.value,
watchSources in ConfigGlobal ++= {
val bases = unmanagedResourceDirectories.value
val include = (includeFilter in unmanagedResources).value
val exclude = (excludeFilter in unmanagedResources).value
bases.map(b => new Source(b, include, exclude))
},
resourceGenerators :== Nil,
resourceGenerators += Def.task {
PluginDiscovery.writeDescriptors(discoveredSbtPlugins.value, resourceManaged.value)
@ -537,7 +552,7 @@ object Defaults extends BuildCommon {
def generate(generators: SettingKey[Seq[Task[Seq[File]]]]): Initialize[Task[Seq[File]]] =
generators { _.join.map(_.flatten) }
def watchTransitiveSourcesTask: Initialize[Task[Seq[File]]] = {
def watchTransitiveSourcesTask: Initialize[Task[Seq[Source]]] = {
import ScopeFilter.Make.{ inDependencies => inDeps, _ }
val selectDeps = ScopeFilter(inAggregates(ThisProject) || inDeps(ThisProject))
val allWatched = (watchSources ?? Nil).all(selectDeps)
@ -554,6 +569,7 @@ object Defaults extends BuildCommon {
def watchSetting: Initialize[Watched] =
Def.setting {
val getService = watchService.value
val interval = pollInterval.value
val base = thisProjectRef.value
val msg = watchingMessage.value
@ -564,11 +580,13 @@ object Defaults extends BuildCommon {
override def pollInterval = interval
override def watchingMessage(s: WatchState) = msg(s)
override def triggeredMessage(s: WatchState) = trigMsg(s)
override def watchPaths(s: State) = EvaluateTask(Project structure s, key, s, base) match {
case Some((_, Value(ps))) => ps
case Some((_, Inc(i))) => throw i
case None => sys.error("key not found: " + Def.displayFull(key))
}
override def watchService() = getService()
override def watchSources(s: State) =
EvaluateTask(Project structure s, key, s, base) match {
case Some((_, Value(ps))) => ps
case Some((_, Inc(i))) => throw i
case None => sys.error("key not found: " + Def.displayFull(key))
}
}
}
@ -2153,7 +2171,7 @@ object Classpaths {
f: Map[ModuleID, Set[String]] => UpdateReport): UpdateReport = {
import sbt.librarymanagement.LibraryManagementCodec._
import sbt.util.FileBasedStore
implicit val isoString: sjsonnew.IsoString[scala.json.ast.unsafe.JValue] =
implicit val isoString: sjsonnew.IsoString[scalajson.ast.unsafe.JValue] =
sjsonnew.IsoString.iso(
sjsonnew.support.scalajson.unsafe.CompactPrinter.apply,
sjsonnew.support.scalajson.unsafe.Parser.parseUnsafe

View File

@ -36,8 +36,8 @@ import sbt.internal.{
SessionSettings,
LogManager
}
import sbt.io.FileFilter
import sbt.internal.io.WatchState
import sbt.io.{ FileFilter, WatchService }
import sbt.internal.io.{ Source, WatchState }
import sbt.internal.util.{ AttributeKey, SourcePosition }
import sbt.librarymanagement.Configurations.CompilerPlugin
@ -130,9 +130,10 @@ object Keys {
val analysis = AttributeKey[CompileAnalysis]("analysis", "Analysis of compilation, including dependencies and generated outputs.", DSetting)
val watch = SettingKey(BasicKeys.watch)
val suppressSbtShellNotification = SettingKey[Boolean]("suppressSbtShellNotification", """True to suppress the "Executing in batch mode.." message.""", CSetting)
val pollInterval = SettingKey[Int]("poll-interval", "Interval between checks for modified sources by the continuous execution command.", BMinusSetting)
val watchSources = TaskKey[Seq[File]]("watch-sources", "Defines the sources in this project for continuous execution to watch for changes.", BMinusSetting)
val watchTransitiveSources = TaskKey[Seq[File]]("watch-transitive-sources", "Defines the sources in all projects for continuous execution to watch.", CSetting)
val pollInterval = SettingKey[FiniteDuration]("poll-interval", "Interval between checks for modified sources by the continuous execution command.", BMinusSetting)
val watchService = SettingKey[() => WatchService]("watch-service", "Service to use to monitor file system changes.", BMinusSetting)
val watchSources = TaskKey[Seq[Source]]("watch-sources", "Defines the sources in this project for continuous execution to watch for changes.", BMinusSetting)
val watchTransitiveSources = TaskKey[Seq[Source]]("watch-transitive-sources", "Defines the sources in all projects for continuous execution to watch.", CSetting)
val watchingMessage = SettingKey[WatchState => String]("watching-message", "The message to show when triggered execution waits for sources to change.", DSetting)
val triggeredMessage = SettingKey[WatchState => String]("triggered-message", "The message to show before triggered execution executes an action after sources change.", DSetting)

View File

@ -22,7 +22,7 @@ object AltLibraryManagementCodec extends LibraryManagementCodec {
}
implicit val altRawRepositoryJsonFormat: JsonFormat[RawRepository] =
project(_.name, FakeRawRepository.create)
projectFormat(_.name, FakeRawRepository.create)
// Redefine to add RawRepository, and switch to unionFormat
override lazy implicit val ResolverFormat: JsonFormat[Resolver] =
@ -65,7 +65,7 @@ object AltLibraryManagementCodec extends LibraryManagementCodec {
None)
}
project[InlineIvyConfiguration, InlineIvyHL](inlineIvyToHL, hlToInlineIvy)
projectFormat[InlineIvyConfiguration, InlineIvyHL](inlineIvyToHL, hlToInlineIvy)
}
// Redefine to use a subset of properties, that are serialisable
@ -82,7 +82,7 @@ object AltLibraryManagementCodec extends LibraryManagementCodec {
Vector.empty)
}
project[ExternalIvyConfiguration, ExternalIvyHL](externalIvyToHL, hlToExternalIvy)
projectFormat[ExternalIvyConfiguration, ExternalIvyHL](externalIvyToHL, hlToExternalIvy)
}
// Redefine to switch to unionFormat

View File

@ -250,7 +250,7 @@ object BuildStreams {
def mkStreams(units: Map[URI, LoadedBuildUnit],
root: URI,
data: Settings[Scope]): State => Streams = s => {
implicit val isoString: sjsonnew.IsoString[scala.json.ast.unsafe.JValue] =
implicit val isoString: sjsonnew.IsoString[scalajson.ast.unsafe.JValue] =
sjsonnew.IsoString.iso(sjsonnew.support.scalajson.unsafe.CompactPrinter.apply,
sjsonnew.support.scalajson.unsafe.Parser.parseUnsafe)
(s get Keys.stateStreams) getOrElse {

View File

@ -10,7 +10,7 @@ import sbt.util.Level
import sbt.internal.util._
import sbt.protocol.LogEvent
import sbt.internal.util.codec._
import scala.json.ast.unsafe._
import scalajson.ast.unsafe._
class RelayAppender(name: String)
extends AbstractAppender(name, null, PatternLayout.createDefaultLayout(), true) {

View File

@ -6,7 +6,7 @@ package internal
package server
import java.net.URI
import scala.json.ast.unsafe.JValue
import scalajson.ast.unsafe.JValue
import scala.util.{ Left, Right }
import sbt.util.{ SomeJsonWriter, NoJsonWriter }
import sbt.librarymanagement.LibraryManagementCodec._

View File

@ -188,7 +188,7 @@ object SettingQueryTest extends org.specs2.mutable.Specification {
"setting query" should {
"t/scalaVersion" in qok("\"2.12.1\"", "java.lang.String")
"t/pollInterval" in qok("500", "Int")
// "t/pollInterval" in qok("500", "Int")
"t/sourcesInBase" in qok("true", "Boolean")
"t/startYear" in qok("null", "scala.Option[Int]")
"t/scalaArtifacts" in qok(

View File

@ -32,7 +32,7 @@ object ContrabandConfig {
case "sbt.testing.Status" => { _ =>
"sbt.internal.testing.StatusFormats" :: Nil
}
case "scala.json.ast.unsafe.JValue" => { _ =>
case "scalajson.ast.unsafe.JValue" => { _ =>
"sbt.internal.util.codec.JValueFormats" :: Nil
}
}

View File

@ -1,5 +1,6 @@
import sbt._
import Keys._
import sbt.contraband.ContrabandPlugin.autoImport._
object Dependencies {
val scala282 = "2.8.2"
@ -11,10 +12,10 @@ object Dependencies {
val baseScalaVersion = scala212
// sbt modules
private val ioVersion = "1.0.0-M11"
private val utilVersion = "1.0.0-M24"
private val lmVersion = "1.0.0-X15"
private val zincVersion = "1.0.0-X16"
private val ioVersion = "1.0.0-M12"
private val utilVersion = "1.0.0-M25"
private val lmVersion = "1.0.0-X16"
private val zincVersion = "1.0.0-X17"
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion
@ -108,8 +109,7 @@ object Dependencies {
def addSbtZincCompile(p: Project): Project =
addSbtModule(p, sbtZincPath, "zincCompile", zincCompile)
val sjsonNewScalaJson = "com.eed3si9n" %% "sjson-new-scalajson" % "0.7.0"
val sjsonNewScalaJson = Def.setting { "com.eed3si9n" %% "sjson-new-scalajson" % contrabandSjsonNewVersion.value }
val scalatest = "org.scalatest" %% "scalatest" % "3.0.1"
val scalaCheck = "org.scalacheck" %% "scalacheck" % "1.13.4"
val specs2 = "org.specs2" %% "specs2" % "2.4.17"

View File

@ -7,6 +7,6 @@ scalacOptions ++= Seq("-feature", "-language:postfixOps")
// addSbtPlugin("com.typesafe.sbt" % "sbt-javaversioncheck" % "0.1.0")
// addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.2.0")
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.4.0")
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.3.0-M5")
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.3.0-M7")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0-M1")
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.3")

View File

@ -14,7 +14,7 @@ final class ChannelAcceptedEvent private (
case _ => false
}
override def hashCode: Int = {
37 * (17 + channelName.##)
37 * (37 * (17 + "ChannelAcceptedEvent".##) + channelName.##)
}
override def toString: String = {
"ChannelAcceptedEvent(" + channelName + ")"

View File

@ -15,7 +15,7 @@ override def equals(o: Any): Boolean = o match {
case _ => false
}
override def hashCode: Int = {
17
37 * (17 + "CommandMessage".##)
}
override def toString: String = {
"CommandMessage()"

View File

@ -15,7 +15,7 @@ override def equals(o: Any): Boolean = o match {
case _ => false
}
override def hashCode: Int = {
17
37 * (17 + "EventMessage".##)
}
override def toString: String = {
"EventMessage()"

View File

@ -16,7 +16,7 @@ final class ExecCommand private (
case _ => false
}
override def hashCode: Int = {
37 * (37 * (17 + commandLine.##) + execId.##)
37 * (37 * (37 * (17 + "ExecCommand".##) + commandLine.##) + execId.##)
}
override def toString: String = {
"ExecCommand(" + commandLine + ", " + execId + ")"

View File

@ -18,7 +18,7 @@ final class ExecStatusEvent private (
case _ => false
}
override def hashCode: Int = {
37 * (37 * (37 * (37 * (17 + status.##) + channelName.##) + execId.##) + commandQueue.##)
37 * (37 * (37 * (37 * (37 * (17 + "ExecStatusEvent".##) + status.##) + channelName.##) + execId.##) + commandQueue.##)
}
override def toString: String = {
"ExecStatusEvent(" + status + ", " + channelName + ", " + execId + ", " + commandQueue + ")"

View File

@ -16,7 +16,7 @@ final class ExecutionEvent private (
case _ => false
}
override def hashCode: Int = {
37 * (37 * (17 + success.##) + commandLine.##)
37 * (37 * (37 * (17 + "ExecutionEvent".##) + success.##) + commandLine.##)
}
override def toString: String = {
"ExecutionEvent(" + success + ", " + commandLine + ")"

View File

@ -16,7 +16,7 @@ final class LogEvent private (
case _ => false
}
override def hashCode: Int = {
37 * (37 * (17 + level.##) + message.##)
37 * (37 * (37 * (17 + "LogEvent".##) + level.##) + message.##)
}
override def toString: String = {
"LogEvent(" + level + ", " + message + ")"

View File

@ -14,7 +14,7 @@ final class SettingQuery private (
case _ => false
}
override def hashCode: Int = {
37 * (17 + setting.##)
37 * (37 * (17 + "SettingQuery".##) + setting.##)
}
override def toString: String = {
"SettingQuery(" + setting + ")"

View File

@ -14,7 +14,7 @@ final class SettingQueryFailure private (
case _ => false
}
override def hashCode: Int = {
37 * (17 + message.##)
37 * (37 * (17 + "SettingQueryFailure".##) + message.##)
}
override def toString: String = {
"SettingQueryFailure(" + message + ")"

View File

@ -14,7 +14,7 @@ override def equals(o: Any): Boolean = o match {
case _ => false
}
override def hashCode: Int = {
17
37 * (17 + "SettingQueryResponse".##)
}
override def toString: String = {
"SettingQueryResponse()"

View File

@ -5,7 +5,7 @@
// DO NOT EDIT MANUALLY
package sbt.protocol
final class SettingQuerySuccess private (
val value: scala.json.ast.unsafe.JValue,
val value: scalajson.ast.unsafe.JValue,
val contentType: String) extends sbt.protocol.SettingQueryResponse() with Serializable {
@ -15,15 +15,15 @@ final class SettingQuerySuccess private (
case _ => false
}
override def hashCode: Int = {
37 * (37 * (17 + value.##) + contentType.##)
37 * (37 * (37 * (17 + "SettingQuerySuccess".##) + value.##) + contentType.##)
}
override def toString: String = {
"SettingQuerySuccess(" + value + ", " + contentType + ")"
}
protected[this] def copy(value: scala.json.ast.unsafe.JValue = value, contentType: String = contentType): SettingQuerySuccess = {
protected[this] def copy(value: scalajson.ast.unsafe.JValue = value, contentType: String = contentType): SettingQuerySuccess = {
new SettingQuerySuccess(value, contentType)
}
def withValue(value: scala.json.ast.unsafe.JValue): SettingQuerySuccess = {
def withValue(value: scalajson.ast.unsafe.JValue): SettingQuerySuccess = {
copy(value = value)
}
def withContentType(contentType: String): SettingQuerySuccess = {
@ -32,5 +32,5 @@ final class SettingQuerySuccess private (
}
object SettingQuerySuccess {
def apply(value: scala.json.ast.unsafe.JValue, contentType: String): SettingQuerySuccess = new SettingQuerySuccess(value, contentType)
def apply(value: scalajson.ast.unsafe.JValue, contentType: String): SettingQuerySuccess = new SettingQuerySuccess(value, contentType)
}

View File

@ -4,7 +4,7 @@
// DO NOT EDIT MANUALLY
package sbt.protocol.codec
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait ChannelAcceptedEventFormats { self: sjsonnew.BasicJsonProtocol =>
implicit lazy val ChannelAcceptedEventFormat: JsonFormat[sbt.protocol.ChannelAcceptedEvent] = new JsonFormat[sbt.protocol.ChannelAcceptedEvent] {
override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.protocol.ChannelAcceptedEvent = {

View File

@ -4,7 +4,8 @@
// DO NOT EDIT MANUALLY
package sbt.protocol.codec
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.JsonFormat
trait CommandMessageFormats { self: sjsonnew.BasicJsonProtocol with sbt.protocol.codec.ExecCommandFormats with sbt.protocol.codec.SettingQueryFormats =>
implicit lazy val CommandMessageFormat: JsonFormat[sbt.protocol.CommandMessage] = flatUnionFormat2[sbt.protocol.CommandMessage, sbt.protocol.ExecCommand, sbt.protocol.SettingQuery]("type")
}

View File

@ -4,7 +4,8 @@
// DO NOT EDIT MANUALLY
package sbt.protocol.codec
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.JsonFormat
trait EventMessageFormats { self: sjsonnew.BasicJsonProtocol with sbt.protocol.codec.ChannelAcceptedEventFormats with sbt.protocol.codec.LogEventFormats with sbt.protocol.codec.ExecStatusEventFormats with sbt.internal.util.codec.JValueFormats with sbt.protocol.codec.SettingQuerySuccessFormats with sbt.protocol.codec.SettingQueryFailureFormats =>
implicit lazy val EventMessageFormat: JsonFormat[sbt.protocol.EventMessage] = flatUnionFormat5[sbt.protocol.EventMessage, sbt.protocol.ChannelAcceptedEvent, sbt.protocol.LogEvent, sbt.protocol.ExecStatusEvent, sbt.protocol.SettingQuerySuccess, sbt.protocol.SettingQueryFailure]("type")
}

View File

@ -4,7 +4,7 @@
// DO NOT EDIT MANUALLY
package sbt.protocol.codec
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait ExecCommandFormats { self: sjsonnew.BasicJsonProtocol =>
implicit lazy val ExecCommandFormat: JsonFormat[sbt.protocol.ExecCommand] = new JsonFormat[sbt.protocol.ExecCommand] {
override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.protocol.ExecCommand = {

View File

@ -4,7 +4,7 @@
// DO NOT EDIT MANUALLY
package sbt.protocol.codec
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait ExecStatusEventFormats { self: sjsonnew.BasicJsonProtocol =>
implicit lazy val ExecStatusEventFormat: JsonFormat[sbt.protocol.ExecStatusEvent] = new JsonFormat[sbt.protocol.ExecStatusEvent] {
override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.protocol.ExecStatusEvent = {

View File

@ -4,7 +4,7 @@
// DO NOT EDIT MANUALLY
package sbt.protocol.codec
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait ExecutionEventFormats { self: sjsonnew.BasicJsonProtocol =>
implicit lazy val ExecutionEventFormat: JsonFormat[sbt.protocol.ExecutionEvent] = new JsonFormat[sbt.protocol.ExecutionEvent] {
override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.protocol.ExecutionEvent = {

View File

@ -4,7 +4,7 @@
// DO NOT EDIT MANUALLY
package sbt.protocol.codec
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait LogEventFormats { self: sjsonnew.BasicJsonProtocol =>
implicit lazy val LogEventFormat: JsonFormat[sbt.protocol.LogEvent] = new JsonFormat[sbt.protocol.LogEvent] {
override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.protocol.LogEvent = {

View File

@ -4,7 +4,7 @@
// DO NOT EDIT MANUALLY
package sbt.protocol.codec
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait SettingQueryFailureFormats { self: sjsonnew.BasicJsonProtocol =>
implicit lazy val SettingQueryFailureFormat: JsonFormat[sbt.protocol.SettingQueryFailure] = new JsonFormat[sbt.protocol.SettingQueryFailure] {
override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.protocol.SettingQueryFailure = {

View File

@ -4,7 +4,7 @@
// DO NOT EDIT MANUALLY
package sbt.protocol.codec
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait SettingQueryFormats { self: sjsonnew.BasicJsonProtocol =>
implicit lazy val SettingQueryFormat: JsonFormat[sbt.protocol.SettingQuery] = new JsonFormat[sbt.protocol.SettingQuery] {
override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.protocol.SettingQuery = {

View File

@ -4,7 +4,8 @@
// DO NOT EDIT MANUALLY
package sbt.protocol.codec
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.JsonFormat
trait SettingQueryResponseFormats { self: sbt.internal.util.codec.JValueFormats with sjsonnew.BasicJsonProtocol with sbt.protocol.codec.SettingQuerySuccessFormats with sbt.protocol.codec.SettingQueryFailureFormats =>
implicit lazy val SettingQueryResponseFormat: JsonFormat[sbt.protocol.SettingQueryResponse] = flatUnionFormat2[sbt.protocol.SettingQueryResponse, sbt.protocol.SettingQuerySuccess, sbt.protocol.SettingQueryFailure]("type")
}

View File

@ -4,14 +4,14 @@
// DO NOT EDIT MANUALLY
package sbt.protocol.codec
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait SettingQuerySuccessFormats { self: sbt.internal.util.codec.JValueFormats with sjsonnew.BasicJsonProtocol =>
implicit lazy val SettingQuerySuccessFormat: JsonFormat[sbt.protocol.SettingQuerySuccess] = new JsonFormat[sbt.protocol.SettingQuerySuccess] {
override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.protocol.SettingQuerySuccess = {
jsOpt match {
case Some(js) =>
unbuilder.beginObject(js)
val value = unbuilder.readField[scala.json.ast.unsafe.JValue]("value")
val value = unbuilder.readField[scalajson.ast.unsafe.JValue]("value")
val contentType = unbuilder.readField[String]("contentType")
unbuilder.endObject()
sbt.protocol.SettingQuerySuccess(value, contentType)

View File

@ -43,7 +43,7 @@ type ExecStatusEvent implements EventMessage {
interface SettingQueryResponse implements EventMessage {}
type SettingQuerySuccess implements SettingQueryResponse {
value: scala.json.ast.unsafe.JValue!
value: scalajson.ast.unsafe.JValue!
contentType: String!
}

View File

@ -6,7 +6,7 @@ package protocol
import sjsonnew.JsonFormat
import sjsonnew.support.scalajson.unsafe.{ Parser, Converter, CompactPrinter }
import scala.json.ast.unsafe.{ JValue, JObject, JString }
import scalajson.ast.unsafe.{ JValue, JObject, JString }
import java.nio.ByteBuffer
import scala.util.{ Success, Failure }
import sbt.internal.util.StringEvent

View File

@ -38,7 +38,7 @@ final class ForkOptions private (
case _ => false
}
override def hashCode: Int = {
37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + javaHome.##) + outputStrategy.##) + bootJars.##) + workingDirectory.##) + runJVMOptions.##) + connectInput.##) + envVars.##)
37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "ForkOptions".##) + javaHome.##) + outputStrategy.##) + bootJars.##) + workingDirectory.##) + runJVMOptions.##) + connectInput.##) + envVars.##)
}
override def toString: String = {
"ForkOptions(" + javaHome + ", " + outputStrategy + ", " + bootJars + ", " + workingDirectory + ", " + runJVMOptions + ", " + connectInput + ", " + envVars + ")"

View File

@ -1,4 +1,4 @@
import sjsonnew.BasicJsonProtocol.{ project => _, _ }
import sjsonnew.BasicJsonProtocol._
lazy val x = taskKey[Int]("x")
lazy val y = taskKey[Int]("y")

View File

@ -2,7 +2,7 @@ import complete.Parser
import complete.DefaultParsers._
import sbinary.DefaultProtocol._
import Def.Initialize
import sjsonnew.BasicJsonProtocol.{ project => _, _ }
import sjsonnew.BasicJsonProtocol._
val keep = taskKey[Int]("")
val persist = taskKey[Int]("")

View File

@ -16,7 +16,7 @@ final class EndTestGroupErrorEvent private (
case _ => false
}
override def hashCode: Int = {
37 * (37 * (17 + name.##) + error.##)
37 * (37 * (37 * (17 + "EndTestGroupErrorEvent".##) + name.##) + error.##)
}
override def toString: String = {
"EndTestGroupErrorEvent(" + name + ", " + error + ")"

View File

@ -16,7 +16,7 @@ final class EndTestGroupEvent private (
case _ => false
}
override def hashCode: Int = {
37 * (37 * (17 + name.##) + result.##)
37 * (37 * (37 * (17 + "EndTestGroupEvent".##) + name.##) + result.##)
}
override def toString: String = {
"EndTestGroupEvent(" + name + ", " + result + ")"

View File

@ -15,7 +15,7 @@ final class StartTestGroupEvent private (
case _ => false
}
override def hashCode: Int = {
37 * (17 + name.##)
37 * (37 * (17 + "StartTestGroupEvent".##) + name.##)
}
override def toString: String = {
"StartTestGroupEvent(" + name + ")"

View File

@ -15,7 +15,7 @@ final class TestCompleteEvent private (
case _ => false
}
override def hashCode: Int = {
37 * (17 + result.##)
37 * (37 * (17 + "TestCompleteEvent".##) + result.##)
}
override def toString: String = {
"TestCompleteEvent(" + result + ")"

View File

@ -14,7 +14,7 @@ override def equals(o: Any): Boolean = o match {
case _ => false
}
override def hashCode: Int = {
17
37 * (17 + "TestInitEvent".##)
}
override def toString: String = {
"TestInitEvent()"

View File

@ -26,7 +26,7 @@ final class TestItemDetail private (
case _ => false
}
override def hashCode: Int = {
37 * (37 * (37 * (17 + fullyQualifiedName.##) + status.##) + duration.##)
37 * (37 * (37 * (37 * (17 + "TestItemDetail".##) + fullyQualifiedName.##) + status.##) + duration.##)
}
override def toString: String = {
"TestItemDetail(" + fullyQualifiedName + ", " + status + ", " + duration + ")"

View File

@ -16,7 +16,7 @@ final class TestItemEvent private (
case _ => false
}
override def hashCode: Int = {
37 * (37 * (17 + result.##) + detail.##)
37 * (37 * (37 * (17 + "TestItemEvent".##) + result.##) + detail.##)
}
override def toString: String = {
"TestItemEvent(" + result + ", " + detail + ")"

View File

@ -15,7 +15,7 @@ override def equals(o: Any): Boolean = o match {
case _ => false
}
override def hashCode: Int = {
17
37 * (17 + "TestMessage".##)
}
override def toString: String = {
"TestMessage()"

View File

@ -14,7 +14,7 @@ final class TestStringEvent private (
case _ => false
}
override def hashCode: Int = {
37 * (17 + value.##)
37 * (37 * (17 + "TestStringEvent".##) + value.##)
}
override def toString: String = {
value

View File

@ -4,7 +4,7 @@
// DO NOT EDIT MANUALLY
package sbt.protocol.testing.codec
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait EndTestGroupErrorEventFormats { self: sjsonnew.BasicJsonProtocol =>
implicit lazy val EndTestGroupErrorEventFormat: JsonFormat[sbt.protocol.testing.EndTestGroupErrorEvent] = new JsonFormat[sbt.protocol.testing.EndTestGroupErrorEvent] {
override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.protocol.testing.EndTestGroupErrorEvent = {

View File

@ -4,7 +4,7 @@
// DO NOT EDIT MANUALLY
package sbt.protocol.testing.codec
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait EndTestGroupEventFormats { self: sbt.protocol.testing.codec.TestResultFormats with sjsonnew.BasicJsonProtocol =>
implicit lazy val EndTestGroupEventFormat: JsonFormat[sbt.protocol.testing.EndTestGroupEvent] = new JsonFormat[sbt.protocol.testing.EndTestGroupEvent] {
override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.protocol.testing.EndTestGroupEvent = {

View File

@ -4,7 +4,7 @@
// DO NOT EDIT MANUALLY
package sbt.protocol.testing.codec
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait StartTestGroupEventFormats { self: sjsonnew.BasicJsonProtocol =>
implicit lazy val StartTestGroupEventFormat: JsonFormat[sbt.protocol.testing.StartTestGroupEvent] = new JsonFormat[sbt.protocol.testing.StartTestGroupEvent] {
override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.protocol.testing.StartTestGroupEvent = {

View File

@ -4,7 +4,7 @@
// DO NOT EDIT MANUALLY
package sbt.protocol.testing.codec
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait TestCompleteEventFormats { self: sbt.protocol.testing.codec.TestResultFormats with sjsonnew.BasicJsonProtocol =>
implicit lazy val TestCompleteEventFormat: JsonFormat[sbt.protocol.testing.TestCompleteEvent] = new JsonFormat[sbt.protocol.testing.TestCompleteEvent] {
override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.protocol.testing.TestCompleteEvent = {

View File

@ -4,7 +4,7 @@
// DO NOT EDIT MANUALLY
package sbt.protocol.testing.codec
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait TestInitEventFormats { self: sjsonnew.BasicJsonProtocol =>
implicit lazy val TestInitEventFormat: JsonFormat[sbt.protocol.testing.TestInitEvent] = new JsonFormat[sbt.protocol.testing.TestInitEvent] {
override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.protocol.testing.TestInitEvent = {

View File

@ -4,7 +4,7 @@
// DO NOT EDIT MANUALLY
package sbt.protocol.testing.codec
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait TestItemDetailFormats { self: sbt.internal.testing.StatusFormats with sjsonnew.BasicJsonProtocol =>
implicit lazy val TestItemDetailFormat: JsonFormat[sbt.protocol.testing.TestItemDetail] = new JsonFormat[sbt.protocol.testing.TestItemDetail] {
override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.protocol.testing.TestItemDetail = {

View File

@ -4,7 +4,7 @@
// DO NOT EDIT MANUALLY
package sbt.protocol.testing.codec
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait TestItemEventFormats { self: sbt.protocol.testing.codec.TestResultFormats with sbt.protocol.testing.codec.TestItemDetailFormats with sjsonnew.BasicJsonProtocol =>
implicit lazy val TestItemEventFormat: JsonFormat[sbt.protocol.testing.TestItemEvent] = new JsonFormat[sbt.protocol.testing.TestItemEvent] {
override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.protocol.testing.TestItemEvent = {

View File

@ -4,7 +4,8 @@
// DO NOT EDIT MANUALLY
package sbt.protocol.testing.codec
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.JsonFormat
trait TestMessageFormats { self: sjsonnew.BasicJsonProtocol with sbt.protocol.testing.codec.TestStringEventFormats with sbt.protocol.testing.codec.TestInitEventFormats with sbt.protocol.testing.codec.TestResultFormats with sbt.protocol.testing.codec.TestCompleteEventFormats with sbt.protocol.testing.codec.StartTestGroupEventFormats with sbt.protocol.testing.codec.EndTestGroupEventFormats with sbt.protocol.testing.codec.EndTestGroupErrorEventFormats with sbt.protocol.testing.codec.TestItemDetailFormats with sbt.protocol.testing.codec.TestItemEventFormats =>
implicit lazy val TestMessageFormat: JsonFormat[sbt.protocol.testing.TestMessage] = flatUnionFormat7[sbt.protocol.testing.TestMessage, sbt.protocol.testing.TestStringEvent, sbt.protocol.testing.TestInitEvent, sbt.protocol.testing.TestCompleteEvent, sbt.protocol.testing.StartTestGroupEvent, sbt.protocol.testing.EndTestGroupEvent, sbt.protocol.testing.EndTestGroupErrorEvent, sbt.protocol.testing.TestItemEvent]("type")
}

View File

@ -4,7 +4,7 @@
// DO NOT EDIT MANUALLY
package sbt.protocol.testing.codec
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait TestResultFormats { self: sjsonnew.BasicJsonProtocol =>
implicit lazy val TestResultFormat: JsonFormat[sbt.protocol.testing.TestResult] = new JsonFormat[sbt.protocol.testing.TestResult] {
override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.protocol.testing.TestResult = {

View File

@ -4,7 +4,7 @@
// DO NOT EDIT MANUALLY
package sbt.protocol.testing.codec
import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder }
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait TestStringEventFormats { self: sjsonnew.BasicJsonProtocol =>
implicit lazy val TestStringEventFormat: JsonFormat[sbt.protocol.testing.TestStringEvent] = new JsonFormat[sbt.protocol.testing.TestStringEvent] {
override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.protocol.testing.TestStringEvent = {