diff --git a/main-command/src/main/contraband-scala/CommandSourceFormats.scala b/main-command/src/main/contraband-scala/CommandSourceFormats.scala new file mode 100644 index 000000000..9944196b4 --- /dev/null +++ b/main-command/src/main/contraband-scala/CommandSourceFormats.scala @@ -0,0 +1,26 @@ +/** + * This code is generated using sbt-datatype. + */ + +// DO NOT EDIT MANUALLY +import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder } +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 = { + jsOpt match { + case Some(js) => + unbuilder.beginObject(js) + val channelName = unbuilder.readField[String]("channelName") + unbuilder.endObject() + sbt.CommandSource(channelName) + case None => + deserializationError("Expected JsObject but found None") + } + } + override def write[J](obj: sbt.CommandSource, builder: Builder[J]): Unit = { + builder.beginObject() + builder.addField("channelName", obj.channelName) + builder.endObject() + } +} +} diff --git a/main-command/src/main/contraband-scala/ExecFormats.scala b/main-command/src/main/contraband-scala/ExecFormats.scala new file mode 100644 index 000000000..98a0961a4 --- /dev/null +++ b/main-command/src/main/contraband-scala/ExecFormats.scala @@ -0,0 +1,30 @@ +/** + * This code is generated using sbt-datatype. + */ + +// DO NOT EDIT MANUALLY +import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder } +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 = { + jsOpt match { + case Some(js) => + unbuilder.beginObject(js) + val commandLine = unbuilder.readField[String]("commandLine") + val execId = unbuilder.readField[Option[String]]("execId") + val source = unbuilder.readField[Option[sbt.CommandSource]]("source") + unbuilder.endObject() + sbt.Exec(commandLine, execId, source) + case None => + deserializationError("Expected JsObject but found None") + } + } + override def write[J](obj: sbt.Exec, builder: Builder[J]): Unit = { + builder.beginObject() + builder.addField("commandLine", obj.commandLine) + builder.addField("execId", obj.execId) + builder.addField("source", obj.source) + builder.endObject() + } +} +} diff --git a/main-command/src/main/contraband-scala/sbt/internal/server/CommandMessage.scala b/main-command/src/main/contraband-scala/sbt/internal/server/CommandMessage.scala deleted file mode 100644 index 3998b26e7..000000000 --- a/main-command/src/main/contraband-scala/sbt/internal/server/CommandMessage.scala +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This code is generated using sbt-datatype. - */ - -// DO NOT EDIT MANUALLY -package sbt.internal.server -final class CommandMessage private ( - val `type`: String, - val commandLine: Option[String]) extends Serializable { - - private def this(`type`: String) = this(`type`, None) - - override def equals(o: Any): Boolean = o match { - case x: CommandMessage => (this.`type` == x.`type`) && (this.commandLine == x.commandLine) - case _ => false - } - override def hashCode: Int = { - 37 * (37 * (17 + `type`.##) + commandLine.##) - } - override def toString: String = { - "CommandMessage(" + `type` + ", " + commandLine + ")" - } - protected[this] def copy(`type`: String = `type`, commandLine: Option[String] = commandLine): CommandMessage = { - new CommandMessage(`type`, commandLine) - } - def withType(`type`: String): CommandMessage = { - copy(`type` = `type`) - } - def withCommandLine(commandLine: Option[String]): CommandMessage = { - copy(commandLine = commandLine) - } -} -object CommandMessage { - - def apply(`type`: String): CommandMessage = new CommandMessage(`type`, None) - def apply(`type`: String, commandLine: Option[String]): CommandMessage = new CommandMessage(`type`, commandLine) -} diff --git a/main-command/src/main/contraband-scala/sbt/internal/server/EventMessage.scala b/main-command/src/main/contraband-scala/sbt/internal/server/EventMessage.scala deleted file mode 100644 index 7bc176ba7..000000000 --- a/main-command/src/main/contraband-scala/sbt/internal/server/EventMessage.scala +++ /dev/null @@ -1,57 +0,0 @@ -/** - * This code is generated using sbt-datatype. - */ - -// DO NOT EDIT MANUALLY -package sbt.internal.server -final class EventMessage private ( - val `type`: String, - val status: Option[String], - val commandQueue: scala.Vector[String], - val level: Option[String], - val message: Option[String], - val success: Option[Boolean], - val commandLine: Option[String]) extends Serializable { - - private def this(`type`: String) = this(`type`, None, Vector(), None, None, None, None) - - override def equals(o: Any): Boolean = o match { - case x: EventMessage => (this.`type` == x.`type`) && (this.status == x.status) && (this.commandQueue == x.commandQueue) && (this.level == x.level) && (this.message == x.message) && (this.success == x.success) && (this.commandLine == x.commandLine) - case _ => false - } - override def hashCode: Int = { - 37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + `type`.##) + status.##) + commandQueue.##) + level.##) + message.##) + success.##) + commandLine.##) - } - override def toString: String = { - "EventMessage(" + `type` + ", " + status + ", " + commandQueue + ", " + level + ", " + message + ", " + success + ", " + commandLine + ")" - } - protected[this] def copy(`type`: String = `type`, status: Option[String] = status, commandQueue: scala.Vector[String] = commandQueue, level: Option[String] = level, message: Option[String] = message, success: Option[Boolean] = success, commandLine: Option[String] = commandLine): EventMessage = { - new EventMessage(`type`, status, commandQueue, level, message, success, commandLine) - } - def withType(`type`: String): EventMessage = { - copy(`type` = `type`) - } - def withStatus(status: Option[String]): EventMessage = { - copy(status = status) - } - def withCommandQueue(commandQueue: scala.Vector[String]): EventMessage = { - copy(commandQueue = commandQueue) - } - def withLevel(level: Option[String]): EventMessage = { - copy(level = level) - } - def withMessage(message: Option[String]): EventMessage = { - copy(message = message) - } - def withSuccess(success: Option[Boolean]): EventMessage = { - copy(success = success) - } - def withCommandLine(commandLine: Option[String]): EventMessage = { - copy(commandLine = commandLine) - } -} -object EventMessage { - - def apply(`type`: String): EventMessage = new EventMessage(`type`, None, Vector(), None, None, None, None) - def apply(`type`: String, status: Option[String], commandQueue: scala.Vector[String], level: Option[String], message: Option[String], success: Option[Boolean], commandLine: Option[String]): EventMessage = new EventMessage(`type`, status, commandQueue, level, message, success, commandLine) -} diff --git a/main-command/src/main/contraband-scala/sbt/internal/server/codec/CommandMessageFormats.scala b/main-command/src/main/contraband-scala/sbt/internal/server/codec/CommandMessageFormats.scala deleted file mode 100644 index 91ef66421..000000000 --- a/main-command/src/main/contraband-scala/sbt/internal/server/codec/CommandMessageFormats.scala +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This code is generated using sbt-datatype. - */ - -// DO NOT EDIT MANUALLY -package sbt.internal.server.codec -import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder } -trait CommandMessageFormats { self: sjsonnew.BasicJsonProtocol => -implicit lazy val CommandMessageFormat: JsonFormat[sbt.internal.server.CommandMessage] = new JsonFormat[sbt.internal.server.CommandMessage] { - override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.server.CommandMessage = { - jsOpt match { - case Some(js) => - unbuilder.beginObject(js) - val `type` = unbuilder.readField[String]("type") - val commandLine = unbuilder.readField[Option[String]]("commandLine") - unbuilder.endObject() - sbt.internal.server.CommandMessage(`type`, commandLine) - case None => - deserializationError("Expected JsObject but found None") - } - } - override def write[J](obj: sbt.internal.server.CommandMessage, builder: Builder[J]): Unit = { - builder.beginObject() - builder.addField("type", obj.`type`) - builder.addField("commandLine", obj.commandLine) - builder.endObject() - } -} -} diff --git a/main-command/src/main/contraband-scala/sbt/internal/server/codec/EventMessageFormats.scala b/main-command/src/main/contraband-scala/sbt/internal/server/codec/EventMessageFormats.scala deleted file mode 100644 index 7e2170046..000000000 --- a/main-command/src/main/contraband-scala/sbt/internal/server/codec/EventMessageFormats.scala +++ /dev/null @@ -1,39 +0,0 @@ -/** - * This code is generated using sbt-datatype. - */ - -// DO NOT EDIT MANUALLY -package sbt.internal.server.codec -import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder } -trait EventMessageFormats { self: sjsonnew.BasicJsonProtocol => -implicit lazy val EventMessageFormat: JsonFormat[sbt.internal.server.EventMessage] = new JsonFormat[sbt.internal.server.EventMessage] { - override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.server.EventMessage = { - jsOpt match { - case Some(js) => - unbuilder.beginObject(js) - val `type` = unbuilder.readField[String]("type") - val status = unbuilder.readField[Option[String]]("status") - val commandQueue = unbuilder.readField[scala.Vector[String]]("commandQueue") - val level = unbuilder.readField[Option[String]]("level") - val message = unbuilder.readField[Option[String]]("message") - val success = unbuilder.readField[Option[Boolean]]("success") - val commandLine = unbuilder.readField[Option[String]]("commandLine") - unbuilder.endObject() - sbt.internal.server.EventMessage(`type`, status, commandQueue, level, message, success, commandLine) - case None => - deserializationError("Expected JsObject but found None") - } - } - override def write[J](obj: sbt.internal.server.EventMessage, builder: Builder[J]): Unit = { - builder.beginObject() - builder.addField("type", obj.`type`) - builder.addField("status", obj.status) - builder.addField("commandQueue", obj.commandQueue) - builder.addField("level", obj.level) - builder.addField("message", obj.message) - builder.addField("success", obj.success) - builder.addField("commandLine", obj.commandLine) - builder.endObject() - } -} -} diff --git a/main-command/src/main/contraband/server.json b/main-command/src/main/contraband/server.json deleted file mode 100644 index 4e9ed1fa7..000000000 --- a/main-command/src/main/contraband/server.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "codecNamespace": "sbt.internal.server.codec", - "types": [ - { - "name": "CommandMessage", - "namespace": "sbt.internal.server", - "type": "record", - "target": "Scala", - "fields": [ - { - "name": "type", - "type": "String", - "since": "0.0.0" - }, - { - "name": "commandLine", - "type": "Option[String]", - "default": "None", - "since": "0.1.0" - } - ] - }, - { - "name": "EventMessage", - "namespace": "sbt.internal.server", - "type": "record", - "target": "Scala", - "fields": [ - { - "name": "type", - "type": "String", - "since": "0.0.0" - }, - { - "name": "status", - "type": "Option[String]", - "default": "None", - "since": "0.1.0" - }, - { - "name": "commandQueue", - "type": "scala.Vector[String]", - "default": "Vector()", - "since": "0.1.0" - }, - { - "name": "level", - "type": "Option[String]", - "default": "None", - "since": "0.1.0" - }, - { - "name": "message", - "type": "Option[String]", - "default": "None", - "since": "0.1.0" - }, - { - "name": "success", - "type": "Option[Boolean]", - "default": "None", - "since": "0.1.0" - }, - { - "name": "commandLine", - "type": "Option[String]", - "default": "None", - "since": "0.1.0" - } - ] - } - ] -} diff --git a/protocol/src/main/contraband-scala/sbt/protocol/ExectionEvent.scala b/protocol/src/main/contraband-scala/sbt/protocol/ExectionEvent.scala deleted file mode 100644 index 3a080e64b..000000000 --- a/protocol/src/main/contraband-scala/sbt/protocol/ExectionEvent.scala +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This code is generated using sbt-datatype. - */ - -// DO NOT EDIT MANUALLY -package sbt.protocol -/** Executon event. */ -final class ExectionEvent private ( - val success: String, - val commandLine: String) extends Serializable { - - - - override def equals(o: Any): Boolean = o match { - case x: ExectionEvent => (this.success == x.success) && (this.commandLine == x.commandLine) - case _ => false - } - override def hashCode: Int = { - 37 * (37 * (17 + success.##) + commandLine.##) - } - override def toString: String = { - "ExectionEvent(" + success + ", " + commandLine + ")" - } - protected[this] def copy(success: String = success, commandLine: String = commandLine): ExectionEvent = { - new ExectionEvent(success, commandLine) - } - def withSuccess(success: String): ExectionEvent = { - copy(success = success) - } - def withCommandLine(commandLine: String): ExectionEvent = { - copy(commandLine = commandLine) - } -} -object ExectionEvent { - - def apply(success: String, commandLine: String): ExectionEvent = new ExectionEvent(success, commandLine) -} diff --git a/protocol/src/main/contraband-scala/sbt/protocol/ExecutionEvent.scala b/protocol/src/main/contraband-scala/sbt/protocol/ExecutionEvent.scala new file mode 100644 index 000000000..611b1845f --- /dev/null +++ b/protocol/src/main/contraband-scala/sbt/protocol/ExecutionEvent.scala @@ -0,0 +1,37 @@ +/** + * This code is generated using sbt-datatype. + */ + +// DO NOT EDIT MANUALLY +package sbt.protocol +/** Execution event. */ +final class ExecutionEvent private ( + val success: String, + val commandLine: String) extends Serializable { + + + + override def equals(o: Any): Boolean = o match { + case x: ExecutionEvent => (this.success == x.success) && (this.commandLine == x.commandLine) + case _ => false + } + override def hashCode: Int = { + 37 * (37 * (17 + success.##) + commandLine.##) + } + override def toString: String = { + "ExecutionEvent(" + success + ", " + commandLine + ")" + } + protected[this] def copy(success: String = success, commandLine: String = commandLine): ExecutionEvent = { + new ExecutionEvent(success, commandLine) + } + def withSuccess(success: String): ExecutionEvent = { + copy(success = success) + } + def withCommandLine(commandLine: String): ExecutionEvent = { + copy(commandLine = commandLine) + } +} +object ExecutionEvent { + + def apply(success: String, commandLine: String): ExecutionEvent = new ExecutionEvent(success, commandLine) +} diff --git a/protocol/src/main/contraband-scala/sbt/protocol/codec/ExecutionEventFormats.scala b/protocol/src/main/contraband-scala/sbt/protocol/codec/ExecutionEventFormats.scala new file mode 100644 index 000000000..285fcb6c0 --- /dev/null +++ b/protocol/src/main/contraband-scala/sbt/protocol/codec/ExecutionEventFormats.scala @@ -0,0 +1,29 @@ +/** + * This code is generated using sbt-datatype. + */ + +// DO NOT EDIT MANUALLY +package sbt.protocol.codec +import _root_.sjsonnew.{ deserializationError, serializationError, Builder, JsonFormat, Unbuilder } +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 = { + jsOpt match { + case Some(js) => + unbuilder.beginObject(js) + val success = unbuilder.readField[String]("success") + val commandLine = unbuilder.readField[String]("commandLine") + unbuilder.endObject() + sbt.protocol.ExecutionEvent(success, commandLine) + case None => + deserializationError("Expected JsObject but found None") + } + } + override def write[J](obj: sbt.protocol.ExecutionEvent, builder: Builder[J]): Unit = { + builder.beginObject() + builder.addField("success", obj.success) + builder.addField("commandLine", obj.commandLine) + builder.endObject() + } +} +} diff --git a/protocol/src/main/contraband-scala/sbt/protocol/codec/JsonProtocol.scala b/protocol/src/main/contraband-scala/sbt/protocol/codec/JsonProtocol.scala index 5bf383215..fa9fb28ac 100644 --- a/protocol/src/main/contraband-scala/sbt/protocol/codec/JsonProtocol.scala +++ b/protocol/src/main/contraband-scala/sbt/protocol/codec/JsonProtocol.scala @@ -4,5 +4,12 @@ // DO NOT EDIT MANUALLY package sbt.protocol.codec -trait JsonProtocol extends sjsonnew.BasicJsonProtocol with sbt.protocol.codec.ExecCommandFormats with sbt.protocol.codec.CommandMessageFormats with sbt.protocol.codec.ChannelAcceptedEventFormats with sbt.protocol.codec.LogEventFormats with sbt.protocol.codec.ExecStatusEventFormats with sbt.protocol.codec.EventMessageFormats +trait JsonProtocol extends sjsonnew.BasicJsonProtocol + with sbt.protocol.codec.ExecCommandFormats + with sbt.protocol.codec.CommandMessageFormats + with sbt.protocol.codec.ChannelAcceptedEventFormats + with sbt.protocol.codec.LogEventFormats + with sbt.protocol.codec.ExecStatusEventFormats + with sbt.protocol.codec.EventMessageFormats + with sbt.protocol.codec.ExecutionEventFormats object JsonProtocol extends JsonProtocol \ No newline at end of file diff --git a/protocol/src/main/contraband/server.contra b/protocol/src/main/contraband/server.contra index 06193441d..717b74d61 100644 --- a/protocol/src/main/contraband/server.contra +++ b/protocol/src/main/contraband/server.contra @@ -40,8 +40,8 @@ type ExecStatusEvent implements EventMessage { # Processing # } -## Executon event. -type ExectionEvent { +## Execution event. +type ExecutionEvent { success: String! commandLine: String! }