From bbf2fb33bf771a16182f222973a57440bc2bd543 Mon Sep 17 00:00:00 2001 From: Nadav Samet Date: Sat, 15 Jul 2017 11:25:50 -0700 Subject: [PATCH] Update third_party protobuf from protobuf-3.3.1 --- .../com/google/protobuf/any/AnyProto.scala | 5 +- .../com/google/protobuf/api/ApiProto.scala | 5 +- .../plugin/CodeGeneratorRequest.scala | 39 +++- .../plugin/CodeGeneratorResponse.scala | 4 +- .../compiler/plugin/PluginProto.scala | 17 +- .../protobuf/compiler/plugin/Version.scala | 159 ++++++++++++++++ .../descriptor/DescriptorProtoCompanion.scala | 95 +++++----- .../protobuf/descriptor/FieldOptions.scala | 2 +- .../protobuf/descriptor/FileOptions.scala | 61 ++++-- .../protobuf/descriptor/MethodOptions.scala | 74 +++++++- .../google/protobuf/duration/Duration.scala | 21 ++- .../protobuf/duration/DurationProto.scala | 2 +- .../google/protobuf/empty/EmptyProto.scala | 6 +- .../protobuf/field_mask/FieldMask.scala | 6 +- .../protobuf/field_mask/FieldMaskProto.scala | 5 +- .../source_context/SourceContextProto.scala | 5 +- .../google/protobuf/struct/StructProto.scala | 2 +- .../google/protobuf/timestamp/Timestamp.scala | 33 +++- .../protobuf/timestamp/TimestampProto.scala | 6 +- .../google/protobuf/type/OptionProto.scala | 10 +- .../com/google/protobuf/type/TypeProto.scala | 5 +- .../protobuf/wrappers/WrappersProto.scala | 4 +- .../com/google/protobuf/any/AnyProto.scala | 5 +- .../com/google/protobuf/api/ApiProto.scala | 5 +- .../plugin/CodeGeneratorRequest.scala | 43 ++++- .../plugin/CodeGeneratorResponse.scala | 4 +- .../compiler/plugin/PluginProto.scala | 17 +- .../protobuf/compiler/plugin/Version.scala | 173 ++++++++++++++++++ .../descriptor/DescriptorProtoCompanion.scala | 95 +++++----- .../protobuf/descriptor/FieldOptions.scala | 2 +- .../protobuf/descriptor/FileOptions.scala | 65 +++++-- .../protobuf/descriptor/MethodOptions.scala | 78 +++++++- .../google/protobuf/duration/Duration.scala | 21 ++- .../protobuf/duration/DurationProto.scala | 2 +- .../google/protobuf/empty/EmptyProto.scala | 6 +- .../protobuf/field_mask/FieldMask.scala | 6 +- .../protobuf/field_mask/FieldMaskProto.scala | 5 +- .../source_context/SourceContextProto.scala | 5 +- .../google/protobuf/struct/StructProto.scala | 2 +- .../google/protobuf/timestamp/Timestamp.scala | 33 +++- .../protobuf/timestamp/TimestampProto.scala | 6 +- .../google/protobuf/type/OptionProto.scala | 10 +- .../com/google/protobuf/type/TypeProto.scala | 5 +- .../protobuf/wrappers/WrappersProto.scala | 4 +- third_party/google/protobuf/any.proto | 1 - third_party/google/protobuf/api.proto | 2 +- .../google/protobuf/compiler/plugin.proto | 18 +- third_party/google/protobuf/descriptor.proto | 56 ++++-- third_party/google/protobuf/duration.proto | 23 ++- third_party/google/protobuf/empty.proto | 1 - third_party/google/protobuf/field_mask.proto | 8 +- .../google/protobuf/source_context.proto | 2 +- third_party/google/protobuf/struct.proto | 2 +- third_party/google/protobuf/timestamp.proto | 34 +++- third_party/google/protobuf/type.proto | 13 +- third_party/google/protobuf/wrappers.proto | 1 - 56 files changed, 1061 insertions(+), 258 deletions(-) create mode 100644 scalapb-runtime/js/src/main/scala/com/google/protobuf/compiler/plugin/Version.scala create mode 100644 scalapb-runtime/jvm/src/main/scala/com/google/protobuf/compiler/plugin/Version.scala diff --git a/scalapb-runtime/js/src/main/scala/com/google/protobuf/any/AnyProto.scala b/scalapb-runtime/js/src/main/scala/com/google/protobuf/any/AnyProto.scala index 985e31d60..c13882ce9 100644 --- a/scalapb-runtime/js/src/main/scala/com/google/protobuf/any/AnyProto.scala +++ b/scalapb-runtime/js/src/main/scala/com/google/protobuf/any/AnyProto.scala @@ -11,9 +11,8 @@ object AnyProto { private lazy val ProtoBytes: Array[Byte] = com.trueaccord.scalapb.Encoding.fromBase64(scala.collection.Seq( """Chlnb29nbGUvcHJvdG9idWYvYW55LnByb3RvEg9nb29nbGUucHJvdG9idWYiNgoDQW55EhkKCHR5cGVfdXJsGAEgASgJUgd0e - XBlVXJsEhQKBXZhbHVlGAIgASgMUgV2YWx1ZUJyChNjb20uZ29vZ2xlLnByb3RvYnVmQghBbnlQcm90b1ABWiVnaXRodWIuY29tL - 2dvbGFuZy9wcm90b2J1Zi9wdHlwZXMvYW55oAEBogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90b - zM=""" + XBlVXJsEhQKBXZhbHVlGAIgASgMUgV2YWx1ZUJvChNjb20uZ29vZ2xlLnByb3RvYnVmQghBbnlQcm90b1ABWiVnaXRodWIuY29tL + 2dvbGFuZy9wcm90b2J1Zi9wdHlwZXMvYW55ogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM=""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) diff --git a/scalapb-runtime/js/src/main/scala/com/google/protobuf/api/ApiProto.scala b/scalapb-runtime/js/src/main/scala/com/google/protobuf/api/ApiProto.scala index 747540c46..8a82783a3 100644 --- a/scalapb-runtime/js/src/main/scala/com/google/protobuf/api/ApiProto.scala +++ b/scalapb-runtime/js/src/main/scala/com/google/protobuf/api/ApiProto.scala @@ -20,8 +20,9 @@ object ApiProto { WFtaW5nGAMgASgIUhByZXF1ZXN0U3RyZWFtaW5nEioKEXJlc3BvbnNlX3R5cGVfdXJsGAQgASgJUg9yZXNwb25zZVR5cGVVcmwSL QoScmVzcG9uc2Vfc3RyZWFtaW5nGAUgASgIUhFyZXNwb25zZVN0cmVhbWluZxIxCgdvcHRpb25zGAYgAygLMhcuZ29vZ2xlLnByb 3RvYnVmLk9wdGlvblIHb3B0aW9ucxIvCgZzeW50YXgYByABKA4yFy5nb29nbGUucHJvdG9idWYuU3ludGF4UgZzeW50YXgiLwoFT - Wl4aW4SEgoEbmFtZRgBIAEoCVIEbmFtZRISCgRyb290GAIgASgJUgRyb290QksKE2NvbS5nb29nbGUucHJvdG9idWZCCEFwaVByb - 3RvUAGgAQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw==""" + Wl4aW4SEgoEbmFtZRgBIAEoCVIEbmFtZRISCgRyb290GAIgASgJUgRyb290QnUKE2NvbS5nb29nbGUucHJvdG9idWZCCEFwaVByb + 3RvUAFaK2dvb2dsZS5nb2xhbmcub3JnL2dlbnByb3RvL3Byb3RvYnVmL2FwaTthcGmiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV + 2VsbEtub3duVHlwZXNiBnByb3RvMw==""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) diff --git a/scalapb-runtime/js/src/main/scala/com/google/protobuf/compiler/plugin/CodeGeneratorRequest.scala b/scalapb-runtime/js/src/main/scala/com/google/protobuf/compiler/plugin/CodeGeneratorRequest.scala index 1004a534e..ae0508a3a 100644 --- a/scalapb-runtime/js/src/main/scala/com/google/protobuf/compiler/plugin/CodeGeneratorRequest.scala +++ b/scalapb-runtime/js/src/main/scala/com/google/protobuf/compiler/plugin/CodeGeneratorRequest.scala @@ -27,12 +27,18 @@ package com.google.protobuf.compiler.plugin * the entire set into memory at once. However, as of this writing, this * is not similarly optimized on protoc's end -- it will store all fields in * memory at once before sending them to the plugin. + * + * Type names of fields and extensions in the FileDescriptorProto are always + * fully qualified. + * @param compilerVersion + * The version number of protocol compiler. */ @SerialVersionUID(0L) final case class CodeGeneratorRequest( fileToGenerate: _root_.scala.collection.Seq[String] = _root_.scala.collection.Seq.empty, parameter: scala.Option[String] = None, - protoFile: _root_.scala.collection.Seq[com.google.protobuf.descriptor.FileDescriptorProto] = _root_.scala.collection.Seq.empty + protoFile: _root_.scala.collection.Seq[com.google.protobuf.descriptor.FileDescriptorProto] = _root_.scala.collection.Seq.empty, + compilerVersion: scala.Option[com.google.protobuf.compiler.plugin.Version] = None ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[CodeGeneratorRequest] with com.trueaccord.lenses.Updatable[CodeGeneratorRequest] { @transient private[this] var __serializedSizeCachedValue: Int = 0 @@ -41,6 +47,7 @@ final case class CodeGeneratorRequest( fileToGenerate.foreach(fileToGenerate => __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, fileToGenerate)) if (parameter.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, parameter.get) } protoFile.foreach(protoFile => __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(protoFile.serializedSize) + protoFile.serializedSize) + if (compilerVersion.isDefined) { __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(compilerVersion.get.serializedSize) + compilerVersion.get.serializedSize } __size } final override def serializedSize: Int = { @@ -58,6 +65,11 @@ final case class CodeGeneratorRequest( parameter.foreach { __v => _output__.writeString(2, __v) }; + compilerVersion.foreach { __v => + _output__.writeTag(3, 2) + _output__.writeUInt32NoTag(__v.serializedSize) + __v.writeTo(_output__) + }; protoFile.foreach { __v => _output__.writeTag(15, 2) _output__.writeUInt32NoTag(__v.serializedSize) @@ -68,6 +80,7 @@ final case class CodeGeneratorRequest( val __fileToGenerate = (_root_.scala.collection.immutable.Vector.newBuilder[String] ++= this.fileToGenerate) var __parameter = this.parameter val __protoFile = (_root_.scala.collection.immutable.Vector.newBuilder[com.google.protobuf.descriptor.FileDescriptorProto] ++= this.protoFile) + var __compilerVersion = this.compilerVersion var _done__ = false while (!_done__) { val _tag__ = _input__.readTag() @@ -79,13 +92,16 @@ final case class CodeGeneratorRequest( __parameter = Some(_input__.readString()) case 122 => __protoFile += _root_.com.trueaccord.scalapb.LiteParser.readMessage(_input__, com.google.protobuf.descriptor.FileDescriptorProto.defaultInstance) + case 26 => + __compilerVersion = Some(_root_.com.trueaccord.scalapb.LiteParser.readMessage(_input__, __compilerVersion.getOrElse(com.google.protobuf.compiler.plugin.Version.defaultInstance))) case tag => _input__.skipField(tag) } } com.google.protobuf.compiler.plugin.CodeGeneratorRequest( fileToGenerate = __fileToGenerate.result(), parameter = __parameter, - protoFile = __protoFile.result() + protoFile = __protoFile.result(), + compilerVersion = __compilerVersion ) } def clearFileToGenerate = copy(fileToGenerate = _root_.scala.collection.Seq.empty) @@ -99,11 +115,15 @@ final case class CodeGeneratorRequest( def addProtoFile(__vs: com.google.protobuf.descriptor.FileDescriptorProto*): CodeGeneratorRequest = addAllProtoFile(__vs) def addAllProtoFile(__vs: TraversableOnce[com.google.protobuf.descriptor.FileDescriptorProto]): CodeGeneratorRequest = copy(protoFile = protoFile ++ __vs) def withProtoFile(__v: _root_.scala.collection.Seq[com.google.protobuf.descriptor.FileDescriptorProto]): CodeGeneratorRequest = copy(protoFile = __v) + def getCompilerVersion: com.google.protobuf.compiler.plugin.Version = compilerVersion.getOrElse(com.google.protobuf.compiler.plugin.Version.defaultInstance) + def clearCompilerVersion: CodeGeneratorRequest = copy(compilerVersion = None) + def withCompilerVersion(__v: com.google.protobuf.compiler.plugin.Version): CodeGeneratorRequest = copy(compilerVersion = Some(__v)) def getFieldByNumber(__fieldNumber: Int): scala.Any = { (__fieldNumber: @_root_.scala.unchecked) match { case 1 => fileToGenerate case 2 => parameter.orNull case 15 => protoFile + case 3 => compilerVersion.orNull } } def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { @@ -112,6 +132,7 @@ final case class CodeGeneratorRequest( case 1 => _root_.scalapb.descriptors.PRepeated(fileToGenerate.map(_root_.scalapb.descriptors.PString)(_root_.scala.collection.breakOut)) case 2 => parameter.map(_root_.scalapb.descriptors.PString).getOrElse(_root_.scalapb.descriptors.PEmpty) case 15 => _root_.scalapb.descriptors.PRepeated(protoFile.map(_.toPMessage)(_root_.scala.collection.breakOut)) + case 3 => compilerVersion.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) } } override def toString: String = _root_.com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) @@ -126,7 +147,8 @@ object CodeGeneratorRequest extends com.trueaccord.scalapb.GeneratedMessageCompa com.google.protobuf.compiler.plugin.CodeGeneratorRequest( __fieldsMap.getOrElse(__fields.get(0), Nil).asInstanceOf[_root_.scala.collection.Seq[String]], __fieldsMap.get(__fields.get(1)).asInstanceOf[scala.Option[String]], - __fieldsMap.getOrElse(__fields.get(2), Nil).asInstanceOf[_root_.scala.collection.Seq[com.google.protobuf.descriptor.FileDescriptorProto]] + __fieldsMap.getOrElse(__fields.get(2), Nil).asInstanceOf[_root_.scala.collection.Seq[com.google.protobuf.descriptor.FileDescriptorProto]], + __fieldsMap.get(__fields.get(3)).asInstanceOf[scala.Option[com.google.protobuf.compiler.plugin.Version]] ) } implicit def messageReads: _root_.scalapb.descriptors.Reads[com.google.protobuf.compiler.plugin.CodeGeneratorRequest] = _root_.scalapb.descriptors.Reads{ @@ -135,16 +157,18 @@ object CodeGeneratorRequest extends com.trueaccord.scalapb.GeneratedMessageCompa com.google.protobuf.compiler.plugin.CodeGeneratorRequest( __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.collection.Seq[String]]).getOrElse(_root_.scala.collection.Seq.empty), __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[scala.Option[String]]), - __fieldsMap.get(scalaDescriptor.findFieldByNumber(15).get).map(_.as[_root_.scala.collection.Seq[com.google.protobuf.descriptor.FileDescriptorProto]]).getOrElse(_root_.scala.collection.Seq.empty) + __fieldsMap.get(scalaDescriptor.findFieldByNumber(15).get).map(_.as[_root_.scala.collection.Seq[com.google.protobuf.descriptor.FileDescriptorProto]]).getOrElse(_root_.scala.collection.Seq.empty), + __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[scala.Option[com.google.protobuf.compiler.plugin.Version]]) ) case _ => throw new RuntimeException("Expected PMessage") } - def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = PluginProto.javaDescriptor.getMessageTypes.get(0) - def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = PluginProto.scalaDescriptor.messages(0) + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = PluginProto.javaDescriptor.getMessageTypes.get(1) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = PluginProto.scalaDescriptor.messages(1) def messageCompanionForFieldNumber(__fieldNumber: Int): _root_.com.trueaccord.scalapb.GeneratedMessageCompanion[_] = { var __out: _root_.com.trueaccord.scalapb.GeneratedMessageCompanion[_] = null (__fieldNumber: @_root_.scala.unchecked) match { case 15 => __out = com.google.protobuf.descriptor.FileDescriptorProto + case 3 => __out = com.google.protobuf.compiler.plugin.Version } __out } @@ -156,8 +180,11 @@ object CodeGeneratorRequest extends com.trueaccord.scalapb.GeneratedMessageCompa def parameter: _root_.com.trueaccord.lenses.Lens[UpperPB, String] = field(_.getParameter)((c_, f_) => c_.copy(parameter = Some(f_))) def optionalParameter: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[String]] = field(_.parameter)((c_, f_) => c_.copy(parameter = f_)) def protoFile: _root_.com.trueaccord.lenses.Lens[UpperPB, _root_.scala.collection.Seq[com.google.protobuf.descriptor.FileDescriptorProto]] = field(_.protoFile)((c_, f_) => c_.copy(protoFile = f_)) + def compilerVersion: _root_.com.trueaccord.lenses.Lens[UpperPB, com.google.protobuf.compiler.plugin.Version] = field(_.getCompilerVersion)((c_, f_) => c_.copy(compilerVersion = Some(f_))) + def optionalCompilerVersion: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[com.google.protobuf.compiler.plugin.Version]] = field(_.compilerVersion)((c_, f_) => c_.copy(compilerVersion = f_)) } final val FILE_TO_GENERATE_FIELD_NUMBER = 1 final val PARAMETER_FIELD_NUMBER = 2 final val PROTO_FILE_FIELD_NUMBER = 15 + final val COMPILER_VERSION_FIELD_NUMBER = 3 } diff --git a/scalapb-runtime/js/src/main/scala/com/google/protobuf/compiler/plugin/CodeGeneratorResponse.scala b/scalapb-runtime/js/src/main/scala/com/google/protobuf/compiler/plugin/CodeGeneratorResponse.scala index fe0ab50f5..211a3594d 100644 --- a/scalapb-runtime/js/src/main/scala/com/google/protobuf/compiler/plugin/CodeGeneratorResponse.scala +++ b/scalapb-runtime/js/src/main/scala/com/google/protobuf/compiler/plugin/CodeGeneratorResponse.scala @@ -113,8 +113,8 @@ object CodeGeneratorResponse extends com.trueaccord.scalapb.GeneratedMessageComp ) case _ => throw new RuntimeException("Expected PMessage") } - def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = PluginProto.javaDescriptor.getMessageTypes.get(1) - def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = PluginProto.scalaDescriptor.messages(1) + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = PluginProto.javaDescriptor.getMessageTypes.get(2) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = PluginProto.scalaDescriptor.messages(2) def messageCompanionForFieldNumber(__fieldNumber: Int): _root_.com.trueaccord.scalapb.GeneratedMessageCompanion[_] = { var __out: _root_.com.trueaccord.scalapb.GeneratedMessageCompanion[_] = null (__fieldNumber: @_root_.scala.unchecked) match { diff --git a/scalapb-runtime/js/src/main/scala/com/google/protobuf/compiler/plugin/PluginProto.scala b/scalapb-runtime/js/src/main/scala/com/google/protobuf/compiler/plugin/PluginProto.scala index b51e1ac5e..58388190f 100644 --- a/scalapb-runtime/js/src/main/scala/com/google/protobuf/compiler/plugin/PluginProto.scala +++ b/scalapb-runtime/js/src/main/scala/com/google/protobuf/compiler/plugin/PluginProto.scala @@ -11,13 +11,16 @@ object PluginProto { private lazy val ProtoBytes: Array[Byte] = com.trueaccord.scalapb.Encoding.fromBase64(scala.collection.Seq( """CiVnb29nbGUvcHJvdG9idWYvY29tcGlsZXIvcGx1Z2luLnByb3RvEhhnb29nbGUucHJvdG9idWYuY29tcGlsZXIaIGdvb2dsZ - S9wcm90b2J1Zi9kZ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Y29tcGlsZXIuVmVyc2lvblIPY29tcGlsZXJWZXJzaW9uItYBC + hVDb2RlR2VuZXJhdG9yUmVzcG9uc2USFAoFZXJyb3IYASABKAlSBWVycm9yEkgKBGZpbGUYDyADKAsyNC5nb29nbGUucHJvdG9id + WYuY29tcGlsZXIuQ29kZUdlbmVyYXRvclJlc3BvbnNlLkZpbGVSBGZpbGUaXQoERmlsZRISCgRuYW1lGAEgASgJUgRuYW1lEicKD + 2luc2VydGlvbl9wb2ludBgCIAEoCVIOaW5zZXJ0aW9uUG9pbnQSGAoHY29udGVudBgPIAEoCVIHY29udGVudEJnChxjb20uZ29vZ + 2xlLnByb3RvYnVmLmNvbXBpbGVyQgxQbHVnaW5Qcm90b3NaOWdpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3Byb3RvYy1nZW4tZ + 28vcGx1Z2luO3BsdWdpbl9nbw==""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) diff --git a/scalapb-runtime/js/src/main/scala/com/google/protobuf/compiler/plugin/Version.scala b/scalapb-runtime/js/src/main/scala/com/google/protobuf/compiler/plugin/Version.scala new file mode 100644 index 000000000..f246f60fe --- /dev/null +++ b/scalapb-runtime/js/src/main/scala/com/google/protobuf/compiler/plugin/Version.scala @@ -0,0 +1,159 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO2 + +package com.google.protobuf.compiler.plugin + + + +/** The version number of protocol compiler. + * + * @param suffix + * A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should + * be empty for mainline stable releases. + */ +@SerialVersionUID(0L) +final case class Version( + major: scala.Option[Int] = None, + minor: scala.Option[Int] = None, + patch: scala.Option[Int] = None, + suffix: scala.Option[String] = None + ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[Version] with com.trueaccord.lenses.Updatable[Version] { + @transient + private[this] var __serializedSizeCachedValue: Int = 0 + private[this] def __computeSerializedValue(): Int = { + var __size = 0 + if (major.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(1, major.get) } + if (minor.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(2, minor.get) } + if (patch.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(3, patch.get) } + if (suffix.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(4, suffix.get) } + __size + } + final override def serializedSize: Int = { + var read = __serializedSizeCachedValue + if (read == 0) { + read = __computeSerializedValue() + __serializedSizeCachedValue = read + } + read + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): Unit = { + major.foreach { __v => + _output__.writeInt32(1, __v) + }; + minor.foreach { __v => + _output__.writeInt32(2, __v) + }; + patch.foreach { __v => + _output__.writeInt32(3, __v) + }; + suffix.foreach { __v => + _output__.writeString(4, __v) + }; + } + def mergeFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): com.google.protobuf.compiler.plugin.Version = { + var __major = this.major + var __minor = this.minor + var __patch = this.patch + var __suffix = this.suffix + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 8 => + __major = Some(_input__.readInt32()) + case 16 => + __minor = Some(_input__.readInt32()) + case 24 => + __patch = Some(_input__.readInt32()) + case 34 => + __suffix = Some(_input__.readString()) + case tag => _input__.skipField(tag) + } + } + com.google.protobuf.compiler.plugin.Version( + major = __major, + minor = __minor, + patch = __patch, + suffix = __suffix + ) + } + def getMajor: Int = major.getOrElse(0) + def clearMajor: Version = copy(major = None) + def withMajor(__v: Int): Version = copy(major = Some(__v)) + def getMinor: Int = minor.getOrElse(0) + def clearMinor: Version = copy(minor = None) + def withMinor(__v: Int): Version = copy(minor = Some(__v)) + def getPatch: Int = patch.getOrElse(0) + def clearPatch: Version = copy(patch = None) + def withPatch(__v: Int): Version = copy(patch = Some(__v)) + def getSuffix: String = suffix.getOrElse("") + def clearSuffix: Version = copy(suffix = None) + def withSuffix(__v: String): Version = copy(suffix = Some(__v)) + def getFieldByNumber(__fieldNumber: Int): scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => major.orNull + case 2 => minor.orNull + case 3 => patch.orNull + case 4 => suffix.orNull + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => major.map(_root_.scalapb.descriptors.PInt).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 2 => minor.map(_root_.scalapb.descriptors.PInt).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 3 => patch.map(_root_.scalapb.descriptors.PInt).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 4 => suffix.map(_root_.scalapb.descriptors.PString).getOrElse(_root_.scalapb.descriptors.PEmpty) + } + } + override def toString: String = _root_.com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) + def companion = com.google.protobuf.compiler.plugin.Version +} + +object Version extends com.trueaccord.scalapb.GeneratedMessageCompanion[com.google.protobuf.compiler.plugin.Version] { + implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[com.google.protobuf.compiler.plugin.Version] = this + def fromFieldsMap(__fieldsMap: scala.collection.immutable.Map[_root_.com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.google.protobuf.compiler.plugin.Version = { + require(__fieldsMap.keys.forall(_.getContainingType() == javaDescriptor), "FieldDescriptor does not match message type.") + val __fields = javaDescriptor.getFields + com.google.protobuf.compiler.plugin.Version( + __fieldsMap.get(__fields.get(0)).asInstanceOf[scala.Option[Int]], + __fieldsMap.get(__fields.get(1)).asInstanceOf[scala.Option[Int]], + __fieldsMap.get(__fields.get(2)).asInstanceOf[scala.Option[Int]], + __fieldsMap.get(__fields.get(3)).asInstanceOf[scala.Option[String]] + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[com.google.protobuf.compiler.plugin.Version] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + require(__fieldsMap.keys.forall(_.containingMessage == scalaDescriptor), "FieldDescriptor does not match message type.") + com.google.protobuf.compiler.plugin.Version( + __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[scala.Option[Int]]), + __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[scala.Option[Int]]), + __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[scala.Option[Int]]), + __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).flatMap(_.as[scala.Option[String]]) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = PluginProto.javaDescriptor.getMessageTypes.get(0) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = PluginProto.scalaDescriptor.messages(0) + def messageCompanionForFieldNumber(__fieldNumber: Int): _root_.com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__fieldNumber) + def enumCompanionForFieldNumber(__fieldNumber: Int): _root_.com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = com.google.protobuf.compiler.plugin.Version( + ) + implicit class VersionLens[UpperPB](_l: _root_.com.trueaccord.lenses.Lens[UpperPB, com.google.protobuf.compiler.plugin.Version]) extends _root_.com.trueaccord.lenses.ObjectLens[UpperPB, com.google.protobuf.compiler.plugin.Version](_l) { + def major: _root_.com.trueaccord.lenses.Lens[UpperPB, Int] = field(_.getMajor)((c_, f_) => c_.copy(major = Some(f_))) + def optionalMajor: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[Int]] = field(_.major)((c_, f_) => c_.copy(major = f_)) + def minor: _root_.com.trueaccord.lenses.Lens[UpperPB, Int] = field(_.getMinor)((c_, f_) => c_.copy(minor = Some(f_))) + def optionalMinor: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[Int]] = field(_.minor)((c_, f_) => c_.copy(minor = f_)) + def patch: _root_.com.trueaccord.lenses.Lens[UpperPB, Int] = field(_.getPatch)((c_, f_) => c_.copy(patch = Some(f_))) + def optionalPatch: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[Int]] = field(_.patch)((c_, f_) => c_.copy(patch = f_)) + def suffix: _root_.com.trueaccord.lenses.Lens[UpperPB, String] = field(_.getSuffix)((c_, f_) => c_.copy(suffix = Some(f_))) + def optionalSuffix: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[String]] = field(_.suffix)((c_, f_) => c_.copy(suffix = f_)) + } + final val MAJOR_FIELD_NUMBER = 1 + final val MINOR_FIELD_NUMBER = 2 + final val PATCH_FIELD_NUMBER = 3 + final val SUFFIX_FIELD_NUMBER = 4 +} diff --git a/scalapb-runtime/js/src/main/scala/com/google/protobuf/descriptor/DescriptorProtoCompanion.scala b/scalapb-runtime/js/src/main/scala/com/google/protobuf/descriptor/DescriptorProtoCompanion.scala index e3ad30835..496aca788 100644 --- a/scalapb-runtime/js/src/main/scala/com/google/protobuf/descriptor/DescriptorProtoCompanion.scala +++ b/scalapb-runtime/js/src/main/scala/com/google/protobuf/descriptor/DescriptorProtoCompanion.scala @@ -51,54 +51,59 @@ object DescriptorProtoCompanion { i5TZXJ2aWNlT3B0aW9uc1IHb3B0aW9ucyKJAgoVTWV0aG9kRGVzY3JpcHRvclByb3RvEhIKBG5hbWUYASABKAlSBG5hbWUSHQoKa W5wdXRfdHlwZRgCIAEoCVIJaW5wdXRUeXBlEh8KC291dHB1dF90eXBlGAMgASgJUgpvdXRwdXRUeXBlEjgKB29wdGlvbnMYBCABK AsyHi5nb29nbGUucHJvdG9idWYuTWV0aG9kT3B0aW9uc1IHb3B0aW9ucxIwChBjbGllbnRfc3RyZWFtaW5nGAUgASgIOgVmYWxzZ - VIPY2xpZW50U3RyZWFtaW5n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AVSA2VuZEKMAQoTY29tLmdvb2dsZS5wcm90b2J1ZkIQRGVzY3Jpc + HRvclByb3Rvc0gBWj5naXRodWIuY29tL2dvbGFuZy9wcm90b2J1Zi9wcm90b2MtZ2VuLWdvL2Rlc2NyaXB0b3I7ZGVzY3JpcHRvc + qICA0dQQqoCGkdvb2dsZS5Qcm90b2J1Zi5SZWZsZWN0aW9u""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) diff --git a/scalapb-runtime/js/src/main/scala/com/google/protobuf/descriptor/FieldOptions.scala b/scalapb-runtime/js/src/main/scala/com/google/protobuf/descriptor/FieldOptions.scala index 6c64adc8c..9faa95281 100644 --- a/scalapb-runtime/js/src/main/scala/com/google/protobuf/descriptor/FieldOptions.scala +++ b/scalapb-runtime/js/src/main/scala/com/google/protobuf/descriptor/FieldOptions.scala @@ -48,7 +48,7 @@ package com.google.protobuf.descriptor * * * Note that implementations may choose not to check required fields within - * a lazy sub-message. That is, calling IsInitialized() on the outher message + * a lazy sub-message. That is, calling IsInitialized() on the outer message * may return true even if the inner message has missing required fields. * This is necessary because otherwise the inner message would have to be * parsed in order to perform the check, defeating the purpose of lazy diff --git a/scalapb-runtime/js/src/main/scala/com/google/protobuf/descriptor/FileOptions.scala b/scalapb-runtime/js/src/main/scala/com/google/protobuf/descriptor/FileOptions.scala index 7759c0608..6d5b1e64b 100644 --- a/scalapb-runtime/js/src/main/scala/com/google/protobuf/descriptor/FileOptions.scala +++ b/scalapb-runtime/js/src/main/scala/com/google/protobuf/descriptor/FileOptions.scala @@ -26,18 +26,7 @@ package com.google.protobuf.descriptor * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. * @param javaGenerateEqualsAndHash - * If set true, then the Java code generator will generate equals() and - * hashCode() methods for all messages defined in the .proto file. - * This increases generated code size, potentially substantially for large - * protos, which may harm a memory-constrained application. - * - In the full runtime this is a speed optimization, as the - * AbstractMessage base class includes reflection-based implementations of - * these methods. - * - In the lite runtime, setting this option changes the semantics of - * equals() and hashCode() to more closely match those of the full runtime; - * the generated methods compute their results based on field values rather - * than object identity. (Implementations should not assume that hashcodes - * will be consistent across runtimes or versions of the protocol compiler.) + * This option does nothing. * @param javaStringCheckUtf8 * If set true, then the Java2 code generator will generate code that * throws an exception whenever an attempt is made to assign a non-UTF-8 @@ -75,6 +64,14 @@ package com.google.protobuf.descriptor * generated classes from this .proto. There is no default. * @param csharpNamespace * Namespace for generated classes; defaults to the package. + * @param swiftPrefix + * By default Swift generators will take the proto package and CamelCase it + * replacing '.' with underscore and use that to prefix the types/symbols + * defined. When this options is provided, they will use this value instead + * to prefix the types/symbols defined. + * @param phpClassPrefix + * Sets the php class prefix which is prepended to all php generated classes + * from this .proto. Default is empty. * @param uninterpretedOption * The parser stores options it doesn't recognize here. See above. */ @@ -94,6 +91,8 @@ final case class FileOptions( ccEnableArenas: scala.Option[Boolean] = None, objcClassPrefix: scala.Option[String] = None, csharpNamespace: scala.Option[String] = None, + swiftPrefix: scala.Option[String] = None, + phpClassPrefix: scala.Option[String] = None, uninterpretedOption: _root_.scala.collection.Seq[com.google.protobuf.descriptor.UninterpretedOption] = _root_.scala.collection.Seq.empty, unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet() ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[FileOptions] with com.trueaccord.lenses.Updatable[FileOptions] with _root_.com.trueaccord.scalapb.ExtendableMessage[FileOptions] { @@ -115,6 +114,8 @@ final case class FileOptions( if (ccEnableArenas.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(31, ccEnableArenas.get) } if (objcClassPrefix.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(36, objcClassPrefix.get) } if (csharpNamespace.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(37, csharpNamespace.get) } + if (swiftPrefix.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(39, swiftPrefix.get) } + if (phpClassPrefix.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(40, phpClassPrefix.get) } uninterpretedOption.foreach(uninterpretedOption => __size += 2 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(uninterpretedOption.serializedSize) + uninterpretedOption.serializedSize) __size += unknownFields.serializedSize __size @@ -170,6 +171,12 @@ final case class FileOptions( csharpNamespace.foreach { __v => _output__.writeString(37, __v) }; + swiftPrefix.foreach { __v => + _output__.writeString(39, __v) + }; + phpClassPrefix.foreach { __v => + _output__.writeString(40, __v) + }; uninterpretedOption.foreach { __v => _output__.writeTag(999, 2) _output__.writeUInt32NoTag(__v.serializedSize) @@ -192,6 +199,8 @@ final case class FileOptions( var __ccEnableArenas = this.ccEnableArenas var __objcClassPrefix = this.objcClassPrefix var __csharpNamespace = this.csharpNamespace + var __swiftPrefix = this.swiftPrefix + var __phpClassPrefix = this.phpClassPrefix val __uninterpretedOption = (_root_.scala.collection.immutable.Vector.newBuilder[com.google.protobuf.descriptor.UninterpretedOption] ++= this.uninterpretedOption) val _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder(this.unknownFields) var _done__ = false @@ -227,6 +236,10 @@ final case class FileOptions( __objcClassPrefix = Some(_input__.readString()) case 298 => __csharpNamespace = Some(_input__.readString()) + case 314 => + __swiftPrefix = Some(_input__.readString()) + case 322 => + __phpClassPrefix = Some(_input__.readString()) case 7994 => __uninterpretedOption += _root_.com.trueaccord.scalapb.LiteParser.readMessage(_input__, com.google.protobuf.descriptor.UninterpretedOption.defaultInstance) case tag => _unknownFields__.parseField(tag, _input__) @@ -247,6 +260,8 @@ final case class FileOptions( ccEnableArenas = __ccEnableArenas, objcClassPrefix = __objcClassPrefix, csharpNamespace = __csharpNamespace, + swiftPrefix = __swiftPrefix, + phpClassPrefix = __phpClassPrefix, uninterpretedOption = __uninterpretedOption.result(), unknownFields = _unknownFields__.result() ) @@ -293,6 +308,12 @@ final case class FileOptions( def getCsharpNamespace: String = csharpNamespace.getOrElse("") def clearCsharpNamespace: FileOptions = copy(csharpNamespace = None) def withCsharpNamespace(__v: String): FileOptions = copy(csharpNamespace = Some(__v)) + def getSwiftPrefix: String = swiftPrefix.getOrElse("") + def clearSwiftPrefix: FileOptions = copy(swiftPrefix = None) + def withSwiftPrefix(__v: String): FileOptions = copy(swiftPrefix = Some(__v)) + def getPhpClassPrefix: String = phpClassPrefix.getOrElse("") + def clearPhpClassPrefix: FileOptions = copy(phpClassPrefix = None) + def withPhpClassPrefix(__v: String): FileOptions = copy(phpClassPrefix = Some(__v)) def clearUninterpretedOption = copy(uninterpretedOption = _root_.scala.collection.Seq.empty) def addUninterpretedOption(__vs: com.google.protobuf.descriptor.UninterpretedOption*): FileOptions = addAllUninterpretedOption(__vs) def addAllUninterpretedOption(__vs: TraversableOnce[com.google.protobuf.descriptor.UninterpretedOption]): FileOptions = copy(uninterpretedOption = uninterpretedOption ++ __vs) @@ -314,6 +335,8 @@ final case class FileOptions( case 31 => ccEnableArenas.orNull case 36 => objcClassPrefix.orNull case 37 => csharpNamespace.orNull + case 39 => swiftPrefix.orNull + case 40 => phpClassPrefix.orNull case 999 => uninterpretedOption } } @@ -334,6 +357,8 @@ final case class FileOptions( case 31 => ccEnableArenas.map(_root_.scalapb.descriptors.PBoolean).getOrElse(_root_.scalapb.descriptors.PEmpty) case 36 => objcClassPrefix.map(_root_.scalapb.descriptors.PString).getOrElse(_root_.scalapb.descriptors.PEmpty) case 37 => csharpNamespace.map(_root_.scalapb.descriptors.PString).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 39 => swiftPrefix.map(_root_.scalapb.descriptors.PString).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 40 => phpClassPrefix.map(_root_.scalapb.descriptors.PString).getOrElse(_root_.scalapb.descriptors.PEmpty) case 999 => _root_.scalapb.descriptors.PRepeated(uninterpretedOption.map(_.toPMessage)(_root_.scala.collection.breakOut)) } } @@ -361,7 +386,9 @@ object FileOptions extends com.trueaccord.scalapb.GeneratedMessageCompanion[com. __fieldsMap.get(__fields.get(11)).asInstanceOf[scala.Option[Boolean]], __fieldsMap.get(__fields.get(12)).asInstanceOf[scala.Option[String]], __fieldsMap.get(__fields.get(13)).asInstanceOf[scala.Option[String]], - __fieldsMap.getOrElse(__fields.get(14), Nil).asInstanceOf[_root_.scala.collection.Seq[com.google.protobuf.descriptor.UninterpretedOption]] + __fieldsMap.get(__fields.get(14)).asInstanceOf[scala.Option[String]], + __fieldsMap.get(__fields.get(15)).asInstanceOf[scala.Option[String]], + __fieldsMap.getOrElse(__fields.get(16), Nil).asInstanceOf[_root_.scala.collection.Seq[com.google.protobuf.descriptor.UninterpretedOption]] ) } implicit def messageReads: _root_.scalapb.descriptors.Reads[com.google.protobuf.descriptor.FileOptions] = _root_.scalapb.descriptors.Reads{ @@ -382,6 +409,8 @@ object FileOptions extends com.trueaccord.scalapb.GeneratedMessageCompanion[com. __fieldsMap.get(scalaDescriptor.findFieldByNumber(31).get).flatMap(_.as[scala.Option[Boolean]]), __fieldsMap.get(scalaDescriptor.findFieldByNumber(36).get).flatMap(_.as[scala.Option[String]]), __fieldsMap.get(scalaDescriptor.findFieldByNumber(37).get).flatMap(_.as[scala.Option[String]]), + __fieldsMap.get(scalaDescriptor.findFieldByNumber(39).get).flatMap(_.as[scala.Option[String]]), + __fieldsMap.get(scalaDescriptor.findFieldByNumber(40).get).flatMap(_.as[scala.Option[String]]), __fieldsMap.get(scalaDescriptor.findFieldByNumber(999).get).map(_.as[_root_.scala.collection.Seq[com.google.protobuf.descriptor.UninterpretedOption]]).getOrElse(_root_.scala.collection.Seq.empty) ) case _ => throw new RuntimeException("Expected PMessage") @@ -478,6 +507,10 @@ object FileOptions extends com.trueaccord.scalapb.GeneratedMessageCompanion[com. def optionalObjcClassPrefix: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[String]] = field(_.objcClassPrefix)((c_, f_) => c_.copy(objcClassPrefix = f_)) def csharpNamespace: _root_.com.trueaccord.lenses.Lens[UpperPB, String] = field(_.getCsharpNamespace)((c_, f_) => c_.copy(csharpNamespace = Some(f_))) def optionalCsharpNamespace: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[String]] = field(_.csharpNamespace)((c_, f_) => c_.copy(csharpNamespace = f_)) + def swiftPrefix: _root_.com.trueaccord.lenses.Lens[UpperPB, String] = field(_.getSwiftPrefix)((c_, f_) => c_.copy(swiftPrefix = Some(f_))) + def optionalSwiftPrefix: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[String]] = field(_.swiftPrefix)((c_, f_) => c_.copy(swiftPrefix = f_)) + def phpClassPrefix: _root_.com.trueaccord.lenses.Lens[UpperPB, String] = field(_.getPhpClassPrefix)((c_, f_) => c_.copy(phpClassPrefix = Some(f_))) + def optionalPhpClassPrefix: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[String]] = field(_.phpClassPrefix)((c_, f_) => c_.copy(phpClassPrefix = f_)) def uninterpretedOption: _root_.com.trueaccord.lenses.Lens[UpperPB, _root_.scala.collection.Seq[com.google.protobuf.descriptor.UninterpretedOption]] = field(_.uninterpretedOption)((c_, f_) => c_.copy(uninterpretedOption = f_)) } final val JAVA_PACKAGE_FIELD_NUMBER = 1 @@ -494,5 +527,7 @@ object FileOptions extends com.trueaccord.scalapb.GeneratedMessageCompanion[com. final val CC_ENABLE_ARENAS_FIELD_NUMBER = 31 final val OBJC_CLASS_PREFIX_FIELD_NUMBER = 36 final val CSHARP_NAMESPACE_FIELD_NUMBER = 37 + final val SWIFT_PREFIX_FIELD_NUMBER = 39 + final val PHP_CLASS_PREFIX_FIELD_NUMBER = 40 final val UNINTERPRETED_OPTION_FIELD_NUMBER = 999 } diff --git a/scalapb-runtime/js/src/main/scala/com/google/protobuf/descriptor/MethodOptions.scala b/scalapb-runtime/js/src/main/scala/com/google/protobuf/descriptor/MethodOptions.scala index 50fb3910f..99903602d 100644 --- a/scalapb-runtime/js/src/main/scala/com/google/protobuf/descriptor/MethodOptions.scala +++ b/scalapb-runtime/js/src/main/scala/com/google/protobuf/descriptor/MethodOptions.scala @@ -18,6 +18,7 @@ package com.google.protobuf.descriptor @SerialVersionUID(0L) final case class MethodOptions( deprecated: scala.Option[Boolean] = None, + idempotencyLevel: scala.Option[com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel] = None, uninterpretedOption: _root_.scala.collection.Seq[com.google.protobuf.descriptor.UninterpretedOption] = _root_.scala.collection.Seq.empty, unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet() ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[MethodOptions] with com.trueaccord.lenses.Updatable[MethodOptions] with _root_.com.trueaccord.scalapb.ExtendableMessage[MethodOptions] { @@ -26,6 +27,7 @@ final case class MethodOptions( private[this] def __computeSerializedValue(): Int = { var __size = 0 if (deprecated.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(33, deprecated.get) } + if (idempotencyLevel.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeEnumSize(34, idempotencyLevel.get.value) } uninterpretedOption.foreach(uninterpretedOption => __size += 2 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(uninterpretedOption.serializedSize) + uninterpretedOption.serializedSize) __size += unknownFields.serializedSize __size @@ -42,6 +44,9 @@ final case class MethodOptions( deprecated.foreach { __v => _output__.writeBool(33, __v) }; + idempotencyLevel.foreach { __v => + _output__.writeEnum(34, __v.value) + }; uninterpretedOption.foreach { __v => _output__.writeTag(999, 2) _output__.writeUInt32NoTag(__v.serializedSize) @@ -51,6 +56,7 @@ final case class MethodOptions( } def mergeFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): com.google.protobuf.descriptor.MethodOptions = { var __deprecated = this.deprecated + var __idempotencyLevel = this.idempotencyLevel val __uninterpretedOption = (_root_.scala.collection.immutable.Vector.newBuilder[com.google.protobuf.descriptor.UninterpretedOption] ++= this.uninterpretedOption) val _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder(this.unknownFields) var _done__ = false @@ -60,6 +66,8 @@ final case class MethodOptions( case 0 => _done__ = true case 264 => __deprecated = Some(_input__.readBool()) + case 272 => + __idempotencyLevel = Some(com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel.fromValue(_input__.readEnum())) case 7994 => __uninterpretedOption += _root_.com.trueaccord.scalapb.LiteParser.readMessage(_input__, com.google.protobuf.descriptor.UninterpretedOption.defaultInstance) case tag => _unknownFields__.parseField(tag, _input__) @@ -67,6 +75,7 @@ final case class MethodOptions( } com.google.protobuf.descriptor.MethodOptions( deprecated = __deprecated, + idempotencyLevel = __idempotencyLevel, uninterpretedOption = __uninterpretedOption.result(), unknownFields = _unknownFields__.result() ) @@ -74,6 +83,9 @@ final case class MethodOptions( def getDeprecated: Boolean = deprecated.getOrElse(false) def clearDeprecated: MethodOptions = copy(deprecated = None) def withDeprecated(__v: Boolean): MethodOptions = copy(deprecated = Some(__v)) + def getIdempotencyLevel: com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel = idempotencyLevel.getOrElse(com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel.IDEMPOTENCY_UNKNOWN) + def clearIdempotencyLevel: MethodOptions = copy(idempotencyLevel = None) + def withIdempotencyLevel(__v: com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel): MethodOptions = copy(idempotencyLevel = Some(__v)) def clearUninterpretedOption = copy(uninterpretedOption = _root_.scala.collection.Seq.empty) def addUninterpretedOption(__vs: com.google.protobuf.descriptor.UninterpretedOption*): MethodOptions = addAllUninterpretedOption(__vs) def addAllUninterpretedOption(__vs: TraversableOnce[com.google.protobuf.descriptor.UninterpretedOption]): MethodOptions = copy(uninterpretedOption = uninterpretedOption ++ __vs) @@ -82,6 +94,7 @@ final case class MethodOptions( def getFieldByNumber(__fieldNumber: Int): scala.Any = { (__fieldNumber: @_root_.scala.unchecked) match { case 33 => deprecated.orNull + case 34 => idempotencyLevel.map(_.javaValueDescriptor).orNull case 999 => uninterpretedOption } } @@ -89,6 +102,7 @@ final case class MethodOptions( require(__field.containingMessage eq companion.scalaDescriptor) (__field.number: @_root_.scala.unchecked) match { case 33 => deprecated.map(_root_.scalapb.descriptors.PBoolean).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 34 => idempotencyLevel.map(__e => _root_.scalapb.descriptors.PEnum(__e.scalaValueDescriptor)).getOrElse(_root_.scalapb.descriptors.PEmpty) case 999 => _root_.scalapb.descriptors.PRepeated(uninterpretedOption.map(_.toPMessage)(_root_.scala.collection.breakOut)) } } @@ -103,7 +117,8 @@ object MethodOptions extends com.trueaccord.scalapb.GeneratedMessageCompanion[co val __fields = javaDescriptor.getFields com.google.protobuf.descriptor.MethodOptions( __fieldsMap.get(__fields.get(0)).asInstanceOf[scala.Option[Boolean]], - __fieldsMap.getOrElse(__fields.get(1), Nil).asInstanceOf[_root_.scala.collection.Seq[com.google.protobuf.descriptor.UninterpretedOption]] + __fieldsMap.get(__fields.get(1)).asInstanceOf[scala.Option[_root_.com.google.protobuf.Descriptors.EnumValueDescriptor]].map(__e => com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel.fromValue(__e.getNumber)), + __fieldsMap.getOrElse(__fields.get(2), Nil).asInstanceOf[_root_.scala.collection.Seq[com.google.protobuf.descriptor.UninterpretedOption]] ) } implicit def messageReads: _root_.scalapb.descriptors.Reads[com.google.protobuf.descriptor.MethodOptions] = _root_.scalapb.descriptors.Reads{ @@ -111,6 +126,7 @@ object MethodOptions extends com.trueaccord.scalapb.GeneratedMessageCompanion[co require(__fieldsMap.keys.forall(_.containingMessage == scalaDescriptor), "FieldDescriptor does not match message type.") com.google.protobuf.descriptor.MethodOptions( __fieldsMap.get(scalaDescriptor.findFieldByNumber(33).get).flatMap(_.as[scala.Option[Boolean]]), + __fieldsMap.get(scalaDescriptor.findFieldByNumber(34).get).flatMap(_.as[scala.Option[_root_.scalapb.descriptors.EnumValueDescriptor]]).map(__e => com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel.fromValue(__e.number)), __fieldsMap.get(scalaDescriptor.findFieldByNumber(999).get).map(_.as[_root_.scala.collection.Seq[com.google.protobuf.descriptor.UninterpretedOption]]).getOrElse(_root_.scala.collection.Seq.empty) ) case _ => throw new RuntimeException("Expected PMessage") @@ -124,14 +140,68 @@ object MethodOptions extends com.trueaccord.scalapb.GeneratedMessageCompanion[co } __out } - def enumCompanionForFieldNumber(__fieldNumber: Int): _root_.com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + def enumCompanionForFieldNumber(__fieldNumber: Int): _root_.com.trueaccord.scalapb.GeneratedEnumCompanion[_] = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 34 => com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel + } + } lazy val defaultInstance = com.google.protobuf.descriptor.MethodOptions( ) + sealed trait IdempotencyLevel extends _root_.com.trueaccord.scalapb.GeneratedEnum { + type EnumType = IdempotencyLevel + def isIdempotencyUnknown: Boolean = false + def isNoSideEffects: Boolean = false + def isIdempotent: Boolean = false + def companion: _root_.com.trueaccord.scalapb.GeneratedEnumCompanion[IdempotencyLevel] = com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel + } + + object IdempotencyLevel extends _root_.com.trueaccord.scalapb.GeneratedEnumCompanion[IdempotencyLevel] { + implicit def enumCompanion: _root_.com.trueaccord.scalapb.GeneratedEnumCompanion[IdempotencyLevel] = this + @SerialVersionUID(0L) + case object IDEMPOTENCY_UNKNOWN extends IdempotencyLevel { + val value = 0 + val index = 0 + val name = "IDEMPOTENCY_UNKNOWN" + override def isIdempotencyUnknown: Boolean = true + } + + @SerialVersionUID(0L) + case object NO_SIDE_EFFECTS extends IdempotencyLevel { + val value = 1 + val index = 1 + val name = "NO_SIDE_EFFECTS" + override def isNoSideEffects: Boolean = true + } + + @SerialVersionUID(0L) + case object IDEMPOTENT extends IdempotencyLevel { + val value = 2 + val index = 2 + val name = "IDEMPOTENT" + override def isIdempotent: Boolean = true + } + + @SerialVersionUID(0L) + case class Unrecognized(value: Int) extends IdempotencyLevel with _root_.com.trueaccord.scalapb.UnrecognizedEnum + + lazy val values = scala.collection.Seq(IDEMPOTENCY_UNKNOWN, NO_SIDE_EFFECTS, IDEMPOTENT) + def fromValue(value: Int): IdempotencyLevel = value match { + case 0 => IDEMPOTENCY_UNKNOWN + case 1 => NO_SIDE_EFFECTS + case 2 => IDEMPOTENT + case __other => Unrecognized(__other) + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.EnumDescriptor = com.google.protobuf.descriptor.MethodOptions.javaDescriptor.getEnumTypes.get(0) + def scalaDescriptor: _root_.scalapb.descriptors.EnumDescriptor = com.google.protobuf.descriptor.MethodOptions.scalaDescriptor.enums(0) + } implicit class MethodOptionsLens[UpperPB](_l: _root_.com.trueaccord.lenses.Lens[UpperPB, com.google.protobuf.descriptor.MethodOptions]) extends _root_.com.trueaccord.lenses.ObjectLens[UpperPB, com.google.protobuf.descriptor.MethodOptions](_l) { def deprecated: _root_.com.trueaccord.lenses.Lens[UpperPB, Boolean] = field(_.getDeprecated)((c_, f_) => c_.copy(deprecated = Some(f_))) def optionalDeprecated: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[Boolean]] = field(_.deprecated)((c_, f_) => c_.copy(deprecated = f_)) + def idempotencyLevel: _root_.com.trueaccord.lenses.Lens[UpperPB, com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel] = field(_.getIdempotencyLevel)((c_, f_) => c_.copy(idempotencyLevel = Some(f_))) + def optionalIdempotencyLevel: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel]] = field(_.idempotencyLevel)((c_, f_) => c_.copy(idempotencyLevel = f_)) def uninterpretedOption: _root_.com.trueaccord.lenses.Lens[UpperPB, _root_.scala.collection.Seq[com.google.protobuf.descriptor.UninterpretedOption]] = field(_.uninterpretedOption)((c_, f_) => c_.copy(uninterpretedOption = f_)) } final val DEPRECATED_FIELD_NUMBER = 33 + final val IDEMPOTENCY_LEVEL_FIELD_NUMBER = 34 final val UNINTERPRETED_OPTION_FIELD_NUMBER = 999 } diff --git a/scalapb-runtime/js/src/main/scala/com/google/protobuf/duration/Duration.scala b/scalapb-runtime/js/src/main/scala/com/google/protobuf/duration/Duration.scala index 3691aaf1e..3cc30d4f4 100644 --- a/scalapb-runtime/js/src/main/scala/com/google/protobuf/duration/Duration.scala +++ b/scalapb-runtime/js/src/main/scala/com/google/protobuf/duration/Duration.scala @@ -14,6 +14,8 @@ package com.google.protobuf.duration * two Timestamp values is a Duration and it can be added or subtracted * from a Timestamp. Range is approximately +-10,000 years. * + * # Examples + * * Example 1: Compute Duration from two Timestamps in pseudo code. * * Timestamp start = ...; @@ -48,9 +50,26 @@ package com.google.protobuf.duration * end.nanos -= 1000000000; * } * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + * * @param seconds * Signed seconds of the span of time. Must be from -315,576,000,000 - * to +315,576,000,000 inclusive. + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years * @param nanos * Signed fractions of a second at nanosecond resolution of the span * of time. Durations less than one second are represented with a 0 diff --git a/scalapb-runtime/js/src/main/scala/com/google/protobuf/duration/DurationProto.scala b/scalapb-runtime/js/src/main/scala/com/google/protobuf/duration/DurationProto.scala index c8afd1726..c96b2ae44 100644 --- a/scalapb-runtime/js/src/main/scala/com/google/protobuf/duration/DurationProto.scala +++ b/scalapb-runtime/js/src/main/scala/com/google/protobuf/duration/DurationProto.scala @@ -12,7 +12,7 @@ object DurationProto { com.trueaccord.scalapb.Encoding.fromBase64(scala.collection.Seq( """Ch5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8SD2dvb2dsZS5wcm90b2J1ZiI6CghEdXJhdGlvbhIYCgdzZWNvbmRzG AEgASgDUgdzZWNvbmRzEhQKBW5hbm9zGAIgASgFUgVuYW5vc0J8ChNjb20uZ29vZ2xlLnByb3RvYnVmQg1EdXJhdGlvblByb3RvU - AFaKmdpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy9kdXJhdGlvbqABAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZ + AFaKmdpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy9kdXJhdGlvbvgBAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZ WxsS25vd25UeXBlc2IGcHJvdG8z""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { diff --git a/scalapb-runtime/js/src/main/scala/com/google/protobuf/empty/EmptyProto.scala b/scalapb-runtime/js/src/main/scala/com/google/protobuf/empty/EmptyProto.scala index 274f7588a..45334748d 100644 --- a/scalapb-runtime/js/src/main/scala/com/google/protobuf/empty/EmptyProto.scala +++ b/scalapb-runtime/js/src/main/scala/com/google/protobuf/empty/EmptyProto.scala @@ -10,9 +10,9 @@ package com.google.protobuf.empty object EmptyProto { private lazy val ProtoBytes: Array[Byte] = com.trueaccord.scalapb.Encoding.fromBase64(scala.collection.Seq( - """Chtnb29nbGUvcHJvdG9idWYvZW1wdHkucHJvdG8SD2dvb2dsZS5wcm90b2J1ZiIHCgVFbXB0eUJ5ChNjb20uZ29vZ2xlLnByb - 3RvYnVmQgpFbXB0eVByb3RvUAFaJ2dpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy9lbXB0eaABAfgBAaICA0dQQqoCH - kdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z""" + """Chtnb29nbGUvcHJvdG9idWYvZW1wdHkucHJvdG8SD2dvb2dsZS5wcm90b2J1ZiIHCgVFbXB0eUJ2ChNjb20uZ29vZ2xlLnByb + 3RvYnVmQgpFbXB0eVByb3RvUAFaJ2dpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy9lbXB0efgBAaICA0dQQqoCHkdvb + 2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) diff --git a/scalapb-runtime/js/src/main/scala/com/google/protobuf/field_mask/FieldMask.scala b/scalapb-runtime/js/src/main/scala/com/google/protobuf/field_mask/FieldMask.scala index 9745c198a..1377afde7 100644 --- a/scalapb-runtime/js/src/main/scala/com/google/protobuf/field_mask/FieldMask.scala +++ b/scalapb-runtime/js/src/main/scala/com/google/protobuf/field_mask/FieldMask.scala @@ -50,7 +50,7 @@ package com.google.protobuf.field_mask * } * * A repeated field is not allowed except at the last position of a - * field mask. + * paths string. * * If a FieldMask object is not present in a get operation, the * operation applies to all fields (as if a FieldMask of all fields @@ -77,8 +77,8 @@ package com.google.protobuf.field_mask * * If a repeated field is specified for an update operation, the existing * repeated values in the target resource will be overwritten by the new values. - * Note that a repeated field is only allowed in the last position of a field - * mask. + * Note that a repeated field is only allowed in the last position of a `paths` + * string. * * If a sub-message is specified in the last position of the field mask for an * update operation, then the existing sub-message in the target resource is diff --git a/scalapb-runtime/js/src/main/scala/com/google/protobuf/field_mask/FieldMaskProto.scala b/scalapb-runtime/js/src/main/scala/com/google/protobuf/field_mask/FieldMaskProto.scala index eace81aa5..db4abbdd3 100644 --- a/scalapb-runtime/js/src/main/scala/com/google/protobuf/field_mask/FieldMaskProto.scala +++ b/scalapb-runtime/js/src/main/scala/com/google/protobuf/field_mask/FieldMaskProto.scala @@ -11,8 +11,9 @@ object FieldMaskProto { private lazy val ProtoBytes: Array[Byte] = com.trueaccord.scalapb.Encoding.fromBase64(scala.collection.Seq( """CiBnb29nbGUvcHJvdG9idWYvZmllbGRfbWFzay5wcm90bxIPZ29vZ2xlLnByb3RvYnVmIiEKCUZpZWxkTWFzaxIUCgVwYXRoc - xgBIAMoCVIFcGF0aHNCUQoTY29tLmdvb2dsZS5wcm90b2J1ZkIORmllbGRNYXNrUHJvdG9QAaABAaICA0dQQqoCHkdvb2dsZS5Qc - m90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z""" + xgBIAMoCVIFcGF0aHNCiQEKE2NvbS5nb29nbGUucHJvdG9idWZCDkZpZWxkTWFza1Byb3RvUAFaOWdvb2dsZS5nb2xhbmcub3JnL + 2dlbnByb3RvL3Byb3RvYnVmL2ZpZWxkX21hc2s7ZmllbGRfbWFza6ICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25Ue + XBlc2IGcHJvdG8z""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) diff --git a/scalapb-runtime/js/src/main/scala/com/google/protobuf/source_context/SourceContextProto.scala b/scalapb-runtime/js/src/main/scala/com/google/protobuf/source_context/SourceContextProto.scala index 88e5c842a..cf017f263 100644 --- a/scalapb-runtime/js/src/main/scala/com/google/protobuf/source_context/SourceContextProto.scala +++ b/scalapb-runtime/js/src/main/scala/com/google/protobuf/source_context/SourceContextProto.scala @@ -11,8 +11,9 @@ object SourceContextProto { private lazy val ProtoBytes: Array[Byte] = com.trueaccord.scalapb.Encoding.fromBase64(scala.collection.Seq( """CiRnb29nbGUvcHJvdG9idWYvc291cmNlX2NvbnRleHQucHJvdG8SD2dvb2dsZS5wcm90b2J1ZiIsCg1Tb3VyY2VDb250ZXh0E - hsKCWZpbGVfbmFtZRgBIAEoCVIIZmlsZU5hbWVCVQoTY29tLmdvb2dsZS5wcm90b2J1ZkISU291cmNlQ29udGV4dFByb3RvUAGgA - QGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw==""" + hsKCWZpbGVfbmFtZRgBIAEoCVIIZmlsZU5hbWVClQEKE2NvbS5nb29nbGUucHJvdG9idWZCElNvdXJjZUNvbnRleHRQcm90b1ABW + kFnb29nbGUuZ29sYW5nLm9yZy9nZW5wcm90by9wcm90b2J1Zi9zb3VyY2VfY29udGV4dDtzb3VyY2VfY29udGV4dKICA0dQQqoCH + kdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) diff --git a/scalapb-runtime/js/src/main/scala/com/google/protobuf/struct/StructProto.scala b/scalapb-runtime/js/src/main/scala/com/google/protobuf/struct/StructProto.scala index 4b4d7fa16..4c28efc33 100644 --- a/scalapb-runtime/js/src/main/scala/com/google/protobuf/struct/StructProto.scala +++ b/scalapb-runtime/js/src/main/scala/com/google/protobuf/struct/StructProto.scala @@ -19,7 +19,7 @@ object StructProto { XN0X3ZhbHVlGAYgASgLMhouZ29vZ2xlLnByb3RvYnVmLkxpc3RWYWx1ZUgAUglsaXN0VmFsdWVCBgoEa2luZCI7CglMaXN0VmFsd WUSLgoGdmFsdWVzGAEgAygLMhYuZ29vZ2xlLnByb3RvYnVmLlZhbHVlUgZ2YWx1ZXMqGwoJTnVsbFZhbHVlEg4KCk5VTExfVkFMV UUQAEKBAQoTY29tLmdvb2dsZS5wcm90b2J1ZkILU3RydWN0UHJvdG9QAVoxZ2l0aHViLmNvbS9nb2xhbmcvcHJvdG9idWYvcHR5c - GVzL3N0cnVjdDtzdHJ1Y3RwYqABAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z""" + GVzL3N0cnVjdDtzdHJ1Y3RwYvgBAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) diff --git a/scalapb-runtime/js/src/main/scala/com/google/protobuf/timestamp/Timestamp.scala b/scalapb-runtime/js/src/main/scala/com/google/protobuf/timestamp/Timestamp.scala index c3adc54da..828647dfe 100644 --- a/scalapb-runtime/js/src/main/scala/com/google/protobuf/timestamp/Timestamp.scala +++ b/scalapb-runtime/js/src/main/scala/com/google/protobuf/timestamp/Timestamp.scala @@ -19,6 +19,8 @@ package com.google.protobuf.timestamp * and from RFC 3339 date strings. * See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). * + * # Examples + * * Example 1: Compute Timestamp from POSIX `time()`. * * Timestamp timestamp; @@ -56,14 +58,35 @@ package com.google.protobuf.timestamp * * Example 5: Compute Timestamp from current time in Python. * - * now = time.time() - * seconds = int(now) - * nanos = int((now - seconds) * 10**9) - * timestamp = Timestamp(seconds=seconds, nanos=nanos) + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required, though only UTC (as indicated by "Z") is presently supported. + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString] + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) + * with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one + * can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( + * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()) + * to obtain a formatter capable of generating timestamps in this format. * * @param seconds * Represents seconds of UTC time since Unix epoch - * 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to * 9999-12-31T23:59:59Z inclusive. * @param nanos * Non-negative fractions of a second at nanosecond resolution. Negative diff --git a/scalapb-runtime/js/src/main/scala/com/google/protobuf/timestamp/TimestampProto.scala b/scalapb-runtime/js/src/main/scala/com/google/protobuf/timestamp/TimestampProto.scala index 131af027f..76166a18c 100644 --- a/scalapb-runtime/js/src/main/scala/com/google/protobuf/timestamp/TimestampProto.scala +++ b/scalapb-runtime/js/src/main/scala/com/google/protobuf/timestamp/TimestampProto.scala @@ -11,9 +11,9 @@ object TimestampProto { private lazy val ProtoBytes: Array[Byte] = com.trueaccord.scalapb.Encoding.fromBase64(scala.collection.Seq( """Ch9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1wLnByb3RvEg9nb29nbGUucHJvdG9idWYiOwoJVGltZXN0YW1wEhgKB3NlY29uZ - HMYASABKANSB3NlY29uZHMSFAoFbmFub3MYAiABKAVSBW5hbm9zQoEBChNjb20uZ29vZ2xlLnByb3RvYnVmQg5UaW1lc3RhbXBQc - m90b1ABWitnaXRodWIuY29tL2dvbGFuZy9wcm90b2J1Zi9wdHlwZXMvdGltZXN0YW1woAEB+AEBogIDR1BCqgIeR29vZ2xlLlByb - 3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM=""" + HMYASABKANSB3NlY29uZHMSFAoFbmFub3MYAiABKAVSBW5hbm9zQn4KE2NvbS5nb29nbGUucHJvdG9idWZCDlRpbWVzdGFtcFByb + 3RvUAFaK2dpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy90aW1lc3RhbXD4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9id + WYuV2VsbEtub3duVHlwZXNiBnByb3RvMw==""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) diff --git a/scalapb-runtime/js/src/main/scala/com/google/protobuf/type/OptionProto.scala b/scalapb-runtime/js/src/main/scala/com/google/protobuf/type/OptionProto.scala index c8ecc54c9..0c4f60391 100644 --- a/scalapb-runtime/js/src/main/scala/com/google/protobuf/type/OptionProto.scala +++ b/scalapb-runtime/js/src/main/scala/com/google/protobuf/type/OptionProto.scala @@ -11,9 +11,15 @@ package com.google.protobuf.`type` * enumeration, etc. * * @param name - * The option's name. For example, `"java_package"`. + * The option's name. For protobuf built-in options (options defined in + * descriptor.proto), this is the short name. For example, `"map_entry"`. + * For custom options, it should be the fully-qualified name. For example, + * `"google.api.http"`. * @param value - * The option's value. For example, `"com.google.protobuf"`. + * The option's value packed in an Any message. If the value is a primitive, + * the corresponding wrapper type defined in google/protobuf/wrappers.proto + * should be used. If the value is an enum, it should be stored as an int32 + * value using the google.protobuf.Int32Value type. */ @SerialVersionUID(0L) final case class OptionProto( diff --git a/scalapb-runtime/js/src/main/scala/com/google/protobuf/type/TypeProto.scala b/scalapb-runtime/js/src/main/scala/com/google/protobuf/type/TypeProto.scala index 37806c5f7..81d70c6c2 100644 --- a/scalapb-runtime/js/src/main/scala/com/google/protobuf/type/TypeProto.scala +++ b/scalapb-runtime/js/src/main/scala/com/google/protobuf/type/TypeProto.scala @@ -32,8 +32,9 @@ object TypeProto { XgYBSABKA4yFy5nb29nbGUucHJvdG9idWYuU3ludGF4UgZzeW50YXgiagoJRW51bVZhbHVlEhIKBG5hbWUYASABKAlSBG5hbWUSF goGbnVtYmVyGAIgASgFUgZudW1iZXISMQoHb3B0aW9ucxgDIAMoCzIXLmdvb2dsZS5wcm90b2J1Zi5PcHRpb25SB29wdGlvbnMiS AoGT3B0aW9uEhIKBG5hbWUYASABKAlSBG5hbWUSKgoFdmFsdWUYAiABKAsyFC5nb29nbGUucHJvdG9idWYuQW55UgV2YWx1ZSouC - gZTeW50YXgSEQoNU1lOVEFYX1BST1RPMhAAEhEKDVNZTlRBWF9QUk9UTzMQAUJMChNjb20uZ29vZ2xlLnByb3RvYnVmQglUeXBlU - HJvdG9QAaABAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z""" + gZTeW50YXgSEQoNU1lOVEFYX1BST1RPMhAAEhEKDVNZTlRBWF9QUk9UTzMQAUJ9ChNjb20uZ29vZ2xlLnByb3RvYnVmQglUeXBlU + HJvdG9QAVovZ29vZ2xlLmdvbGFuZy5vcmcvZ2VucHJvdG8vcHJvdG9idWYvcHR5cGU7cHR5cGX4AQGiAgNHUEKqAh5Hb29nbGUuU + HJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw==""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) diff --git a/scalapb-runtime/js/src/main/scala/com/google/protobuf/wrappers/WrappersProto.scala b/scalapb-runtime/js/src/main/scala/com/google/protobuf/wrappers/WrappersProto.scala index 56b6cbfb6..1482a56c0 100644 --- a/scalapb-runtime/js/src/main/scala/com/google/protobuf/wrappers/WrappersProto.scala +++ b/scalapb-runtime/js/src/main/scala/com/google/protobuf/wrappers/WrappersProto.scala @@ -15,8 +15,8 @@ object WrappersProto { AEoA1IFdmFsdWUiIwoLVUludDY0VmFsdWUSFAoFdmFsdWUYASABKARSBXZhbHVlIiIKCkludDMyVmFsdWUSFAoFdmFsdWUYASABK AVSBXZhbHVlIiMKC1VJbnQzMlZhbHVlEhQKBXZhbHVlGAEgASgNUgV2YWx1ZSIhCglCb29sVmFsdWUSFAoFdmFsdWUYASABKAhSB XZhbHVlIiMKC1N0cmluZ1ZhbHVlEhQKBXZhbHVlGAEgASgJUgV2YWx1ZSIiCgpCeXRlc1ZhbHVlEhQKBXZhbHVlGAEgASgMUgV2Y - Wx1ZUJ/ChNjb20uZ29vZ2xlLnByb3RvYnVmQg1XcmFwcGVyc1Byb3RvUAFaKmdpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0e - XBlcy93cmFwcGVyc6ABAfgBAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z""" + Wx1ZUJ8ChNjb20uZ29vZ2xlLnByb3RvYnVmQg1XcmFwcGVyc1Byb3RvUAFaKmdpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0e + XBlcy93cmFwcGVyc/gBAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) diff --git a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/any/AnyProto.scala b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/any/AnyProto.scala index b98bfaf04..80b8c5c98 100644 --- a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/any/AnyProto.scala +++ b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/any/AnyProto.scala @@ -11,9 +11,8 @@ object AnyProto { private lazy val ProtoBytes: Array[Byte] = com.trueaccord.scalapb.Encoding.fromBase64(scala.collection.Seq( """Chlnb29nbGUvcHJvdG9idWYvYW55LnByb3RvEg9nb29nbGUucHJvdG9idWYiNgoDQW55EhkKCHR5cGVfdXJsGAEgASgJUgd0e - XBlVXJsEhQKBXZhbHVlGAIgASgMUgV2YWx1ZUJyChNjb20uZ29vZ2xlLnByb3RvYnVmQghBbnlQcm90b1ABWiVnaXRodWIuY29tL - 2dvbGFuZy9wcm90b2J1Zi9wdHlwZXMvYW55oAEBogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90b - zM=""" + XBlVXJsEhQKBXZhbHVlGAIgASgMUgV2YWx1ZUJvChNjb20uZ29vZ2xlLnByb3RvYnVmQghBbnlQcm90b1ABWiVnaXRodWIuY29tL + 2dvbGFuZy9wcm90b2J1Zi9wdHlwZXMvYW55ogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM=""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) diff --git a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/api/ApiProto.scala b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/api/ApiProto.scala index 05abd7537..2eeb772e2 100644 --- a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/api/ApiProto.scala +++ b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/api/ApiProto.scala @@ -20,8 +20,9 @@ object ApiProto { WFtaW5nGAMgASgIUhByZXF1ZXN0U3RyZWFtaW5nEioKEXJlc3BvbnNlX3R5cGVfdXJsGAQgASgJUg9yZXNwb25zZVR5cGVVcmwSL QoScmVzcG9uc2Vfc3RyZWFtaW5nGAUgASgIUhFyZXNwb25zZVN0cmVhbWluZxIxCgdvcHRpb25zGAYgAygLMhcuZ29vZ2xlLnByb 3RvYnVmLk9wdGlvblIHb3B0aW9ucxIvCgZzeW50YXgYByABKA4yFy5nb29nbGUucHJvdG9idWYuU3ludGF4UgZzeW50YXgiLwoFT - Wl4aW4SEgoEbmFtZRgBIAEoCVIEbmFtZRISCgRyb290GAIgASgJUgRyb290QksKE2NvbS5nb29nbGUucHJvdG9idWZCCEFwaVByb - 3RvUAGgAQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw==""" + Wl4aW4SEgoEbmFtZRgBIAEoCVIEbmFtZRISCgRyb290GAIgASgJUgRyb290QnUKE2NvbS5nb29nbGUucHJvdG9idWZCCEFwaVByb + 3RvUAFaK2dvb2dsZS5nb2xhbmcub3JnL2dlbnByb3RvL3Byb3RvYnVmL2FwaTthcGmiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV + 2VsbEtub3duVHlwZXNiBnByb3RvMw==""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) diff --git a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/compiler/plugin/CodeGeneratorRequest.scala b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/compiler/plugin/CodeGeneratorRequest.scala index b59ce4beb..cf374fa75 100644 --- a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/compiler/plugin/CodeGeneratorRequest.scala +++ b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/compiler/plugin/CodeGeneratorRequest.scala @@ -27,12 +27,18 @@ import scala.collection.JavaConverters._ * the entire set into memory at once. However, as of this writing, this * is not similarly optimized on protoc's end -- it will store all fields in * memory at once before sending them to the plugin. + * + * Type names of fields and extensions in the FileDescriptorProto are always + * fully qualified. + * @param compilerVersion + * The version number of protocol compiler. */ @SerialVersionUID(0L) final case class CodeGeneratorRequest( fileToGenerate: _root_.scala.collection.Seq[String] = _root_.scala.collection.Seq.empty, parameter: scala.Option[String] = None, - protoFile: _root_.scala.collection.Seq[com.google.protobuf.descriptor.FileDescriptorProto] = _root_.scala.collection.Seq.empty + protoFile: _root_.scala.collection.Seq[com.google.protobuf.descriptor.FileDescriptorProto] = _root_.scala.collection.Seq.empty, + compilerVersion: scala.Option[com.google.protobuf.compiler.plugin.Version] = None ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[CodeGeneratorRequest] with com.trueaccord.lenses.Updatable[CodeGeneratorRequest] { @transient private[this] var __serializedSizeCachedValue: Int = 0 @@ -41,6 +47,7 @@ final case class CodeGeneratorRequest( fileToGenerate.foreach(fileToGenerate => __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, fileToGenerate)) if (parameter.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, parameter.get) } protoFile.foreach(protoFile => __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(protoFile.serializedSize) + protoFile.serializedSize) + if (compilerVersion.isDefined) { __size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(compilerVersion.get.serializedSize) + compilerVersion.get.serializedSize } __size } final override def serializedSize: Int = { @@ -58,6 +65,11 @@ final case class CodeGeneratorRequest( parameter.foreach { __v => _output__.writeString(2, __v) }; + compilerVersion.foreach { __v => + _output__.writeTag(3, 2) + _output__.writeUInt32NoTag(__v.serializedSize) + __v.writeTo(_output__) + }; protoFile.foreach { __v => _output__.writeTag(15, 2) _output__.writeUInt32NoTag(__v.serializedSize) @@ -68,6 +80,7 @@ final case class CodeGeneratorRequest( val __fileToGenerate = (_root_.scala.collection.immutable.Vector.newBuilder[String] ++= this.fileToGenerate) var __parameter = this.parameter val __protoFile = (_root_.scala.collection.immutable.Vector.newBuilder[com.google.protobuf.descriptor.FileDescriptorProto] ++= this.protoFile) + var __compilerVersion = this.compilerVersion var _done__ = false while (!_done__) { val _tag__ = _input__.readTag() @@ -79,13 +92,16 @@ final case class CodeGeneratorRequest( __parameter = Some(_input__.readString()) case 122 => __protoFile += _root_.com.trueaccord.scalapb.LiteParser.readMessage(_input__, com.google.protobuf.descriptor.FileDescriptorProto.defaultInstance) + case 26 => + __compilerVersion = Some(_root_.com.trueaccord.scalapb.LiteParser.readMessage(_input__, __compilerVersion.getOrElse(com.google.protobuf.compiler.plugin.Version.defaultInstance))) case tag => _input__.skipField(tag) } } com.google.protobuf.compiler.plugin.CodeGeneratorRequest( fileToGenerate = __fileToGenerate.result(), parameter = __parameter, - protoFile = __protoFile.result() + protoFile = __protoFile.result(), + compilerVersion = __compilerVersion ) } def clearFileToGenerate = copy(fileToGenerate = _root_.scala.collection.Seq.empty) @@ -99,11 +115,15 @@ final case class CodeGeneratorRequest( def addProtoFile(__vs: com.google.protobuf.descriptor.FileDescriptorProto*): CodeGeneratorRequest = addAllProtoFile(__vs) def addAllProtoFile(__vs: TraversableOnce[com.google.protobuf.descriptor.FileDescriptorProto]): CodeGeneratorRequest = copy(protoFile = protoFile ++ __vs) def withProtoFile(__v: _root_.scala.collection.Seq[com.google.protobuf.descriptor.FileDescriptorProto]): CodeGeneratorRequest = copy(protoFile = __v) + def getCompilerVersion: com.google.protobuf.compiler.plugin.Version = compilerVersion.getOrElse(com.google.protobuf.compiler.plugin.Version.defaultInstance) + def clearCompilerVersion: CodeGeneratorRequest = copy(compilerVersion = None) + def withCompilerVersion(__v: com.google.protobuf.compiler.plugin.Version): CodeGeneratorRequest = copy(compilerVersion = Some(__v)) def getFieldByNumber(__fieldNumber: Int): scala.Any = { (__fieldNumber: @_root_.scala.unchecked) match { case 1 => fileToGenerate case 2 => parameter.orNull case 15 => protoFile + case 3 => compilerVersion.orNull } } def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { @@ -112,6 +132,7 @@ final case class CodeGeneratorRequest( case 1 => _root_.scalapb.descriptors.PRepeated(fileToGenerate.map(_root_.scalapb.descriptors.PString)(_root_.scala.collection.breakOut)) case 2 => parameter.map(_root_.scalapb.descriptors.PString).getOrElse(_root_.scalapb.descriptors.PEmpty) case 15 => _root_.scalapb.descriptors.PRepeated(protoFile.map(_.toPMessage)(_root_.scala.collection.breakOut)) + case 3 => compilerVersion.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty) } } override def toString: String = _root_.com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) @@ -125,12 +146,14 @@ object CodeGeneratorRequest extends com.trueaccord.scalapb.GeneratedMessageCompa javaPbOut.addAllFileToGenerate(scalaPbSource.fileToGenerate.asJava) scalaPbSource.parameter.foreach(javaPbOut.setParameter) javaPbOut.addAllProtoFile(scalaPbSource.protoFile.map(com.google.protobuf.descriptor.FileDescriptorProto.toJavaProto)(_root_.scala.collection.breakOut).asJava) + scalaPbSource.compilerVersion.map(com.google.protobuf.compiler.plugin.Version.toJavaProto).foreach(javaPbOut.setCompilerVersion) javaPbOut.build } def fromJavaProto(javaPbSource: com.google.protobuf.compiler.PluginProtos.CodeGeneratorRequest): com.google.protobuf.compiler.plugin.CodeGeneratorRequest = com.google.protobuf.compiler.plugin.CodeGeneratorRequest( fileToGenerate = javaPbSource.getFileToGenerateList.asScala.map(_root_.scala.Predef.identity)(_root_.scala.collection.breakOut), parameter = if (javaPbSource.hasParameter) Some(javaPbSource.getParameter) else None, - protoFile = javaPbSource.getProtoFileList.asScala.map(com.google.protobuf.descriptor.FileDescriptorProto.fromJavaProto)(_root_.scala.collection.breakOut) + protoFile = javaPbSource.getProtoFileList.asScala.map(com.google.protobuf.descriptor.FileDescriptorProto.fromJavaProto)(_root_.scala.collection.breakOut), + compilerVersion = if (javaPbSource.hasCompilerVersion) Some(com.google.protobuf.compiler.plugin.Version.fromJavaProto(javaPbSource.getCompilerVersion)) else None ) def fromFieldsMap(__fieldsMap: scala.collection.immutable.Map[_root_.com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.google.protobuf.compiler.plugin.CodeGeneratorRequest = { require(__fieldsMap.keys.forall(_.getContainingType() == javaDescriptor), "FieldDescriptor does not match message type.") @@ -138,7 +161,8 @@ object CodeGeneratorRequest extends com.trueaccord.scalapb.GeneratedMessageCompa com.google.protobuf.compiler.plugin.CodeGeneratorRequest( __fieldsMap.getOrElse(__fields.get(0), Nil).asInstanceOf[_root_.scala.collection.Seq[String]], __fieldsMap.get(__fields.get(1)).asInstanceOf[scala.Option[String]], - __fieldsMap.getOrElse(__fields.get(2), Nil).asInstanceOf[_root_.scala.collection.Seq[com.google.protobuf.descriptor.FileDescriptorProto]] + __fieldsMap.getOrElse(__fields.get(2), Nil).asInstanceOf[_root_.scala.collection.Seq[com.google.protobuf.descriptor.FileDescriptorProto]], + __fieldsMap.get(__fields.get(3)).asInstanceOf[scala.Option[com.google.protobuf.compiler.plugin.Version]] ) } implicit def messageReads: _root_.scalapb.descriptors.Reads[com.google.protobuf.compiler.plugin.CodeGeneratorRequest] = _root_.scalapb.descriptors.Reads{ @@ -147,16 +171,18 @@ object CodeGeneratorRequest extends com.trueaccord.scalapb.GeneratedMessageCompa com.google.protobuf.compiler.plugin.CodeGeneratorRequest( __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.collection.Seq[String]]).getOrElse(_root_.scala.collection.Seq.empty), __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[scala.Option[String]]), - __fieldsMap.get(scalaDescriptor.findFieldByNumber(15).get).map(_.as[_root_.scala.collection.Seq[com.google.protobuf.descriptor.FileDescriptorProto]]).getOrElse(_root_.scala.collection.Seq.empty) + __fieldsMap.get(scalaDescriptor.findFieldByNumber(15).get).map(_.as[_root_.scala.collection.Seq[com.google.protobuf.descriptor.FileDescriptorProto]]).getOrElse(_root_.scala.collection.Seq.empty), + __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[scala.Option[com.google.protobuf.compiler.plugin.Version]]) ) case _ => throw new RuntimeException("Expected PMessage") } - def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = PluginProto.javaDescriptor.getMessageTypes.get(0) - def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = PluginProto.scalaDescriptor.messages(0) + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = PluginProto.javaDescriptor.getMessageTypes.get(1) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = PluginProto.scalaDescriptor.messages(1) def messageCompanionForFieldNumber(__fieldNumber: Int): _root_.com.trueaccord.scalapb.GeneratedMessageCompanion[_] = { var __out: _root_.com.trueaccord.scalapb.GeneratedMessageCompanion[_] = null (__fieldNumber: @_root_.scala.unchecked) match { case 15 => __out = com.google.protobuf.descriptor.FileDescriptorProto + case 3 => __out = com.google.protobuf.compiler.plugin.Version } __out } @@ -168,8 +194,11 @@ object CodeGeneratorRequest extends com.trueaccord.scalapb.GeneratedMessageCompa def parameter: _root_.com.trueaccord.lenses.Lens[UpperPB, String] = field(_.getParameter)((c_, f_) => c_.copy(parameter = Some(f_))) def optionalParameter: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[String]] = field(_.parameter)((c_, f_) => c_.copy(parameter = f_)) def protoFile: _root_.com.trueaccord.lenses.Lens[UpperPB, _root_.scala.collection.Seq[com.google.protobuf.descriptor.FileDescriptorProto]] = field(_.protoFile)((c_, f_) => c_.copy(protoFile = f_)) + def compilerVersion: _root_.com.trueaccord.lenses.Lens[UpperPB, com.google.protobuf.compiler.plugin.Version] = field(_.getCompilerVersion)((c_, f_) => c_.copy(compilerVersion = Some(f_))) + def optionalCompilerVersion: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[com.google.protobuf.compiler.plugin.Version]] = field(_.compilerVersion)((c_, f_) => c_.copy(compilerVersion = f_)) } final val FILE_TO_GENERATE_FIELD_NUMBER = 1 final val PARAMETER_FIELD_NUMBER = 2 final val PROTO_FILE_FIELD_NUMBER = 15 + final val COMPILER_VERSION_FIELD_NUMBER = 3 } diff --git a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/compiler/plugin/CodeGeneratorResponse.scala b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/compiler/plugin/CodeGeneratorResponse.scala index dfccf4930..6484a3fef 100644 --- a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/compiler/plugin/CodeGeneratorResponse.scala +++ b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/compiler/plugin/CodeGeneratorResponse.scala @@ -123,8 +123,8 @@ object CodeGeneratorResponse extends com.trueaccord.scalapb.GeneratedMessageComp ) case _ => throw new RuntimeException("Expected PMessage") } - def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = PluginProto.javaDescriptor.getMessageTypes.get(1) - def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = PluginProto.scalaDescriptor.messages(1) + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = PluginProto.javaDescriptor.getMessageTypes.get(2) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = PluginProto.scalaDescriptor.messages(2) def messageCompanionForFieldNumber(__fieldNumber: Int): _root_.com.trueaccord.scalapb.GeneratedMessageCompanion[_] = { var __out: _root_.com.trueaccord.scalapb.GeneratedMessageCompanion[_] = null (__fieldNumber: @_root_.scala.unchecked) match { diff --git a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/compiler/plugin/PluginProto.scala b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/compiler/plugin/PluginProto.scala index 3be94b242..6756b57e4 100644 --- a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/compiler/plugin/PluginProto.scala +++ b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/compiler/plugin/PluginProto.scala @@ -11,13 +11,16 @@ object PluginProto { private lazy val ProtoBytes: Array[Byte] = com.trueaccord.scalapb.Encoding.fromBase64(scala.collection.Seq( """CiVnb29nbGUvcHJvdG9idWYvY29tcGlsZXIvcGx1Z2luLnByb3RvEhhnb29nbGUucHJvdG9idWYuY29tcGlsZXIaIGdvb2dsZ - S9wcm90b2J1Zi9kZXNjcmlwd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XIuVmVyc2lvblIPY29tcGlsZXJWZXJzaW9uItYBC + hVDb2RlR2VuZXJhdG9yUmVzcG9uc2USFAoFZXJyb3IYASABKAlSBWVycm9yEkgKBGZpbGUYDyADKAsyNC5nb29nbGUucHJvdG9id + WYuY29tcGlsZXIuQ29kZUdlbmVyYXRvclJlc3BvbnNlLkZpbGVSBGZpbGUaXQoERmlsZRISCgRuYW1lGAEgASgJUgRuYW1lEicKD + 2luc2VydGlvbl9wb2ludBgCIAEoCVIOaW5zZXJ0aW9uUG9pbnQSGAoHY29udGVudBgPIAEoCVIHY29udGVudEJnChxjb20uZ29vZ + 2xlLnByb3RvYnVmLmNvbXBpbGVyQgxQbHVnaW5Qcm90b3NaOWdpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3Byb3RvYy1nZW4tZ + 28vcGx1Z2luO3BsdWdpbl9nbw==""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) diff --git a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/compiler/plugin/Version.scala b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/compiler/plugin/Version.scala new file mode 100644 index 000000000..72c287a30 --- /dev/null +++ b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/compiler/plugin/Version.scala @@ -0,0 +1,173 @@ +// Generated by the Scala Plugin for the Protocol Buffer Compiler. +// Do not edit! +// +// Protofile syntax: PROTO2 + +package com.google.protobuf.compiler.plugin + +import scala.collection.JavaConverters._ + +/** The version number of protocol compiler. + * + * @param suffix + * A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should + * be empty for mainline stable releases. + */ +@SerialVersionUID(0L) +final case class Version( + major: scala.Option[Int] = None, + minor: scala.Option[Int] = None, + patch: scala.Option[Int] = None, + suffix: scala.Option[String] = None + ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[Version] with com.trueaccord.lenses.Updatable[Version] { + @transient + private[this] var __serializedSizeCachedValue: Int = 0 + private[this] def __computeSerializedValue(): Int = { + var __size = 0 + if (major.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(1, major.get) } + if (minor.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(2, minor.get) } + if (patch.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeInt32Size(3, patch.get) } + if (suffix.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(4, suffix.get) } + __size + } + final override def serializedSize: Int = { + var read = __serializedSizeCachedValue + if (read == 0) { + read = __computeSerializedValue() + __serializedSizeCachedValue = read + } + read + } + def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): Unit = { + major.foreach { __v => + _output__.writeInt32(1, __v) + }; + minor.foreach { __v => + _output__.writeInt32(2, __v) + }; + patch.foreach { __v => + _output__.writeInt32(3, __v) + }; + suffix.foreach { __v => + _output__.writeString(4, __v) + }; + } + def mergeFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): com.google.protobuf.compiler.plugin.Version = { + var __major = this.major + var __minor = this.minor + var __patch = this.patch + var __suffix = this.suffix + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 8 => + __major = Some(_input__.readInt32()) + case 16 => + __minor = Some(_input__.readInt32()) + case 24 => + __patch = Some(_input__.readInt32()) + case 34 => + __suffix = Some(_input__.readString()) + case tag => _input__.skipField(tag) + } + } + com.google.protobuf.compiler.plugin.Version( + major = __major, + minor = __minor, + patch = __patch, + suffix = __suffix + ) + } + def getMajor: Int = major.getOrElse(0) + def clearMajor: Version = copy(major = None) + def withMajor(__v: Int): Version = copy(major = Some(__v)) + def getMinor: Int = minor.getOrElse(0) + def clearMinor: Version = copy(minor = None) + def withMinor(__v: Int): Version = copy(minor = Some(__v)) + def getPatch: Int = patch.getOrElse(0) + def clearPatch: Version = copy(patch = None) + def withPatch(__v: Int): Version = copy(patch = Some(__v)) + def getSuffix: String = suffix.getOrElse("") + def clearSuffix: Version = copy(suffix = None) + def withSuffix(__v: String): Version = copy(suffix = Some(__v)) + def getFieldByNumber(__fieldNumber: Int): scala.Any = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 1 => major.orNull + case 2 => minor.orNull + case 3 => patch.orNull + case 4 => suffix.orNull + } + } + def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = { + require(__field.containingMessage eq companion.scalaDescriptor) + (__field.number: @_root_.scala.unchecked) match { + case 1 => major.map(_root_.scalapb.descriptors.PInt).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 2 => minor.map(_root_.scalapb.descriptors.PInt).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 3 => patch.map(_root_.scalapb.descriptors.PInt).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 4 => suffix.map(_root_.scalapb.descriptors.PString).getOrElse(_root_.scalapb.descriptors.PEmpty) + } + } + override def toString: String = _root_.com.trueaccord.scalapb.TextFormat.printToUnicodeString(this) + def companion = com.google.protobuf.compiler.plugin.Version +} + +object Version extends com.trueaccord.scalapb.GeneratedMessageCompanion[com.google.protobuf.compiler.plugin.Version] with com.trueaccord.scalapb.JavaProtoSupport[com.google.protobuf.compiler.plugin.Version, com.google.protobuf.compiler.PluginProtos.Version] { + implicit def messageCompanion: com.trueaccord.scalapb.GeneratedMessageCompanion[com.google.protobuf.compiler.plugin.Version] with com.trueaccord.scalapb.JavaProtoSupport[com.google.protobuf.compiler.plugin.Version, com.google.protobuf.compiler.PluginProtos.Version] = this + def toJavaProto(scalaPbSource: com.google.protobuf.compiler.plugin.Version): com.google.protobuf.compiler.PluginProtos.Version = { + val javaPbOut = com.google.protobuf.compiler.PluginProtos.Version.newBuilder + scalaPbSource.major.foreach(javaPbOut.setMajor) + scalaPbSource.minor.foreach(javaPbOut.setMinor) + scalaPbSource.patch.foreach(javaPbOut.setPatch) + scalaPbSource.suffix.foreach(javaPbOut.setSuffix) + javaPbOut.build + } + def fromJavaProto(javaPbSource: com.google.protobuf.compiler.PluginProtos.Version): com.google.protobuf.compiler.plugin.Version = com.google.protobuf.compiler.plugin.Version( + major = if (javaPbSource.hasMajor) Some(javaPbSource.getMajor.intValue) else None, + minor = if (javaPbSource.hasMinor) Some(javaPbSource.getMinor.intValue) else None, + patch = if (javaPbSource.hasPatch) Some(javaPbSource.getPatch.intValue) else None, + suffix = if (javaPbSource.hasSuffix) Some(javaPbSource.getSuffix) else None + ) + def fromFieldsMap(__fieldsMap: scala.collection.immutable.Map[_root_.com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.google.protobuf.compiler.plugin.Version = { + require(__fieldsMap.keys.forall(_.getContainingType() == javaDescriptor), "FieldDescriptor does not match message type.") + val __fields = javaDescriptor.getFields + com.google.protobuf.compiler.plugin.Version( + __fieldsMap.get(__fields.get(0)).asInstanceOf[scala.Option[Int]], + __fieldsMap.get(__fields.get(1)).asInstanceOf[scala.Option[Int]], + __fieldsMap.get(__fields.get(2)).asInstanceOf[scala.Option[Int]], + __fieldsMap.get(__fields.get(3)).asInstanceOf[scala.Option[String]] + ) + } + implicit def messageReads: _root_.scalapb.descriptors.Reads[com.google.protobuf.compiler.plugin.Version] = _root_.scalapb.descriptors.Reads{ + case _root_.scalapb.descriptors.PMessage(__fieldsMap) => + require(__fieldsMap.keys.forall(_.containingMessage == scalaDescriptor), "FieldDescriptor does not match message type.") + com.google.protobuf.compiler.plugin.Version( + __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).flatMap(_.as[scala.Option[Int]]), + __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).flatMap(_.as[scala.Option[Int]]), + __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).flatMap(_.as[scala.Option[Int]]), + __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).flatMap(_.as[scala.Option[String]]) + ) + case _ => throw new RuntimeException("Expected PMessage") + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = PluginProto.javaDescriptor.getMessageTypes.get(0) + def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = PluginProto.scalaDescriptor.messages(0) + def messageCompanionForFieldNumber(__fieldNumber: Int): _root_.com.trueaccord.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__fieldNumber) + def enumCompanionForFieldNumber(__fieldNumber: Int): _root_.com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + lazy val defaultInstance = com.google.protobuf.compiler.plugin.Version( + ) + implicit class VersionLens[UpperPB](_l: _root_.com.trueaccord.lenses.Lens[UpperPB, com.google.protobuf.compiler.plugin.Version]) extends _root_.com.trueaccord.lenses.ObjectLens[UpperPB, com.google.protobuf.compiler.plugin.Version](_l) { + def major: _root_.com.trueaccord.lenses.Lens[UpperPB, Int] = field(_.getMajor)((c_, f_) => c_.copy(major = Some(f_))) + def optionalMajor: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[Int]] = field(_.major)((c_, f_) => c_.copy(major = f_)) + def minor: _root_.com.trueaccord.lenses.Lens[UpperPB, Int] = field(_.getMinor)((c_, f_) => c_.copy(minor = Some(f_))) + def optionalMinor: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[Int]] = field(_.minor)((c_, f_) => c_.copy(minor = f_)) + def patch: _root_.com.trueaccord.lenses.Lens[UpperPB, Int] = field(_.getPatch)((c_, f_) => c_.copy(patch = Some(f_))) + def optionalPatch: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[Int]] = field(_.patch)((c_, f_) => c_.copy(patch = f_)) + def suffix: _root_.com.trueaccord.lenses.Lens[UpperPB, String] = field(_.getSuffix)((c_, f_) => c_.copy(suffix = Some(f_))) + def optionalSuffix: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[String]] = field(_.suffix)((c_, f_) => c_.copy(suffix = f_)) + } + final val MAJOR_FIELD_NUMBER = 1 + final val MINOR_FIELD_NUMBER = 2 + final val PATCH_FIELD_NUMBER = 3 + final val SUFFIX_FIELD_NUMBER = 4 +} diff --git a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/descriptor/DescriptorProtoCompanion.scala b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/descriptor/DescriptorProtoCompanion.scala index ea650132f..6ef441130 100644 --- a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/descriptor/DescriptorProtoCompanion.scala +++ b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/descriptor/DescriptorProtoCompanion.scala @@ -51,54 +51,59 @@ object DescriptorProtoCompanion { i5TZXJ2aWNlT3B0aW9uc1IHb3B0aW9ucyKJAgoVTWV0aG9kRGVzY3JpcHRvclByb3RvEhIKBG5hbWUYASABKAlSBG5hbWUSHQoKa W5wdXRfdHlwZRgCIAEoCVIJaW5wdXRUeXBlEh8KC291dHB1dF90eXBlGAMgASgJUgpvdXRwdXRUeXBlEjgKB29wdGlvbnMYBCABK AsyHi5nb29nbGUucHJvdG9idWYuTWV0aG9kT3B0aW9uc1IHb3B0aW9ucxIwChBjbGllbnRfc3RyZWFtaW5nGAUgASgIOgVmYWxzZ - VIPY2xpZW50U3RyZWFtaW5nEjAKEHNlcnZlcl9zdHJlYW1pbmcYBiABKAg6BWZhbHNlUg9zZXJ2ZXJTdHJlYW1pbmcikQcKC0Zpb + VIPY2xpZW50U3RyZWFtaW5nEjAKEHNlcnZlcl9zdHJlYW1pbmcYBiABKAg6BWZhbHNlUg9zZXJ2ZXJTdHJlYW1pbmci2wcKC0Zpb GVPcHRpb25zEiEKDGphdmFfcGFja2FnZRgBIAEoCVILamF2YVBhY2thZ2USMAoUamF2YV9vdXRlcl9jbGFzc25hbWUYCCABKAlSE mphdmFPdXRlckNsYXNzbmFtZRI1ChNqYXZhX211bHRpcGxlX2ZpbGVzGAogASgIOgVmYWxzZVIRamF2YU11bHRpcGxlRmlsZXMSR - wodamF2YV9nZW5lcmF0ZV9lcXVhbHNfYW5kX2hhc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Q29kZUluZ + m8SRAoIbG9jYXRpb24YASADKAsyKC5nb29nbGUucHJvdG9idWYuU291cmNlQ29kZUluZm8uTG9jYXRpb25SCGxvY2F0aW9uGs4BC + ghMb2NhdGlvbhIWCgRwYXRoGAEgAygFQgIQAVIEcGF0aBIWCgRzcGFuGAIgAygFQgIQAVIEc3BhbhIpChBsZWFkaW5nX2NvbW1lb + nRzGAMgASgJUg9sZWFkaW5nQ29tbWVudHMSKwoRdHJhaWxpbmdfY29tbWVudHMYBCABKAlSEHRyYWlsaW5nQ29tbWVudHMSOgoZb + GVhZGluZ19kZXRhY2hlZF9jb21tZW50cxgGIAMoCVIXbGVhZGluZ0RldGFjaGVkQ29tbWVudHMi0QEKEUdlbmVyYXRlZENvZGVJb + mZvEk0KCmFubm90YXRpb24YASADKAsyLS5nb29nbGUucHJvdG9idWYuR2VuZXJhdGVkQ29kZUluZm8uQW5ub3RhdGlvblIKYW5ub + 3RhdGlvbhptCgpBbm5vdGF0aW9uEhYKBHBhdGgYASADKAVCAhABUgRwYXRoEh8KC3NvdXJjZV9maWxlGAIgASgJUgpzb3VyY2VGa + WxlEhQKBWJlZ2luGAMgASgFUgViZWdpbhIQCgNlbmQYBCABKAVSA2VuZEKMAQoTY29tLmdvb2dsZS5wcm90b2J1ZkIQRGVzY3Jpc + HRvclByb3Rvc0gBWj5naXRodWIuY29tL2dvbGFuZy9wcm90b2J1Zi9wcm90b2MtZ2VuLWdvL2Rlc2NyaXB0b3I7ZGVzY3JpcHRvc + qICA0dQQqoCGkdvb2dsZS5Qcm90b2J1Zi5SZWZsZWN0aW9u""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) diff --git a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/descriptor/FieldOptions.scala b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/descriptor/FieldOptions.scala index abdea3b8d..9af45ddb6 100644 --- a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/descriptor/FieldOptions.scala +++ b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/descriptor/FieldOptions.scala @@ -48,7 +48,7 @@ import scala.collection.JavaConverters._ * * * Note that implementations may choose not to check required fields within - * a lazy sub-message. That is, calling IsInitialized() on the outher message + * a lazy sub-message. That is, calling IsInitialized() on the outer message * may return true even if the inner message has missing required fields. * This is necessary because otherwise the inner message would have to be * parsed in order to perform the check, defeating the purpose of lazy diff --git a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/descriptor/FileOptions.scala b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/descriptor/FileOptions.scala index 93fa70fe1..499632560 100644 --- a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/descriptor/FileOptions.scala +++ b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/descriptor/FileOptions.scala @@ -26,18 +26,7 @@ import scala.collection.JavaConverters._ * generated to contain the file's getDescriptor() method as well as any * top-level extensions defined in the file. * @param javaGenerateEqualsAndHash - * If set true, then the Java code generator will generate equals() and - * hashCode() methods for all messages defined in the .proto file. - * This increases generated code size, potentially substantially for large - * protos, which may harm a memory-constrained application. - * - In the full runtime this is a speed optimization, as the - * AbstractMessage base class includes reflection-based implementations of - * these methods. - * - In the lite runtime, setting this option changes the semantics of - * equals() and hashCode() to more closely match those of the full runtime; - * the generated methods compute their results based on field values rather - * than object identity. (Implementations should not assume that hashcodes - * will be consistent across runtimes or versions of the protocol compiler.) + * This option does nothing. * @param javaStringCheckUtf8 * If set true, then the Java2 code generator will generate code that * throws an exception whenever an attempt is made to assign a non-UTF-8 @@ -75,6 +64,14 @@ import scala.collection.JavaConverters._ * generated classes from this .proto. There is no default. * @param csharpNamespace * Namespace for generated classes; defaults to the package. + * @param swiftPrefix + * By default Swift generators will take the proto package and CamelCase it + * replacing '.' with underscore and use that to prefix the types/symbols + * defined. When this options is provided, they will use this value instead + * to prefix the types/symbols defined. + * @param phpClassPrefix + * Sets the php class prefix which is prepended to all php generated classes + * from this .proto. Default is empty. * @param uninterpretedOption * The parser stores options it doesn't recognize here. See above. */ @@ -94,6 +91,8 @@ final case class FileOptions( ccEnableArenas: scala.Option[Boolean] = None, objcClassPrefix: scala.Option[String] = None, csharpNamespace: scala.Option[String] = None, + swiftPrefix: scala.Option[String] = None, + phpClassPrefix: scala.Option[String] = None, uninterpretedOption: _root_.scala.collection.Seq[com.google.protobuf.descriptor.UninterpretedOption] = _root_.scala.collection.Seq.empty, unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet() ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[FileOptions] with com.trueaccord.lenses.Updatable[FileOptions] with _root_.com.trueaccord.scalapb.ExtendableMessage[FileOptions] { @@ -115,6 +114,8 @@ final case class FileOptions( if (ccEnableArenas.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(31, ccEnableArenas.get) } if (objcClassPrefix.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(36, objcClassPrefix.get) } if (csharpNamespace.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(37, csharpNamespace.get) } + if (swiftPrefix.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(39, swiftPrefix.get) } + if (phpClassPrefix.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(40, phpClassPrefix.get) } uninterpretedOption.foreach(uninterpretedOption => __size += 2 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(uninterpretedOption.serializedSize) + uninterpretedOption.serializedSize) __size += unknownFields.serializedSize __size @@ -170,6 +171,12 @@ final case class FileOptions( csharpNamespace.foreach { __v => _output__.writeString(37, __v) }; + swiftPrefix.foreach { __v => + _output__.writeString(39, __v) + }; + phpClassPrefix.foreach { __v => + _output__.writeString(40, __v) + }; uninterpretedOption.foreach { __v => _output__.writeTag(999, 2) _output__.writeUInt32NoTag(__v.serializedSize) @@ -192,6 +199,8 @@ final case class FileOptions( var __ccEnableArenas = this.ccEnableArenas var __objcClassPrefix = this.objcClassPrefix var __csharpNamespace = this.csharpNamespace + var __swiftPrefix = this.swiftPrefix + var __phpClassPrefix = this.phpClassPrefix val __uninterpretedOption = (_root_.scala.collection.immutable.Vector.newBuilder[com.google.protobuf.descriptor.UninterpretedOption] ++= this.uninterpretedOption) val _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder(this.unknownFields) var _done__ = false @@ -227,6 +236,10 @@ final case class FileOptions( __objcClassPrefix = Some(_input__.readString()) case 298 => __csharpNamespace = Some(_input__.readString()) + case 314 => + __swiftPrefix = Some(_input__.readString()) + case 322 => + __phpClassPrefix = Some(_input__.readString()) case 7994 => __uninterpretedOption += _root_.com.trueaccord.scalapb.LiteParser.readMessage(_input__, com.google.protobuf.descriptor.UninterpretedOption.defaultInstance) case tag => _unknownFields__.parseField(tag, _input__) @@ -247,6 +260,8 @@ final case class FileOptions( ccEnableArenas = __ccEnableArenas, objcClassPrefix = __objcClassPrefix, csharpNamespace = __csharpNamespace, + swiftPrefix = __swiftPrefix, + phpClassPrefix = __phpClassPrefix, uninterpretedOption = __uninterpretedOption.result(), unknownFields = _unknownFields__.result() ) @@ -293,6 +308,12 @@ final case class FileOptions( def getCsharpNamespace: String = csharpNamespace.getOrElse("") def clearCsharpNamespace: FileOptions = copy(csharpNamespace = None) def withCsharpNamespace(__v: String): FileOptions = copy(csharpNamespace = Some(__v)) + def getSwiftPrefix: String = swiftPrefix.getOrElse("") + def clearSwiftPrefix: FileOptions = copy(swiftPrefix = None) + def withSwiftPrefix(__v: String): FileOptions = copy(swiftPrefix = Some(__v)) + def getPhpClassPrefix: String = phpClassPrefix.getOrElse("") + def clearPhpClassPrefix: FileOptions = copy(phpClassPrefix = None) + def withPhpClassPrefix(__v: String): FileOptions = copy(phpClassPrefix = Some(__v)) def clearUninterpretedOption = copy(uninterpretedOption = _root_.scala.collection.Seq.empty) def addUninterpretedOption(__vs: com.google.protobuf.descriptor.UninterpretedOption*): FileOptions = addAllUninterpretedOption(__vs) def addAllUninterpretedOption(__vs: TraversableOnce[com.google.protobuf.descriptor.UninterpretedOption]): FileOptions = copy(uninterpretedOption = uninterpretedOption ++ __vs) @@ -314,6 +335,8 @@ final case class FileOptions( case 31 => ccEnableArenas.orNull case 36 => objcClassPrefix.orNull case 37 => csharpNamespace.orNull + case 39 => swiftPrefix.orNull + case 40 => phpClassPrefix.orNull case 999 => uninterpretedOption } } @@ -334,6 +357,8 @@ final case class FileOptions( case 31 => ccEnableArenas.map(_root_.scalapb.descriptors.PBoolean).getOrElse(_root_.scalapb.descriptors.PEmpty) case 36 => objcClassPrefix.map(_root_.scalapb.descriptors.PString).getOrElse(_root_.scalapb.descriptors.PEmpty) case 37 => csharpNamespace.map(_root_.scalapb.descriptors.PString).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 39 => swiftPrefix.map(_root_.scalapb.descriptors.PString).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 40 => phpClassPrefix.map(_root_.scalapb.descriptors.PString).getOrElse(_root_.scalapb.descriptors.PEmpty) case 999 => _root_.scalapb.descriptors.PRepeated(uninterpretedOption.map(_.toPMessage)(_root_.scala.collection.breakOut)) } } @@ -359,6 +384,8 @@ object FileOptions extends com.trueaccord.scalapb.GeneratedMessageCompanion[com. scalaPbSource.ccEnableArenas.foreach(javaPbOut.setCcEnableArenas) scalaPbSource.objcClassPrefix.foreach(javaPbOut.setObjcClassPrefix) scalaPbSource.csharpNamespace.foreach(javaPbOut.setCsharpNamespace) + scalaPbSource.swiftPrefix.foreach(javaPbOut.setSwiftPrefix) + scalaPbSource.phpClassPrefix.foreach(javaPbOut.setPhpClassPrefix) javaPbOut.addAllUninterpretedOption(scalaPbSource.uninterpretedOption.map(com.google.protobuf.descriptor.UninterpretedOption.toJavaProto)(_root_.scala.collection.breakOut).asJava) javaPbOut.build } @@ -377,6 +404,8 @@ object FileOptions extends com.trueaccord.scalapb.GeneratedMessageCompanion[com. ccEnableArenas = if (javaPbSource.hasCcEnableArenas) Some(javaPbSource.getCcEnableArenas.booleanValue) else None, objcClassPrefix = if (javaPbSource.hasObjcClassPrefix) Some(javaPbSource.getObjcClassPrefix) else None, csharpNamespace = if (javaPbSource.hasCsharpNamespace) Some(javaPbSource.getCsharpNamespace) else None, + swiftPrefix = if (javaPbSource.hasSwiftPrefix) Some(javaPbSource.getSwiftPrefix) else None, + phpClassPrefix = if (javaPbSource.hasPhpClassPrefix) Some(javaPbSource.getPhpClassPrefix) else None, uninterpretedOption = javaPbSource.getUninterpretedOptionList.asScala.map(com.google.protobuf.descriptor.UninterpretedOption.fromJavaProto)(_root_.scala.collection.breakOut) ) def fromFieldsMap(__fieldsMap: scala.collection.immutable.Map[_root_.com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.google.protobuf.descriptor.FileOptions = { @@ -397,7 +426,9 @@ object FileOptions extends com.trueaccord.scalapb.GeneratedMessageCompanion[com. __fieldsMap.get(__fields.get(11)).asInstanceOf[scala.Option[Boolean]], __fieldsMap.get(__fields.get(12)).asInstanceOf[scala.Option[String]], __fieldsMap.get(__fields.get(13)).asInstanceOf[scala.Option[String]], - __fieldsMap.getOrElse(__fields.get(14), Nil).asInstanceOf[_root_.scala.collection.Seq[com.google.protobuf.descriptor.UninterpretedOption]] + __fieldsMap.get(__fields.get(14)).asInstanceOf[scala.Option[String]], + __fieldsMap.get(__fields.get(15)).asInstanceOf[scala.Option[String]], + __fieldsMap.getOrElse(__fields.get(16), Nil).asInstanceOf[_root_.scala.collection.Seq[com.google.protobuf.descriptor.UninterpretedOption]] ) } implicit def messageReads: _root_.scalapb.descriptors.Reads[com.google.protobuf.descriptor.FileOptions] = _root_.scalapb.descriptors.Reads{ @@ -418,6 +449,8 @@ object FileOptions extends com.trueaccord.scalapb.GeneratedMessageCompanion[com. __fieldsMap.get(scalaDescriptor.findFieldByNumber(31).get).flatMap(_.as[scala.Option[Boolean]]), __fieldsMap.get(scalaDescriptor.findFieldByNumber(36).get).flatMap(_.as[scala.Option[String]]), __fieldsMap.get(scalaDescriptor.findFieldByNumber(37).get).flatMap(_.as[scala.Option[String]]), + __fieldsMap.get(scalaDescriptor.findFieldByNumber(39).get).flatMap(_.as[scala.Option[String]]), + __fieldsMap.get(scalaDescriptor.findFieldByNumber(40).get).flatMap(_.as[scala.Option[String]]), __fieldsMap.get(scalaDescriptor.findFieldByNumber(999).get).map(_.as[_root_.scala.collection.Seq[com.google.protobuf.descriptor.UninterpretedOption]]).getOrElse(_root_.scala.collection.Seq.empty) ) case _ => throw new RuntimeException("Expected PMessage") @@ -516,6 +549,10 @@ object FileOptions extends com.trueaccord.scalapb.GeneratedMessageCompanion[com. def optionalObjcClassPrefix: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[String]] = field(_.objcClassPrefix)((c_, f_) => c_.copy(objcClassPrefix = f_)) def csharpNamespace: _root_.com.trueaccord.lenses.Lens[UpperPB, String] = field(_.getCsharpNamespace)((c_, f_) => c_.copy(csharpNamespace = Some(f_))) def optionalCsharpNamespace: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[String]] = field(_.csharpNamespace)((c_, f_) => c_.copy(csharpNamespace = f_)) + def swiftPrefix: _root_.com.trueaccord.lenses.Lens[UpperPB, String] = field(_.getSwiftPrefix)((c_, f_) => c_.copy(swiftPrefix = Some(f_))) + def optionalSwiftPrefix: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[String]] = field(_.swiftPrefix)((c_, f_) => c_.copy(swiftPrefix = f_)) + def phpClassPrefix: _root_.com.trueaccord.lenses.Lens[UpperPB, String] = field(_.getPhpClassPrefix)((c_, f_) => c_.copy(phpClassPrefix = Some(f_))) + def optionalPhpClassPrefix: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[String]] = field(_.phpClassPrefix)((c_, f_) => c_.copy(phpClassPrefix = f_)) def uninterpretedOption: _root_.com.trueaccord.lenses.Lens[UpperPB, _root_.scala.collection.Seq[com.google.protobuf.descriptor.UninterpretedOption]] = field(_.uninterpretedOption)((c_, f_) => c_.copy(uninterpretedOption = f_)) } final val JAVA_PACKAGE_FIELD_NUMBER = 1 @@ -532,5 +569,7 @@ object FileOptions extends com.trueaccord.scalapb.GeneratedMessageCompanion[com. final val CC_ENABLE_ARENAS_FIELD_NUMBER = 31 final val OBJC_CLASS_PREFIX_FIELD_NUMBER = 36 final val CSHARP_NAMESPACE_FIELD_NUMBER = 37 + final val SWIFT_PREFIX_FIELD_NUMBER = 39 + final val PHP_CLASS_PREFIX_FIELD_NUMBER = 40 final val UNINTERPRETED_OPTION_FIELD_NUMBER = 999 } diff --git a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/descriptor/MethodOptions.scala b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/descriptor/MethodOptions.scala index 4b508a62f..20257d579 100644 --- a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/descriptor/MethodOptions.scala +++ b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/descriptor/MethodOptions.scala @@ -18,6 +18,7 @@ import scala.collection.JavaConverters._ @SerialVersionUID(0L) final case class MethodOptions( deprecated: scala.Option[Boolean] = None, + idempotencyLevel: scala.Option[com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel] = None, uninterpretedOption: _root_.scala.collection.Seq[com.google.protobuf.descriptor.UninterpretedOption] = _root_.scala.collection.Seq.empty, unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet() ) extends com.trueaccord.scalapb.GeneratedMessage with com.trueaccord.scalapb.Message[MethodOptions] with com.trueaccord.lenses.Updatable[MethodOptions] with _root_.com.trueaccord.scalapb.ExtendableMessage[MethodOptions] { @@ -26,6 +27,7 @@ final case class MethodOptions( private[this] def __computeSerializedValue(): Int = { var __size = 0 if (deprecated.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(33, deprecated.get) } + if (idempotencyLevel.isDefined) { __size += _root_.com.google.protobuf.CodedOutputStream.computeEnumSize(34, idempotencyLevel.get.value) } uninterpretedOption.foreach(uninterpretedOption => __size += 2 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(uninterpretedOption.serializedSize) + uninterpretedOption.serializedSize) __size += unknownFields.serializedSize __size @@ -42,6 +44,9 @@ final case class MethodOptions( deprecated.foreach { __v => _output__.writeBool(33, __v) }; + idempotencyLevel.foreach { __v => + _output__.writeEnum(34, __v.value) + }; uninterpretedOption.foreach { __v => _output__.writeTag(999, 2) _output__.writeUInt32NoTag(__v.serializedSize) @@ -51,6 +56,7 @@ final case class MethodOptions( } def mergeFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): com.google.protobuf.descriptor.MethodOptions = { var __deprecated = this.deprecated + var __idempotencyLevel = this.idempotencyLevel val __uninterpretedOption = (_root_.scala.collection.immutable.Vector.newBuilder[com.google.protobuf.descriptor.UninterpretedOption] ++= this.uninterpretedOption) val _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder(this.unknownFields) var _done__ = false @@ -60,6 +66,8 @@ final case class MethodOptions( case 0 => _done__ = true case 264 => __deprecated = Some(_input__.readBool()) + case 272 => + __idempotencyLevel = Some(com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel.fromValue(_input__.readEnum())) case 7994 => __uninterpretedOption += _root_.com.trueaccord.scalapb.LiteParser.readMessage(_input__, com.google.protobuf.descriptor.UninterpretedOption.defaultInstance) case tag => _unknownFields__.parseField(tag, _input__) @@ -67,6 +75,7 @@ final case class MethodOptions( } com.google.protobuf.descriptor.MethodOptions( deprecated = __deprecated, + idempotencyLevel = __idempotencyLevel, uninterpretedOption = __uninterpretedOption.result(), unknownFields = _unknownFields__.result() ) @@ -74,6 +83,9 @@ final case class MethodOptions( def getDeprecated: Boolean = deprecated.getOrElse(false) def clearDeprecated: MethodOptions = copy(deprecated = None) def withDeprecated(__v: Boolean): MethodOptions = copy(deprecated = Some(__v)) + def getIdempotencyLevel: com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel = idempotencyLevel.getOrElse(com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel.IDEMPOTENCY_UNKNOWN) + def clearIdempotencyLevel: MethodOptions = copy(idempotencyLevel = None) + def withIdempotencyLevel(__v: com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel): MethodOptions = copy(idempotencyLevel = Some(__v)) def clearUninterpretedOption = copy(uninterpretedOption = _root_.scala.collection.Seq.empty) def addUninterpretedOption(__vs: com.google.protobuf.descriptor.UninterpretedOption*): MethodOptions = addAllUninterpretedOption(__vs) def addAllUninterpretedOption(__vs: TraversableOnce[com.google.protobuf.descriptor.UninterpretedOption]): MethodOptions = copy(uninterpretedOption = uninterpretedOption ++ __vs) @@ -82,6 +94,7 @@ final case class MethodOptions( def getFieldByNumber(__fieldNumber: Int): scala.Any = { (__fieldNumber: @_root_.scala.unchecked) match { case 33 => deprecated.orNull + case 34 => idempotencyLevel.map(_.javaValueDescriptor).orNull case 999 => uninterpretedOption } } @@ -89,6 +102,7 @@ final case class MethodOptions( require(__field.containingMessage eq companion.scalaDescriptor) (__field.number: @_root_.scala.unchecked) match { case 33 => deprecated.map(_root_.scalapb.descriptors.PBoolean).getOrElse(_root_.scalapb.descriptors.PEmpty) + case 34 => idempotencyLevel.map(__e => _root_.scalapb.descriptors.PEnum(__e.scalaValueDescriptor)).getOrElse(_root_.scalapb.descriptors.PEmpty) case 999 => _root_.scalapb.descriptors.PRepeated(uninterpretedOption.map(_.toPMessage)(_root_.scala.collection.breakOut)) } } @@ -101,11 +115,13 @@ object MethodOptions extends com.trueaccord.scalapb.GeneratedMessageCompanion[co def toJavaProto(scalaPbSource: com.google.protobuf.descriptor.MethodOptions): com.google.protobuf.DescriptorProtos.MethodOptions = { val javaPbOut = com.google.protobuf.DescriptorProtos.MethodOptions.newBuilder scalaPbSource.deprecated.foreach(javaPbOut.setDeprecated) + scalaPbSource.idempotencyLevel.map(com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel.toJavaValue).foreach(javaPbOut.setIdempotencyLevel) javaPbOut.addAllUninterpretedOption(scalaPbSource.uninterpretedOption.map(com.google.protobuf.descriptor.UninterpretedOption.toJavaProto)(_root_.scala.collection.breakOut).asJava) javaPbOut.build } def fromJavaProto(javaPbSource: com.google.protobuf.DescriptorProtos.MethodOptions): com.google.protobuf.descriptor.MethodOptions = com.google.protobuf.descriptor.MethodOptions( deprecated = if (javaPbSource.hasDeprecated) Some(javaPbSource.getDeprecated.booleanValue) else None, + idempotencyLevel = if (javaPbSource.hasIdempotencyLevel) Some(com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel.fromJavaValue(javaPbSource.getIdempotencyLevel)) else None, uninterpretedOption = javaPbSource.getUninterpretedOptionList.asScala.map(com.google.protobuf.descriptor.UninterpretedOption.fromJavaProto)(_root_.scala.collection.breakOut) ) def fromFieldsMap(__fieldsMap: scala.collection.immutable.Map[_root_.com.google.protobuf.Descriptors.FieldDescriptor, scala.Any]): com.google.protobuf.descriptor.MethodOptions = { @@ -113,7 +129,8 @@ object MethodOptions extends com.trueaccord.scalapb.GeneratedMessageCompanion[co val __fields = javaDescriptor.getFields com.google.protobuf.descriptor.MethodOptions( __fieldsMap.get(__fields.get(0)).asInstanceOf[scala.Option[Boolean]], - __fieldsMap.getOrElse(__fields.get(1), Nil).asInstanceOf[_root_.scala.collection.Seq[com.google.protobuf.descriptor.UninterpretedOption]] + __fieldsMap.get(__fields.get(1)).asInstanceOf[scala.Option[_root_.com.google.protobuf.Descriptors.EnumValueDescriptor]].map(__e => com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel.fromValue(__e.getNumber)), + __fieldsMap.getOrElse(__fields.get(2), Nil).asInstanceOf[_root_.scala.collection.Seq[com.google.protobuf.descriptor.UninterpretedOption]] ) } implicit def messageReads: _root_.scalapb.descriptors.Reads[com.google.protobuf.descriptor.MethodOptions] = _root_.scalapb.descriptors.Reads{ @@ -121,6 +138,7 @@ object MethodOptions extends com.trueaccord.scalapb.GeneratedMessageCompanion[co require(__fieldsMap.keys.forall(_.containingMessage == scalaDescriptor), "FieldDescriptor does not match message type.") com.google.protobuf.descriptor.MethodOptions( __fieldsMap.get(scalaDescriptor.findFieldByNumber(33).get).flatMap(_.as[scala.Option[Boolean]]), + __fieldsMap.get(scalaDescriptor.findFieldByNumber(34).get).flatMap(_.as[scala.Option[_root_.scalapb.descriptors.EnumValueDescriptor]]).map(__e => com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel.fromValue(__e.number)), __fieldsMap.get(scalaDescriptor.findFieldByNumber(999).get).map(_.as[_root_.scala.collection.Seq[com.google.protobuf.descriptor.UninterpretedOption]]).getOrElse(_root_.scala.collection.Seq.empty) ) case _ => throw new RuntimeException("Expected PMessage") @@ -134,14 +152,70 @@ object MethodOptions extends com.trueaccord.scalapb.GeneratedMessageCompanion[co } __out } - def enumCompanionForFieldNumber(__fieldNumber: Int): _root_.com.trueaccord.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber) + def enumCompanionForFieldNumber(__fieldNumber: Int): _root_.com.trueaccord.scalapb.GeneratedEnumCompanion[_] = { + (__fieldNumber: @_root_.scala.unchecked) match { + case 34 => com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel + } + } lazy val defaultInstance = com.google.protobuf.descriptor.MethodOptions( ) + sealed trait IdempotencyLevel extends _root_.com.trueaccord.scalapb.GeneratedEnum { + type EnumType = IdempotencyLevel + def isIdempotencyUnknown: Boolean = false + def isNoSideEffects: Boolean = false + def isIdempotent: Boolean = false + def companion: _root_.com.trueaccord.scalapb.GeneratedEnumCompanion[IdempotencyLevel] = com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel + } + + object IdempotencyLevel extends _root_.com.trueaccord.scalapb.GeneratedEnumCompanion[IdempotencyLevel] { + implicit def enumCompanion: _root_.com.trueaccord.scalapb.GeneratedEnumCompanion[IdempotencyLevel] = this + @SerialVersionUID(0L) + case object IDEMPOTENCY_UNKNOWN extends IdempotencyLevel { + val value = 0 + val index = 0 + val name = "IDEMPOTENCY_UNKNOWN" + override def isIdempotencyUnknown: Boolean = true + } + + @SerialVersionUID(0L) + case object NO_SIDE_EFFECTS extends IdempotencyLevel { + val value = 1 + val index = 1 + val name = "NO_SIDE_EFFECTS" + override def isNoSideEffects: Boolean = true + } + + @SerialVersionUID(0L) + case object IDEMPOTENT extends IdempotencyLevel { + val value = 2 + val index = 2 + val name = "IDEMPOTENT" + override def isIdempotent: Boolean = true + } + + @SerialVersionUID(0L) + case class Unrecognized(value: Int) extends IdempotencyLevel with _root_.com.trueaccord.scalapb.UnrecognizedEnum + + lazy val values = scala.collection.Seq(IDEMPOTENCY_UNKNOWN, NO_SIDE_EFFECTS, IDEMPOTENT) + def fromValue(value: Int): IdempotencyLevel = value match { + case 0 => IDEMPOTENCY_UNKNOWN + case 1 => NO_SIDE_EFFECTS + case 2 => IDEMPOTENT + case __other => Unrecognized(__other) + } + def javaDescriptor: _root_.com.google.protobuf.Descriptors.EnumDescriptor = com.google.protobuf.descriptor.MethodOptions.javaDescriptor.getEnumTypes.get(0) + def scalaDescriptor: _root_.scalapb.descriptors.EnumDescriptor = com.google.protobuf.descriptor.MethodOptions.scalaDescriptor.enums(0) + def fromJavaValue(pbJavaSource: com.google.protobuf.DescriptorProtos.MethodOptions.IdempotencyLevel): IdempotencyLevel = fromValue(pbJavaSource.getNumber) + def toJavaValue(pbScalaSource: IdempotencyLevel): com.google.protobuf.DescriptorProtos.MethodOptions.IdempotencyLevel = com.google.protobuf.DescriptorProtos.MethodOptions.IdempotencyLevel.forNumber(pbScalaSource.value) + } implicit class MethodOptionsLens[UpperPB](_l: _root_.com.trueaccord.lenses.Lens[UpperPB, com.google.protobuf.descriptor.MethodOptions]) extends _root_.com.trueaccord.lenses.ObjectLens[UpperPB, com.google.protobuf.descriptor.MethodOptions](_l) { def deprecated: _root_.com.trueaccord.lenses.Lens[UpperPB, Boolean] = field(_.getDeprecated)((c_, f_) => c_.copy(deprecated = Some(f_))) def optionalDeprecated: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[Boolean]] = field(_.deprecated)((c_, f_) => c_.copy(deprecated = f_)) + def idempotencyLevel: _root_.com.trueaccord.lenses.Lens[UpperPB, com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel] = field(_.getIdempotencyLevel)((c_, f_) => c_.copy(idempotencyLevel = Some(f_))) + def optionalIdempotencyLevel: _root_.com.trueaccord.lenses.Lens[UpperPB, scala.Option[com.google.protobuf.descriptor.MethodOptions.IdempotencyLevel]] = field(_.idempotencyLevel)((c_, f_) => c_.copy(idempotencyLevel = f_)) def uninterpretedOption: _root_.com.trueaccord.lenses.Lens[UpperPB, _root_.scala.collection.Seq[com.google.protobuf.descriptor.UninterpretedOption]] = field(_.uninterpretedOption)((c_, f_) => c_.copy(uninterpretedOption = f_)) } final val DEPRECATED_FIELD_NUMBER = 33 + final val IDEMPOTENCY_LEVEL_FIELD_NUMBER = 34 final val UNINTERPRETED_OPTION_FIELD_NUMBER = 999 } diff --git a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/duration/Duration.scala b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/duration/Duration.scala index bc76c097a..5ca7d3e59 100644 --- a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/duration/Duration.scala +++ b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/duration/Duration.scala @@ -14,6 +14,8 @@ import scala.collection.JavaConverters._ * two Timestamp values is a Duration and it can be added or subtracted * from a Timestamp. Range is approximately +-10,000 years. * + * # Examples + * * Example 1: Compute Duration from two Timestamps in pseudo code. * * Timestamp start = ...; @@ -48,9 +50,26 @@ import scala.collection.JavaConverters._ * end.nanos -= 1000000000; * } * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + * * @param seconds * Signed seconds of the span of time. Must be from -315,576,000,000 - * to +315,576,000,000 inclusive. + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years * @param nanos * Signed fractions of a second at nanosecond resolution of the span * of time. Durations less than one second are represented with a 0 diff --git a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/duration/DurationProto.scala b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/duration/DurationProto.scala index 655e3c407..ed6b8f605 100644 --- a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/duration/DurationProto.scala +++ b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/duration/DurationProto.scala @@ -12,7 +12,7 @@ object DurationProto { com.trueaccord.scalapb.Encoding.fromBase64(scala.collection.Seq( """Ch5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8SD2dvb2dsZS5wcm90b2J1ZiI6CghEdXJhdGlvbhIYCgdzZWNvbmRzG AEgASgDUgdzZWNvbmRzEhQKBW5hbm9zGAIgASgFUgVuYW5vc0J8ChNjb20uZ29vZ2xlLnByb3RvYnVmQg1EdXJhdGlvblByb3RvU - AFaKmdpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy9kdXJhdGlvbqABAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZ + AFaKmdpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy9kdXJhdGlvbvgBAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZ WxsS25vd25UeXBlc2IGcHJvdG8z""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { diff --git a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/empty/EmptyProto.scala b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/empty/EmptyProto.scala index 0ecbd86a5..ce21c51b9 100644 --- a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/empty/EmptyProto.scala +++ b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/empty/EmptyProto.scala @@ -10,9 +10,9 @@ import scala.collection.JavaConverters._ object EmptyProto { private lazy val ProtoBytes: Array[Byte] = com.trueaccord.scalapb.Encoding.fromBase64(scala.collection.Seq( - """Chtnb29nbGUvcHJvdG9idWYvZW1wdHkucHJvdG8SD2dvb2dsZS5wcm90b2J1ZiIHCgVFbXB0eUJ5ChNjb20uZ29vZ2xlLnByb - 3RvYnVmQgpFbXB0eVByb3RvUAFaJ2dpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy9lbXB0eaABAfgBAaICA0dQQqoCH - kdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z""" + """Chtnb29nbGUvcHJvdG9idWYvZW1wdHkucHJvdG8SD2dvb2dsZS5wcm90b2J1ZiIHCgVFbXB0eUJ2ChNjb20uZ29vZ2xlLnByb + 3RvYnVmQgpFbXB0eVByb3RvUAFaJ2dpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy9lbXB0efgBAaICA0dQQqoCHkdvb + 2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) diff --git a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/field_mask/FieldMask.scala b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/field_mask/FieldMask.scala index b6962892b..45c666ca5 100644 --- a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/field_mask/FieldMask.scala +++ b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/field_mask/FieldMask.scala @@ -50,7 +50,7 @@ import scala.collection.JavaConverters._ * } * * A repeated field is not allowed except at the last position of a - * field mask. + * paths string. * * If a FieldMask object is not present in a get operation, the * operation applies to all fields (as if a FieldMask of all fields @@ -77,8 +77,8 @@ import scala.collection.JavaConverters._ * * If a repeated field is specified for an update operation, the existing * repeated values in the target resource will be overwritten by the new values. - * Note that a repeated field is only allowed in the last position of a field - * mask. + * Note that a repeated field is only allowed in the last position of a `paths` + * string. * * If a sub-message is specified in the last position of the field mask for an * update operation, then the existing sub-message in the target resource is diff --git a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/field_mask/FieldMaskProto.scala b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/field_mask/FieldMaskProto.scala index 95f7e36ee..633f3b328 100644 --- a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/field_mask/FieldMaskProto.scala +++ b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/field_mask/FieldMaskProto.scala @@ -11,8 +11,9 @@ object FieldMaskProto { private lazy val ProtoBytes: Array[Byte] = com.trueaccord.scalapb.Encoding.fromBase64(scala.collection.Seq( """CiBnb29nbGUvcHJvdG9idWYvZmllbGRfbWFzay5wcm90bxIPZ29vZ2xlLnByb3RvYnVmIiEKCUZpZWxkTWFzaxIUCgVwYXRoc - xgBIAMoCVIFcGF0aHNCUQoTY29tLmdvb2dsZS5wcm90b2J1ZkIORmllbGRNYXNrUHJvdG9QAaABAaICA0dQQqoCHkdvb2dsZS5Qc - m90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z""" + xgBIAMoCVIFcGF0aHNCiQEKE2NvbS5nb29nbGUucHJvdG9idWZCDkZpZWxkTWFza1Byb3RvUAFaOWdvb2dsZS5nb2xhbmcub3JnL + 2dlbnByb3RvL3Byb3RvYnVmL2ZpZWxkX21hc2s7ZmllbGRfbWFza6ICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25Ue + XBlc2IGcHJvdG8z""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) diff --git a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/source_context/SourceContextProto.scala b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/source_context/SourceContextProto.scala index 896147b40..37b7918ca 100644 --- a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/source_context/SourceContextProto.scala +++ b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/source_context/SourceContextProto.scala @@ -11,8 +11,9 @@ object SourceContextProto { private lazy val ProtoBytes: Array[Byte] = com.trueaccord.scalapb.Encoding.fromBase64(scala.collection.Seq( """CiRnb29nbGUvcHJvdG9idWYvc291cmNlX2NvbnRleHQucHJvdG8SD2dvb2dsZS5wcm90b2J1ZiIsCg1Tb3VyY2VDb250ZXh0E - hsKCWZpbGVfbmFtZRgBIAEoCVIIZmlsZU5hbWVCVQoTY29tLmdvb2dsZS5wcm90b2J1ZkISU291cmNlQ29udGV4dFByb3RvUAGgA - QGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw==""" + hsKCWZpbGVfbmFtZRgBIAEoCVIIZmlsZU5hbWVClQEKE2NvbS5nb29nbGUucHJvdG9idWZCElNvdXJjZUNvbnRleHRQcm90b1ABW + kFnb29nbGUuZ29sYW5nLm9yZy9nZW5wcm90by9wcm90b2J1Zi9zb3VyY2VfY29udGV4dDtzb3VyY2VfY29udGV4dKICA0dQQqoCH + kdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) diff --git a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/struct/StructProto.scala b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/struct/StructProto.scala index e3ab6c8a8..251dd4768 100644 --- a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/struct/StructProto.scala +++ b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/struct/StructProto.scala @@ -19,7 +19,7 @@ object StructProto { XN0X3ZhbHVlGAYgASgLMhouZ29vZ2xlLnByb3RvYnVmLkxpc3RWYWx1ZUgAUglsaXN0VmFsdWVCBgoEa2luZCI7CglMaXN0VmFsd WUSLgoGdmFsdWVzGAEgAygLMhYuZ29vZ2xlLnByb3RvYnVmLlZhbHVlUgZ2YWx1ZXMqGwoJTnVsbFZhbHVlEg4KCk5VTExfVkFMV UUQAEKBAQoTY29tLmdvb2dsZS5wcm90b2J1ZkILU3RydWN0UHJvdG9QAVoxZ2l0aHViLmNvbS9nb2xhbmcvcHJvdG9idWYvcHR5c - GVzL3N0cnVjdDtzdHJ1Y3RwYqABAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z""" + GVzL3N0cnVjdDtzdHJ1Y3RwYvgBAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) diff --git a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/timestamp/Timestamp.scala b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/timestamp/Timestamp.scala index 27a390f88..2fb6447aa 100644 --- a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/timestamp/Timestamp.scala +++ b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/timestamp/Timestamp.scala @@ -19,6 +19,8 @@ import scala.collection.JavaConverters._ * and from RFC 3339 date strings. * See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). * + * # Examples + * * Example 1: Compute Timestamp from POSIX `time()`. * * Timestamp timestamp; @@ -56,14 +58,35 @@ import scala.collection.JavaConverters._ * * Example 5: Compute Timestamp from current time in Python. * - * now = time.time() - * seconds = int(now) - * nanos = int((now - seconds) * 10**9) - * timestamp = Timestamp(seconds=seconds, nanos=nanos) + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required, though only UTC (as indicated by "Z") is presently supported. + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString] + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) + * with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one + * can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( + * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()) + * to obtain a formatter capable of generating timestamps in this format. * * @param seconds * Represents seconds of UTC time since Unix epoch - * 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to * 9999-12-31T23:59:59Z inclusive. * @param nanos * Non-negative fractions of a second at nanosecond resolution. Negative diff --git a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/timestamp/TimestampProto.scala b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/timestamp/TimestampProto.scala index 372abf505..d928f6349 100644 --- a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/timestamp/TimestampProto.scala +++ b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/timestamp/TimestampProto.scala @@ -11,9 +11,9 @@ object TimestampProto { private lazy val ProtoBytes: Array[Byte] = com.trueaccord.scalapb.Encoding.fromBase64(scala.collection.Seq( """Ch9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1wLnByb3RvEg9nb29nbGUucHJvdG9idWYiOwoJVGltZXN0YW1wEhgKB3NlY29uZ - HMYASABKANSB3NlY29uZHMSFAoFbmFub3MYAiABKAVSBW5hbm9zQoEBChNjb20uZ29vZ2xlLnByb3RvYnVmQg5UaW1lc3RhbXBQc - m90b1ABWitnaXRodWIuY29tL2dvbGFuZy9wcm90b2J1Zi9wdHlwZXMvdGltZXN0YW1woAEB+AEBogIDR1BCqgIeR29vZ2xlLlByb - 3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM=""" + HMYASABKANSB3NlY29uZHMSFAoFbmFub3MYAiABKAVSBW5hbm9zQn4KE2NvbS5nb29nbGUucHJvdG9idWZCDlRpbWVzdGFtcFByb + 3RvUAFaK2dpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy90aW1lc3RhbXD4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9id + WYuV2VsbEtub3duVHlwZXNiBnByb3RvMw==""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) diff --git a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/type/OptionProto.scala b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/type/OptionProto.scala index 905a014ea..21453aef0 100644 --- a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/type/OptionProto.scala +++ b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/type/OptionProto.scala @@ -11,9 +11,15 @@ import scala.collection.JavaConverters._ * enumeration, etc. * * @param name - * The option's name. For example, `"java_package"`. + * The option's name. For protobuf built-in options (options defined in + * descriptor.proto), this is the short name. For example, `"map_entry"`. + * For custom options, it should be the fully-qualified name. For example, + * `"google.api.http"`. * @param value - * The option's value. For example, `"com.google.protobuf"`. + * The option's value packed in an Any message. If the value is a primitive, + * the corresponding wrapper type defined in google/protobuf/wrappers.proto + * should be used. If the value is an enum, it should be stored as an int32 + * value using the google.protobuf.Int32Value type. */ @SerialVersionUID(0L) final case class OptionProto( diff --git a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/type/TypeProto.scala b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/type/TypeProto.scala index 5f167e31f..92a0704ec 100644 --- a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/type/TypeProto.scala +++ b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/type/TypeProto.scala @@ -32,8 +32,9 @@ object TypeProto { XgYBSABKA4yFy5nb29nbGUucHJvdG9idWYuU3ludGF4UgZzeW50YXgiagoJRW51bVZhbHVlEhIKBG5hbWUYASABKAlSBG5hbWUSF goGbnVtYmVyGAIgASgFUgZudW1iZXISMQoHb3B0aW9ucxgDIAMoCzIXLmdvb2dsZS5wcm90b2J1Zi5PcHRpb25SB29wdGlvbnMiS AoGT3B0aW9uEhIKBG5hbWUYASABKAlSBG5hbWUSKgoFdmFsdWUYAiABKAsyFC5nb29nbGUucHJvdG9idWYuQW55UgV2YWx1ZSouC - gZTeW50YXgSEQoNU1lOVEFYX1BST1RPMhAAEhEKDVNZTlRBWF9QUk9UTzMQAUJMChNjb20uZ29vZ2xlLnByb3RvYnVmQglUeXBlU - HJvdG9QAaABAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z""" + gZTeW50YXgSEQoNU1lOVEFYX1BST1RPMhAAEhEKDVNZTlRBWF9QUk9UTzMQAUJ9ChNjb20uZ29vZ2xlLnByb3RvYnVmQglUeXBlU + HJvdG9QAVovZ29vZ2xlLmdvbGFuZy5vcmcvZ2VucHJvdG8vcHJvdG9idWYvcHR5cGU7cHR5cGX4AQGiAgNHUEKqAh5Hb29nbGUuU + HJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw==""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) diff --git a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/wrappers/WrappersProto.scala b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/wrappers/WrappersProto.scala index 2e159b4db..b7c026149 100644 --- a/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/wrappers/WrappersProto.scala +++ b/scalapb-runtime/jvm/src/main/scala/com/google/protobuf/wrappers/WrappersProto.scala @@ -15,8 +15,8 @@ object WrappersProto { AEoA1IFdmFsdWUiIwoLVUludDY0VmFsdWUSFAoFdmFsdWUYASABKARSBXZhbHVlIiIKCkludDMyVmFsdWUSFAoFdmFsdWUYASABK AVSBXZhbHVlIiMKC1VJbnQzMlZhbHVlEhQKBXZhbHVlGAEgASgNUgV2YWx1ZSIhCglCb29sVmFsdWUSFAoFdmFsdWUYASABKAhSB XZhbHVlIiMKC1N0cmluZ1ZhbHVlEhQKBXZhbHVlGAEgASgJUgV2YWx1ZSIiCgpCeXRlc1ZhbHVlEhQKBXZhbHVlGAEgASgMUgV2Y - Wx1ZUJ/ChNjb20uZ29vZ2xlLnByb3RvYnVmQg1XcmFwcGVyc1Byb3RvUAFaKmdpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0e - XBlcy93cmFwcGVyc6ABAfgBAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z""" + Wx1ZUJ8ChNjb20uZ29vZ2xlLnByb3RvYnVmQg1XcmFwcGVyc1Byb3RvUAFaKmdpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0e + XBlcy93cmFwcGVyc/gBAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z""" ).mkString) lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = { val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes) diff --git a/third_party/google/protobuf/any.proto b/third_party/google/protobuf/any.proto index 81dcf46cc..9bd3f50a4 100644 --- a/third_party/google/protobuf/any.proto +++ b/third_party/google/protobuf/any.proto @@ -37,7 +37,6 @@ option go_package = "github.com/golang/protobuf/ptypes/any"; option java_package = "com.google.protobuf"; option java_outer_classname = "AnyProto"; option java_multiple_files = true; -option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; // `Any` contains an arbitrary serialized protocol buffer message along with a diff --git a/third_party/google/protobuf/api.proto b/third_party/google/protobuf/api.proto index dbe87b8f5..7c30e8b7a 100644 --- a/third_party/google/protobuf/api.proto +++ b/third_party/google/protobuf/api.proto @@ -39,8 +39,8 @@ option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option java_package = "com.google.protobuf"; option java_outer_classname = "ApiProto"; option java_multiple_files = true; -option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; +option go_package = "google.golang.org/genproto/protobuf/api;api"; // Api is a light-weight descriptor for a protocol buffer service. message Api { diff --git a/third_party/google/protobuf/compiler/plugin.proto b/third_party/google/protobuf/compiler/plugin.proto index acaee1f49..f04dc73c8 100644 --- a/third_party/google/protobuf/compiler/plugin.proto +++ b/third_party/google/protobuf/compiler/plugin.proto @@ -49,10 +49,20 @@ package google.protobuf.compiler; option java_package = "com.google.protobuf.compiler"; option java_outer_classname = "PluginProtos"; -option go_package = "plugin_go"; +option go_package = "github.com/golang/protobuf/protoc-gen-go/plugin;plugin_go"; import "google/protobuf/descriptor.proto"; +// The version number of protocol compiler. +message Version { + optional int32 major = 1; + optional int32 minor = 2; + optional int32 patch = 3; + // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should + // be empty for mainline stable releases. + optional string suffix = 4; +} + // An encoded CodeGeneratorRequest is written to the plugin's stdin. message CodeGeneratorRequest { // The .proto files that were explicitly listed on the command-line. The @@ -74,7 +84,13 @@ message CodeGeneratorRequest { // the entire set into memory at once. However, as of this writing, this // is not similarly optimized on protoc's end -- it will store all fields in // memory at once before sending them to the plugin. + // + // Type names of fields and extensions in the FileDescriptorProto are always + // fully qualified. repeated FileDescriptorProto proto_file = 15; + + // The version number of protocol compiler. + optional Version compiler_version = 3; } // The plugin writes an encoded CodeGeneratorResponse to stdout. diff --git a/third_party/google/protobuf/descriptor.proto b/third_party/google/protobuf/descriptor.proto index 28410d4a9..f859c4297 100644 --- a/third_party/google/protobuf/descriptor.proto +++ b/third_party/google/protobuf/descriptor.proto @@ -40,12 +40,11 @@ syntax = "proto2"; package google.protobuf; -option go_package = "descriptor"; +option go_package = "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor"; option java_package = "com.google.protobuf"; option java_outer_classname = "DescriptorProtos"; option csharp_namespace = "Google.Protobuf.Reflection"; option objc_class_prefix = "GPB"; -option java_generate_equals_and_hash = true; // descriptor.proto must be optimized for speed because reflection-based // algorithms don't work during bootstrapping. @@ -140,7 +139,11 @@ message FieldDescriptorProto { TYPE_FIXED32 = 7; TYPE_BOOL = 8; TYPE_STRING = 9; - TYPE_GROUP = 10; // Tag-delimited aggregate. + // Tag-delimited aggregate. + // Group type is deprecated and not supported in proto3. However, Proto3 + // implementations should still be able to parse the group wire format and + // treat group fields as unknown fields. + TYPE_GROUP = 10; TYPE_MESSAGE = 11; // Length-delimited aggregate. // New in version 2. @@ -158,7 +161,6 @@ message FieldDescriptorProto { LABEL_OPTIONAL = 1; LABEL_REQUIRED = 2; LABEL_REPEATED = 3; - // TODO(sanjay): Should we add LABEL_MAP? }; optional string name = 1; @@ -306,19 +308,8 @@ message FileOptions { // top-level extensions defined in the file. optional bool java_multiple_files = 10 [default=false]; - // If set true, then the Java code generator will generate equals() and - // hashCode() methods for all messages defined in the .proto file. - // This increases generated code size, potentially substantially for large - // protos, which may harm a memory-constrained application. - // - In the full runtime this is a speed optimization, as the - // AbstractMessage base class includes reflection-based implementations of - // these methods. - // - In the lite runtime, setting this option changes the semantics of - // equals() and hashCode() to more closely match those of the full runtime; - // the generated methods compute their results based on field values rather - // than object identity. (Implementations should not assume that hashcodes - // will be consistent across runtimes or versions of the protocol compiler.) - optional bool java_generate_equals_and_hash = 20 [default=false]; + // This option does nothing. + optional bool java_generate_equals_and_hash = 20 [deprecated=true]; // If set true, then the Java2 code generator will generate code that // throws an exception whenever an attempt is made to assign a non-UTF-8 @@ -379,6 +370,16 @@ message FileOptions { // Namespace for generated classes; defaults to the package. optional string csharp_namespace = 37; + // By default Swift generators will take the proto package and CamelCase it + // replacing '.' with underscore and use that to prefix the types/symbols + // defined. When this options is provided, they will use this value instead + // to prefix the types/symbols defined. + optional string swift_prefix = 39; + + // Sets the php class prefix which is prepended to all php generated classes + // from this .proto. Default is empty. + optional string php_class_prefix = 40; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -443,6 +444,9 @@ message MessageOptions { // parser. optional bool map_entry = 7; + reserved 8; // javalite_serializable + reserved 9; // javanano_as_lite + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -471,7 +475,6 @@ message FieldOptions { // false will avoid using packed encoding. optional bool packed = 2; - // The jstype option determines the JavaScript type used for values of the // field. The option is permitted only for 64 bit integral and fixed types // (int64, uint64, sint64, fixed64, sfixed64). By default these types are @@ -512,7 +515,7 @@ message FieldOptions { // // // Note that implementations may choose not to check required fields within - // a lazy sub-message. That is, calling IsInitialized() on the outher message + // a lazy sub-message. That is, calling IsInitialized() on the outer message // may return true even if the inner message has missing required fields. // This is necessary because otherwise the inner message would have to be // parsed in order to perform the check, defeating the purpose of lazy @@ -538,6 +541,8 @@ message FieldOptions { // Clients can define custom options in extensions of this message. See above. extensions 1000 to max; + + reserved 4; // removed jtype } message OneofOptions { @@ -560,6 +565,8 @@ message EnumOptions { // is a formalization for deprecating enums. optional bool deprecated = 3 [default=false]; + reserved 5; // javanano_as_lite + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -614,6 +621,17 @@ message MethodOptions { // this is a formalization for deprecating methods. optional bool deprecated = 33 [default=false]; + // Is this method side-effect-free (or safe in HTTP parlance), or idempotent, + // or neither? HTTP based RPC implementation may choose GET verb for safe + // methods, and PUT verb for idempotent methods instead of the default POST. + enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0; + NO_SIDE_EFFECTS = 1; // implies idempotent + IDEMPOTENT = 2; // idempotent, but may have side effects + } + optional IdempotencyLevel idempotency_level = + 34 [default=IDEMPOTENCY_UNKNOWN]; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; diff --git a/third_party/google/protobuf/duration.proto b/third_party/google/protobuf/duration.proto index 96c1796d6..975fce41a 100644 --- a/third_party/google/protobuf/duration.proto +++ b/third_party/google/protobuf/duration.proto @@ -33,11 +33,11 @@ syntax = "proto3"; package google.protobuf; option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option cc_enable_arenas = true; option go_package = "github.com/golang/protobuf/ptypes/duration"; option java_package = "com.google.protobuf"; option java_outer_classname = "DurationProto"; option java_multiple_files = true; -option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; // A Duration represents a signed, fixed-length span of time represented @@ -47,6 +47,8 @@ option objc_class_prefix = "GPB"; // two Timestamp values is a Duration and it can be added or subtracted // from a Timestamp. Range is approximately +-10,000 years. // +// # Examples +// // Example 1: Compute Duration from two Timestamps in pseudo code. // // Timestamp start = ...; @@ -81,11 +83,28 @@ option objc_class_prefix = "GPB"; // end.nanos -= 1000000000; // } // +// Example 3: Compute Duration from datetime.timedelta in Python. +// +// td = datetime.timedelta(days=3, minutes=10) +// duration = Duration() +// duration.FromTimedelta(td) +// +// # JSON Mapping +// +// In JSON format, the Duration type is encoded as a string rather than an +// object, where the string ends in the suffix "s" (indicating seconds) and +// is preceded by the number of seconds, with nanoseconds expressed as +// fractional seconds. For example, 3 seconds with 0 nanoseconds should be +// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should +// be expressed in JSON format as "3.000000001s", and 3 seconds and 1 +// microsecond should be expressed in JSON format as "3.000001s". +// // message Duration { // Signed seconds of the span of time. Must be from -315,576,000,000 - // to +315,576,000,000 inclusive. + // to +315,576,000,000 inclusive. Note: these bounds are computed from: + // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years int64 seconds = 1; // Signed fractions of a second at nanosecond resolution of the span diff --git a/third_party/google/protobuf/empty.proto b/third_party/google/protobuf/empty.proto index 37f4cd10e..03cacd233 100644 --- a/third_party/google/protobuf/empty.proto +++ b/third_party/google/protobuf/empty.proto @@ -37,7 +37,6 @@ option go_package = "github.com/golang/protobuf/ptypes/empty"; option java_package = "com.google.protobuf"; option java_outer_classname = "EmptyProto"; option java_multiple_files = true; -option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; option cc_enable_arenas = true; diff --git a/third_party/google/protobuf/field_mask.proto b/third_party/google/protobuf/field_mask.proto index c51de09a8..c68d247c8 100644 --- a/third_party/google/protobuf/field_mask.proto +++ b/third_party/google/protobuf/field_mask.proto @@ -37,7 +37,7 @@ option java_package = "com.google.protobuf"; option java_outer_classname = "FieldMaskProto"; option java_multiple_files = true; option objc_class_prefix = "GPB"; -option java_generate_equals_and_hash = true; +option go_package = "google.golang.org/genproto/protobuf/field_mask;field_mask"; // `FieldMask` represents a set of symbolic field paths, for example: // @@ -82,7 +82,7 @@ option java_generate_equals_and_hash = true; // } // // A repeated field is not allowed except at the last position of a -// field mask. +// paths string. // // If a FieldMask object is not present in a get operation, the // operation applies to all fields (as if a FieldMask of all fields @@ -109,8 +109,8 @@ option java_generate_equals_and_hash = true; // // If a repeated field is specified for an update operation, the existing // repeated values in the target resource will be overwritten by the new values. -// Note that a repeated field is only allowed in the last position of a field -// mask. +// Note that a repeated field is only allowed in the last position of a `paths` +// string. // // If a sub-message is specified in the last position of the field mask for an // update operation, then the existing sub-message in the target resource is diff --git a/third_party/google/protobuf/source_context.proto b/third_party/google/protobuf/source_context.proto index a2c08e2b5..f3b2c9668 100644 --- a/third_party/google/protobuf/source_context.proto +++ b/third_party/google/protobuf/source_context.proto @@ -36,8 +36,8 @@ option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option java_package = "com.google.protobuf"; option java_outer_classname = "SourceContextProto"; option java_multiple_files = true; -option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; +option go_package = "google.golang.org/genproto/protobuf/source_context;source_context"; // `SourceContext` represents information about the source of a // protobuf element, like the file in which it is defined. diff --git a/third_party/google/protobuf/struct.proto b/third_party/google/protobuf/struct.proto index beeba8118..7d7808e7f 100644 --- a/third_party/google/protobuf/struct.proto +++ b/third_party/google/protobuf/struct.proto @@ -33,11 +33,11 @@ syntax = "proto3"; package google.protobuf; option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option cc_enable_arenas = true; option go_package = "github.com/golang/protobuf/ptypes/struct;structpb"; option java_package = "com.google.protobuf"; option java_outer_classname = "StructProto"; option java_multiple_files = true; -option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; diff --git a/third_party/google/protobuf/timestamp.proto b/third_party/google/protobuf/timestamp.proto index 7992a8588..b7cbd1750 100644 --- a/third_party/google/protobuf/timestamp.proto +++ b/third_party/google/protobuf/timestamp.proto @@ -38,7 +38,6 @@ option go_package = "github.com/golang/protobuf/ptypes/timestamp"; option java_package = "com.google.protobuf"; option java_outer_classname = "TimestampProto"; option java_multiple_files = true; -option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; // A Timestamp represents a point in time independent of any time zone @@ -53,6 +52,8 @@ option objc_class_prefix = "GPB"; // and from RFC 3339 date strings. // See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). // +// # Examples +// // Example 1: Compute Timestamp from POSIX `time()`. // // Timestamp timestamp; @@ -90,16 +91,37 @@ option objc_class_prefix = "GPB"; // // Example 5: Compute Timestamp from current time in Python. // -// now = time.time() -// seconds = int(now) -// nanos = int((now - seconds) * 10**9) -// timestamp = Timestamp(seconds=seconds, nanos=nanos) +// timestamp = Timestamp() +// timestamp.GetCurrentTime() +// +// # JSON Mapping +// +// In JSON format, the Timestamp type is encoded as a string in the +// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the +// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" +// where {year} is always expressed using four digits while {month}, {day}, +// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional +// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), +// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone +// is required, though only UTC (as indicated by "Z") is presently supported. +// +// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past +// 01:30 UTC on January 15, 2017. +// +// In JavaScript, one can convert a Date object to this format using the +// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString] +// method. In Python, a standard `datetime.datetime` object can be converted +// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) +// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one +// can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( +// http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()) +// to obtain a formatter capable of generating timestamps in this format. // // message Timestamp { // Represents seconds of UTC time since Unix epoch - // 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to + // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to // 9999-12-31T23:59:59Z inclusive. int64 seconds = 1; diff --git a/third_party/google/protobuf/type.proto b/third_party/google/protobuf/type.proto index 1c9cf53da..624c15ee6 100644 --- a/third_party/google/protobuf/type.proto +++ b/third_party/google/protobuf/type.proto @@ -36,11 +36,12 @@ import "google/protobuf/any.proto"; import "google/protobuf/source_context.proto"; option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option cc_enable_arenas = true; option java_package = "com.google.protobuf"; option java_outer_classname = "TypeProto"; option java_multiple_files = true; -option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; +option go_package = "google.golang.org/genproto/protobuf/ptype;ptype"; // A protocol buffer message type. message Type { @@ -165,9 +166,15 @@ message EnumValue { // A protocol buffer option, which can be attached to a message, field, // enumeration, etc. message Option { - // The option's name. For example, `"java_package"`. + // The option's name. For protobuf built-in options (options defined in + // descriptor.proto), this is the short name. For example, `"map_entry"`. + // For custom options, it should be the fully-qualified name. For example, + // `"google.api.http"`. string name = 1; - // The option's value. For example, `"com.google.protobuf"`. + // The option's value packed in an Any message. If the value is a primitive, + // the corresponding wrapper type defined in google/protobuf/wrappers.proto + // should be used. If the value is an enum, it should be stored as an int32 + // value using the google.protobuf.Int32Value type. Any value = 2; } diff --git a/third_party/google/protobuf/wrappers.proto b/third_party/google/protobuf/wrappers.proto index 4828ad9ae..01947639a 100644 --- a/third_party/google/protobuf/wrappers.proto +++ b/third_party/google/protobuf/wrappers.proto @@ -43,7 +43,6 @@ option go_package = "github.com/golang/protobuf/ptypes/wrappers"; option java_package = "com.google.protobuf"; option java_outer_classname = "WrappersProto"; option java_multiple_files = true; -option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; // Wrapper message for `double`.