Add resources items to BSP contra

This commit is contained in:
Samuel CLARENC 2021-06-17 10:12:54 +02:00
parent eec3c32cc8
commit 56632c3893
8 changed files with 208 additions and 3 deletions

View File

@ -0,0 +1,37 @@
/**
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
*/
// DO NOT EDIT MANUALLY
package sbt.internal.bsp
/** @param resources List of resource files. */
final class ResourcesItem private (
val target: sbt.internal.bsp.BuildTargetIdentifier,
val resources: Vector[java.net.URI]) extends Serializable {
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
case x: ResourcesItem => (this.target == x.target) && (this.resources == x.resources)
case _ => false
})
override def hashCode: Int = {
37 * (37 * (37 * (17 + "sbt.internal.bsp.ResourcesItem".##) + target.##) + resources.##)
}
override def toString: String = {
"ResourcesItem(" + target + ", " + resources + ")"
}
private[this] def copy(target: sbt.internal.bsp.BuildTargetIdentifier = target, resources: Vector[java.net.URI] = resources): ResourcesItem = {
new ResourcesItem(target, resources)
}
def withTarget(target: sbt.internal.bsp.BuildTargetIdentifier): ResourcesItem = {
copy(target = target)
}
def withResources(resources: Vector[java.net.URI]): ResourcesItem = {
copy(resources = resources)
}
}
object ResourcesItem {
def apply(target: sbt.internal.bsp.BuildTargetIdentifier, resources: Vector[java.net.URI]): ResourcesItem = new ResourcesItem(target, resources)
}

View File

@ -0,0 +1,32 @@
/**
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
*/
// DO NOT EDIT MANUALLY
package sbt.internal.bsp
final class ResourcesParams private (
val targets: Vector[sbt.internal.bsp.BuildTargetIdentifier]) extends Serializable {
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
case x: ResourcesParams => (this.targets == x.targets)
case _ => false
})
override def hashCode: Int = {
37 * (37 * (17 + "sbt.internal.bsp.ResourcesParams".##) + targets.##)
}
override def toString: String = {
"ResourcesParams(" + targets + ")"
}
private[this] def copy(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier] = targets): ResourcesParams = {
new ResourcesParams(targets)
}
def withTargets(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier]): ResourcesParams = {
copy(targets = targets)
}
}
object ResourcesParams {
def apply(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier]): ResourcesParams = new ResourcesParams(targets)
}

View File

@ -0,0 +1,33 @@
/**
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
*/
// DO NOT EDIT MANUALLY
package sbt.internal.bsp
/** Build Target Resources response */
final class ResourcesResult private (
val items: Vector[sbt.internal.bsp.ResourcesItem]) extends Serializable {
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
case x: ResourcesResult => (this.items == x.items)
case _ => false
})
override def hashCode: Int = {
37 * (37 * (17 + "sbt.internal.bsp.ResourcesResult".##) + items.##)
}
override def toString: String = {
"ResourcesResult(" + items + ")"
}
private[this] def copy(items: Vector[sbt.internal.bsp.ResourcesItem] = items): ResourcesResult = {
new ResourcesResult(items)
}
def withItems(items: Vector[sbt.internal.bsp.ResourcesItem]): ResourcesResult = {
copy(items = items)
}
}
object ResourcesResult {
def apply(items: Vector[sbt.internal.bsp.ResourcesItem]): ResourcesResult = new ResourcesResult(items)
}

View File

@ -57,4 +57,7 @@ trait JsonProtocol extends sjsonnew.BasicJsonProtocol
with sbt.internal.bsp.codec.ScalaMainClassFormats
with sbt.internal.bsp.codec.ScalaMainClassesItemFormats
with sbt.internal.bsp.codec.ScalaMainClassesResultFormats
with sbt.internal.bsp.codec.ResourcesParamsFormats
with sbt.internal.bsp.codec.ResourcesItemFormats
with sbt.internal.bsp.codec.ResourcesResultFormats
object JsonProtocol extends JsonProtocol

View File

@ -0,0 +1,29 @@
/**
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
*/
// DO NOT EDIT MANUALLY
package sbt.internal.bsp.codec
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait ResourcesItemFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sjsonnew.BasicJsonProtocol =>
implicit lazy val ResourcesItemFormat: JsonFormat[sbt.internal.bsp.ResourcesItem] = new JsonFormat[sbt.internal.bsp.ResourcesItem] {
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.ResourcesItem = {
__jsOpt match {
case Some(__js) =>
unbuilder.beginObject(__js)
val target = unbuilder.readField[sbt.internal.bsp.BuildTargetIdentifier]("target")
val resources = unbuilder.readField[Vector[java.net.URI]]("resources")
unbuilder.endObject()
sbt.internal.bsp.ResourcesItem(target, resources)
case None =>
deserializationError("Expected JsObject but found None")
}
}
override def write[J](obj: sbt.internal.bsp.ResourcesItem, builder: Builder[J]): Unit = {
builder.beginObject()
builder.addField("target", obj.target)
builder.addField("resources", obj.resources)
builder.endObject()
}
}
}

View File

@ -0,0 +1,27 @@
/**
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
*/
// DO NOT EDIT MANUALLY
package sbt.internal.bsp.codec
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait ResourcesParamsFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sjsonnew.BasicJsonProtocol =>
implicit lazy val ResourcesParamsFormat: JsonFormat[sbt.internal.bsp.ResourcesParams] = new JsonFormat[sbt.internal.bsp.ResourcesParams] {
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.ResourcesParams = {
__jsOpt match {
case Some(__js) =>
unbuilder.beginObject(__js)
val targets = unbuilder.readField[Vector[sbt.internal.bsp.BuildTargetIdentifier]]("targets")
unbuilder.endObject()
sbt.internal.bsp.ResourcesParams(targets)
case None =>
deserializationError("Expected JsObject but found None")
}
}
override def write[J](obj: sbt.internal.bsp.ResourcesParams, builder: Builder[J]): Unit = {
builder.beginObject()
builder.addField("targets", obj.targets)
builder.endObject()
}
}
}

View File

@ -0,0 +1,27 @@
/**
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
*/
// DO NOT EDIT MANUALLY
package sbt.internal.bsp.codec
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait ResourcesResultFormats { self: sbt.internal.bsp.codec.ResourcesItemFormats with sjsonnew.BasicJsonProtocol =>
implicit lazy val ResourcesResultFormat: JsonFormat[sbt.internal.bsp.ResourcesResult] = new JsonFormat[sbt.internal.bsp.ResourcesResult] {
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.ResourcesResult = {
__jsOpt match {
case Some(__js) =>
unbuilder.beginObject(__js)
val items = unbuilder.readField[Vector[sbt.internal.bsp.ResourcesItem]]("items")
unbuilder.endObject()
sbt.internal.bsp.ResourcesResult(items)
case None =>
deserializationError("Expected JsObject but found None")
}
}
override def write[J](obj: sbt.internal.bsp.ResourcesResult, builder: Builder[J]): Unit = {
builder.beginObject()
builder.addField("items", obj.items)
builder.endObject()
}
}
}

View File

@ -342,11 +342,11 @@ type TaskFinishParams {
type CompileParams {
## A sequence of build targets to compile
targets: [sbt.internal.bsp.BuildTargetIdentifier]
## An optional unique identifier generated by the client to identify this request.
## The server may include this id in triggered notifications or response.
originId: String
## Optional arguments to the compilation process
arguments: [String]
}
@ -355,7 +355,7 @@ type CompileParams {
type BspCompileResult {
## An optional request id to know the origin of this report.
originId: String
## A status code for the execution.
statusCode: Int!
@ -635,3 +635,20 @@ type ScalaMainClass {
## Additional environment variables for the application.
environmentVariables: [String]
}
# Resources Param
type ResourcesParams {
targets: [sbt.internal.bsp.BuildTargetIdentifier]
}
## Build Target Resources response
type ResourcesResult {
items: [sbt.internal.bsp.ResourcesItem]
}
type ResourcesItem {
target: sbt.internal.bsp.BuildTargetIdentifier!
## List of resource files.
resources: [java.net.URI]
}