Skip to content

Commit

Permalink
Reformat with scalafmt 3.8.3
Browse files Browse the repository at this point in the history
Executed command: scalafmt --non-interactive
  • Loading branch information
scala-steward committed Oct 2, 2024
1 parent 0dd3f2c commit a7d74ec
Show file tree
Hide file tree
Showing 28 changed files with 1,600 additions and 1,129 deletions.
5 changes: 4 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,10 @@ lazy val conformance = (projectMatrix in file("conformance"))
),
codeGenClasspath := (compilerPluginJVM2_12 / Compile / fullClasspath).value,
libraryDependencies ++= Seq(
"com.thesamet.scalapb" %% "scalapb-json4s" % "1.0.0-alpha.1" exclude ("com.thesamet.scalapb", "scalapb-runtime_2.13")
"com.thesamet.scalapb" %% "scalapb-json4s" % "1.0.0-alpha.1" exclude (
"com.thesamet.scalapb",
"scalapb-runtime_2.13"
)
),
maintainer := "thesamet@gmail.com",
Compile / mainClass := Some("scalapb.ConformanceScala"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,39 @@ object JsonProto extends _root_.scalapb.GeneratedFileObject {
lazy val dependencies: Seq[_root_.scalapb.GeneratedFileObject] = Seq(
com.google.protobuf.any.AnyProto
)
lazy val messagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] =
Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]](
lazy val messagesCompanions
: Seq[_root_.scalapb.GeneratedMessageCompanion[? <: _root_.scalapb.GeneratedMessage]] =
Seq[_root_.scalapb.GeneratedMessageCompanion[? <: _root_.scalapb.GeneratedMessage]](
com.thesamet.docs.json.MyMessage,
com.thesamet.docs.json.MyContainer
)
private lazy val ProtoBytes: _root_.scala.Array[Byte] =
scalapb.Encoding.fromBase64(scala.collection.immutable.Seq(
"""Cgpqc29uLnByb3RvEhFjb20udGhlc2FtZXQuZG9jcxoZZ29vZ2xlL3Byb3RvYnVmL2FueS5wcm90byIhCglNeU1lc3NhZ2USF
scalapb.Encoding.fromBase64(
scala.collection.immutable
.Seq(
"""Cgpqc29uLnByb3RvEhFjb20udGhlc2FtZXQuZG9jcxoZZ29vZ2xlL3Byb3RvYnVmL2FueS5wcm90byIhCglNeU1lc3NhZ2USF
AoBeBgBIAEoBUIG4j8DEgF4UgF4IkYKC015Q29udGFpbmVyEjcKBm15X2FueRgBIAEoCzIULmdvb2dsZS5wcm90b2J1Zi5BbnlCC
uI/BxIFbXlBbnlSBW15QW55YgZwcm90bzM="""
).mkString)
)
.mkString
)
lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = {
val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes)
_root_.scalapb.descriptors.FileDescriptor.buildFrom(scalaProto, dependencies.map(_.scalaDescriptor))
_root_.scalapb.descriptors.FileDescriptor
.buildFrom(scalaProto, dependencies.map(_.scalaDescriptor))
}
lazy val javaDescriptor: com.google.protobuf.Descriptors.FileDescriptor = {
val javaProto = com.google.protobuf.DescriptorProtos.FileDescriptorProto.parseFrom(ProtoBytes)
com.google.protobuf.Descriptors.FileDescriptor.buildFrom(javaProto, _root_.scala.Array(
com.google.protobuf.any.AnyProto.javaDescriptor
))
com.google.protobuf.Descriptors.FileDescriptor.buildFrom(
javaProto,
_root_.scala.Array(
com.google.protobuf.any.AnyProto.javaDescriptor
)
)
}
@deprecated("Use javaDescriptor instead. In a future version this will refer to scalaDescriptor.", "ScalaPB 0.5.47")
@deprecated(
"Use javaDescriptor instead. In a future version this will refer to scalaDescriptor.",
"ScalaPB 0.5.47"
)
def descriptor: com.google.protobuf.Descriptors.FileDescriptor = javaDescriptor
}
}
179 changes: 107 additions & 72 deletions docs/src/main/scala/generated/com/thesamet/docs/json/MyContainer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,69 +7,83 @@ package com.thesamet.docs.json
final case class MyContainer(
myAny: _root_.scala.Option[com.google.protobuf.any.Any] = _root_.scala.None,
unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[MyContainer] {
@transient
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0
if (myAny.isDefined) {
val __value = myAny.get
__size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
};
__size += unknownFields.serializedSize
__size
}
override def serializedSize: _root_.scala.Int = {
var __size = __serializedSizeMemoized
if (__size == 0) {
__size = __computeSerializedSize() + 1
__serializedSizeMemoized = __size
}
__size - 1

}
def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = {
myAny.foreach { __v =>
val __m = __v
_output__.writeTag(1, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
unknownFields.writeTo(_output__)
) extends scalapb.GeneratedMessage
with scalapb.lenses.Updatable[MyContainer] {
@transient
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0
if (myAny.isDefined) {
val __value = myAny.get
__size += 1 + _root_.com.google.protobuf.CodedOutputStream
.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
};
__size += unknownFields.serializedSize
__size
}
override def serializedSize: _root_.scala.Int = {
var __size = __serializedSizeMemoized
if (__size == 0) {
__size = __computeSerializedSize() + 1
__serializedSizeMemoized = __size
}
def getMyAny: com.google.protobuf.any.Any = myAny.getOrElse(com.google.protobuf.any.Any.defaultInstance)
def clearMyAny: MyContainer = copy(myAny = _root_.scala.None)
def withMyAny(__v: com.google.protobuf.any.Any): MyContainer = copy(myAny = _root_.scala.Option(__v))
def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v)
def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty)
def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = {
(__fieldNumber: @_root_.scala.unchecked) match {
case 1 => myAny.orNull
}
__size - 1

}
def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = {
myAny.foreach { __v =>
val __m = __v
_output__.writeTag(1, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
unknownFields.writeTo(_output__)
}
def getMyAny: com.google.protobuf.any.Any =
myAny.getOrElse(com.google.protobuf.any.Any.defaultInstance)
def clearMyAny: MyContainer = copy(myAny = _root_.scala.None)
def withMyAny(__v: com.google.protobuf.any.Any): MyContainer =
copy(myAny = _root_.scala.Option(__v))
def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v)
def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty)
def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = {
(__fieldNumber: @ _root_.scala.unchecked) match {
case 1 => myAny.orNull
}
def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = {
_root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor)
(__field.number: @_root_.scala.unchecked) match {
case 1 => myAny.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
}
}
def getField(
__field: _root_.scalapb.descriptors.FieldDescriptor
): _root_.scalapb.descriptors.PValue = {
_root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor)
(__field.number: @ _root_.scala.unchecked) match {
case 1 => myAny.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
}
def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
def companion: com.thesamet.docs.json.MyContainer.type = com.thesamet.docs.json.MyContainer
// @@protoc_insertion_point(GeneratedMessage[com.thesamet.docs.MyContainer])
}
def toProtoString: _root_.scala.Predef.String =
_root_.scalapb.TextFormat.printToUnicodeString(this)
def companion: com.thesamet.docs.json.MyContainer.type = com.thesamet.docs.json.MyContainer
// @@protoc_insertion_point(GeneratedMessage[com.thesamet.docs.MyContainer])
}

object MyContainer extends scalapb.GeneratedMessageCompanion[com.thesamet.docs.json.MyContainer] {
implicit def messageCompanion: scalapb.GeneratedMessageCompanion[com.thesamet.docs.json.MyContainer] = this
def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): com.thesamet.docs.json.MyContainer = {
var __myAny: _root_.scala.Option[com.google.protobuf.any.Any] = _root_.scala.None
implicit def messageCompanion
: scalapb.GeneratedMessageCompanion[com.thesamet.docs.json.MyContainer] = this
def parseFrom(
`_input__`: _root_.com.google.protobuf.CodedInputStream
): com.thesamet.docs.json.MyContainer = {
var __myAny: _root_.scala.Option[com.google.protobuf.any.Any] = _root_.scala.None
var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
var _done__ = false
var _done__ = false
while (!_done__) {
val _tag__ = _input__.readTag()
_tag__ match {
case 0 => _done__ = true
case 10 =>
__myAny = _root_.scala.Option(__myAny.fold(_root_.scalapb.LiteParser.readMessage[com.google.protobuf.any.Any](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
__myAny = _root_.scala.Option(
__myAny.fold(
_root_.scalapb.LiteParser.readMessage[com.google.protobuf.any.Any](_input__)
)(_root_.scalapb.LiteParser.readMessage(_input__, _))
)
case tag =>
if (_unknownFields__ == null) {
_unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
Expand All @@ -78,39 +92,60 @@ object MyContainer extends scalapb.GeneratedMessageCompanion[com.thesamet.docs.j
}
}
com.thesamet.docs.json.MyContainer(
myAny = __myAny,
unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
myAny = __myAny,
unknownFields =
if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty
else _unknownFields__.result()
)
}
implicit def messageReads: _root_.scalapb.descriptors.Reads[com.thesamet.docs.json.MyContainer] = _root_.scalapb.descriptors.Reads{
case _root_.scalapb.descriptors.PMessage(__fieldsMap) =>
_root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.")
com.thesamet.docs.json.MyContainer(
myAny = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[_root_.scala.Option[com.google.protobuf.any.Any]])
)
case _ => throw new RuntimeException("Expected PMessage")
}
def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = com.thesamet.docs.json.JsonProto.javaDescriptor.getMessageTypes().get(1)
def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = com.thesamet.docs.json.JsonProto.scalaDescriptor.messages(1)
def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
(__number: @_root_.scala.unchecked) match {
implicit def messageReads: _root_.scalapb.descriptors.Reads[com.thesamet.docs.json.MyContainer] =
_root_.scalapb.descriptors.Reads {
case _root_.scalapb.descriptors.PMessage(__fieldsMap) =>
_root_.scala.Predef.require(
__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor),
"FieldDescriptor does not match message type."
)
com.thesamet.docs.json.MyContainer(
myAny = __fieldsMap
.get(scalaDescriptor.findFieldByNumber(1).get)
.flatMap(_.as[_root_.scala.Option[com.google.protobuf.any.Any]])
)
case _ => throw new RuntimeException("Expected PMessage")
}
def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor =
com.thesamet.docs.json.JsonProto.javaDescriptor.getMessageTypes().get(1)
def scalaDescriptor: _root_.scalapb.descriptors.Descriptor =
com.thesamet.docs.json.JsonProto.scalaDescriptor.messages(1)
def messageCompanionForFieldNumber(
__number: _root_.scala.Int
): _root_.scalapb.GeneratedMessageCompanion[?] = {
var __out: _root_.scalapb.GeneratedMessageCompanion[?] = null
(__number: @ _root_.scala.unchecked) match {
case 1 => __out = com.google.protobuf.any.Any
}
__out
}
lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty
def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
lazy val nestedMessagesCompanions
: Seq[_root_.scalapb.GeneratedMessageCompanion[? <: _root_.scalapb.GeneratedMessage]] =
Seq.empty
def enumCompanionForFieldNumber(
__fieldNumber: _root_.scala.Int
): _root_.scalapb.GeneratedEnumCompanion[?] = throw new MatchError(__fieldNumber)
lazy val defaultInstance = com.thesamet.docs.json.MyContainer(
myAny = _root_.scala.None
)
implicit class MyContainerLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, com.thesamet.docs.json.MyContainer]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, com.thesamet.docs.json.MyContainer](_l) {
def myAny: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.any.Any] = field(_.getMyAny)((c_, f_) => c_.copy(myAny = _root_.scala.Option(f_)))
def optionalMyAny: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.any.Any]] = field(_.myAny)((c_, f_) => c_.copy(myAny = f_))
implicit class MyContainerLens[UpperPB](
_l: _root_.scalapb.lenses.Lens[UpperPB, com.thesamet.docs.json.MyContainer]
) extends _root_.scalapb.lenses.ObjectLens[UpperPB, com.thesamet.docs.json.MyContainer](_l) {
def myAny: _root_.scalapb.lenses.Lens[UpperPB, com.google.protobuf.any.Any] =
field(_.getMyAny)((c_, f_) => c_.copy(myAny = _root_.scala.Option(f_)))
def optionalMyAny
: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[com.google.protobuf.any.Any]] =
field(_.myAny)((c_, f_) => c_.copy(myAny = f_))
}
final val MY_ANY_FIELD_NUMBER = 1
def of(
myAny: _root_.scala.Option[com.google.protobuf.any.Any]
myAny: _root_.scala.Option[com.google.protobuf.any.Any]
): _root_.com.thesamet.docs.json.MyContainer = _root_.com.thesamet.docs.json.MyContainer(
myAny
)
Expand Down
Loading

0 comments on commit a7d74ec

Please sign in to comment.