Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
regenerate protobuf classes with protoc 25.6
Browse files Browse the repository at this point in the history
raboof committed Jan 27, 2025
1 parent 4b9c10d commit 91c83dc
Showing 28 changed files with 24,149 additions and 27,167 deletions.
6 changes: 4 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -269,12 +269,14 @@ All wire protocol changes that may concern rolling upgrades should be documented
Pekko includes a shaded version of protobuf `3` that is used for internal communication. To generate files,
run `protobufGenerate`. The generated files are put in each project's `src/main/java` and need to be committed.
The generated files are automatically transformed to use the shaded version of protobuf.
The generated files are automatically transformed to use the shaded version of protobuf and add copyright headers.
Generation depends on protoc `3.11.4` being on the path. See [protobuf project](https://github.com/protocolbuffers/protobuf#protocol-compiler-installation) for installation instructions, and
Generation depends on the protoc version specified in `project/Dependencies.scala` being on the path. See [protobuf project](https://github.com/protocolbuffers/protobuf#protocol-compiler-installation) for installation instructions, and
[Protobuf.scala](https://github.com/apache/pekko/blob/main/project/Protobuf.scala) for details of how to override
the settings for generation.
After generation, run `sbt javafmt Test/javafmt`.
### Pull request requirements
For a pull request to be considered at all, it has to meet these requirements:
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -240,6 +240,7 @@ lazy val docs = pekkoModule("docs")
.settings(Dependencies.docs)
.settings(PekkoDisciplinePlugin.docs)
.settings(Paradox.settings)
.settings(Protobuf.settings)
.settings(javacOptions += "-parameters") // for Jackson
.enablePlugins(
ParadoxPlugin,

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -8,12 +8,13 @@
*/

/*
* Copyright (C) 2020-2022 Lightbend Inc. <https://www.lightbend.com>
* Copyright (C) 2019-2022 Lightbend Inc. <https://www.lightbend.com>
*/

// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: ClusterClientMessages.proto

// Protobuf Java Version: 3.25.6
package org.apache.pekko.cluster.client.protobuf.msg;

public final class ClusterClientMessages {
@@ -59,7 +60,7 @@ public interface ContactsOrBuilder extends
/**
* Protobuf type {@code Contacts}
*/
public static final class Contacts extends
public static final class Contacts extends
org.apache.pekko.protobufv3.internal.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:Contacts)
ContactsOrBuilder {
@@ -69,7 +70,8 @@ private Contacts(org.apache.pekko.protobufv3.internal.GeneratedMessageV3.Builder
super(builder);
}
private Contacts() {
contactPoints_ = org.apache.pekko.protobufv3.internal.LazyStringArrayList.emptyList();
contactPoints_ =
org.apache.pekko.protobufv3.internal.LazyStringArrayList.emptyList();
}

@java.lang.Override
@@ -79,61 +81,6 @@ protected java.lang.Object newInstance(
return new Contacts();
}

@java.lang.Override
public final org.apache.pekko.protobufv3.internal.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private Contacts(
org.apache.pekko.protobufv3.internal.CodedInputStream input,
org.apache.pekko.protobufv3.internal.ExtensionRegistryLite extensionRegistry)
throws org.apache.pekko.protobufv3.internal.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0;
org.apache.pekko.protobufv3.internal.UnknownFieldSet.Builder unknownFields =
org.apache.pekko.protobufv3.internal.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
org.apache.pekko.protobufv3.internal.ByteString bs = input.readBytes();
if (!((mutable_bitField0_ & 0x00000001) != 0)) {
contactPoints_ = new org.apache.pekko.protobufv3.internal.LazyStringArrayList();
mutable_bitField0_ |= 0x00000001;
}
contactPoints_.add(bs);
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (org.apache.pekko.protobufv3.internal.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new org.apache.pekko.protobufv3.internal.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) != 0)) {
contactPoints_ = contactPoints_.getUnmodifiableView();
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final org.apache.pekko.protobufv3.internal.Descriptors.Descriptor
getDescriptor() {
return org.apache.pekko.cluster.client.protobuf.msg.ClusterClientMessages.internal_static_Contacts_descriptor;
@@ -148,7 +95,9 @@ private Contacts(
}

public static final int CONTACTPOINTS_FIELD_NUMBER = 1;
private org.apache.pekko.protobufv3.internal.LazyStringList contactPoints_;
@SuppressWarnings("serial")
private org.apache.pekko.protobufv3.internal.LazyStringArrayList contactPoints_ =
org.apache.pekko.protobufv3.internal.LazyStringArrayList.emptyList();
/**
* <code>repeated string contactPoints = 1;</code>
* @return A list containing the contactPoints.
@@ -199,7 +148,7 @@ public void writeTo(org.apache.pekko.protobufv3.internal.CodedOutputStream outpu
for (int i = 0; i < contactPoints_.size(); i++) {
org.apache.pekko.protobufv3.internal.GeneratedMessageV3.writeString(output, 1, contactPoints_.getRaw(i));
}
unknownFields.writeTo(output);
getUnknownFields().writeTo(output);
}

@java.lang.Override
@@ -216,7 +165,7 @@ public int getSerializedSize() {
size += dataSize;
size += 1 * getContactPointsList().size();
}
size += unknownFields.getSerializedSize();
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
}
@@ -233,7 +182,7 @@ public boolean equals(final java.lang.Object obj) {

if (!getContactPointsList()
.equals(other.getContactPointsList())) return false;
if (!unknownFields.equals(other.unknownFields)) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}

@@ -248,7 +197,7 @@ public int hashCode() {
hash = (37 * hash) + CONTACTPOINTS_FIELD_NUMBER;
hash = (53 * hash) + getContactPointsList().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
}
@@ -297,11 +246,13 @@ public static org.apache.pekko.cluster.client.protobuf.msg.ClusterClientMessages
return org.apache.pekko.protobufv3.internal.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}

public static org.apache.pekko.cluster.client.protobuf.msg.ClusterClientMessages.Contacts parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return org.apache.pekko.protobufv3.internal.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}

public static org.apache.pekko.cluster.client.protobuf.msg.ClusterClientMessages.Contacts parseDelimitedFrom(
java.io.InputStream input,
org.apache.pekko.protobufv3.internal.ExtensionRegistryLite extensionRegistry)
@@ -365,24 +316,20 @@ public static final class Builder extends

// Construct using org.apache.pekko.cluster.client.protobuf.msg.ClusterClientMessages.Contacts.newBuilder()
private Builder() {
maybeForceBuilderInitialization();

}

private Builder(
org.apache.pekko.protobufv3.internal.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (org.apache.pekko.protobufv3.internal.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}

}
@java.lang.Override
public Builder clear() {
super.clear();
contactPoints_ = org.apache.pekko.protobufv3.internal.LazyStringArrayList.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
bitField0_ = 0;
contactPoints_ =
org.apache.pekko.protobufv3.internal.LazyStringArrayList.emptyList();
return this;
}

@@ -409,16 +356,19 @@ public org.apache.pekko.cluster.client.protobuf.msg.ClusterClientMessages.Contac
@java.lang.Override
public org.apache.pekko.cluster.client.protobuf.msg.ClusterClientMessages.Contacts buildPartial() {
org.apache.pekko.cluster.client.protobuf.msg.ClusterClientMessages.Contacts result = new org.apache.pekko.cluster.client.protobuf.msg.ClusterClientMessages.Contacts(this);
int from_bitField0_ = bitField0_;
if (((bitField0_ & 0x00000001) != 0)) {
contactPoints_ = contactPoints_.getUnmodifiableView();
bitField0_ = (bitField0_ & ~0x00000001);
}
result.contactPoints_ = contactPoints_;
if (bitField0_ != 0) { buildPartial0(result); }
onBuilt();
return result;
}

private void buildPartial0(org.apache.pekko.cluster.client.protobuf.msg.ClusterClientMessages.Contacts result) {
int from_bitField0_ = bitField0_;
if (((from_bitField0_ & 0x00000001) != 0)) {
contactPoints_.makeImmutable();
result.contactPoints_ = contactPoints_;
}
}

@java.lang.Override
public Builder clone() {
return super.clone();
@@ -466,14 +416,14 @@ public Builder mergeFrom(org.apache.pekko.cluster.client.protobuf.msg.ClusterCli
if (!other.contactPoints_.isEmpty()) {
if (contactPoints_.isEmpty()) {
contactPoints_ = other.contactPoints_;
bitField0_ = (bitField0_ & ~0x00000001);
bitField0_ |= 0x00000001;
} else {
ensureContactPointsIsMutable();
contactPoints_.addAll(other.contactPoints_);
}
onChanged();
}
this.mergeUnknownFields(other.unknownFields);
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
}
@@ -488,35 +438,56 @@ public Builder mergeFrom(
org.apache.pekko.protobufv3.internal.CodedInputStream input,
org.apache.pekko.protobufv3.internal.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
org.apache.pekko.cluster.client.protobuf.msg.ClusterClientMessages.Contacts parsedMessage = null;
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
org.apache.pekko.protobufv3.internal.ByteString bs = input.readBytes();
ensureContactPointsIsMutable();
contactPoints_.add(bs);
break;
} // case 10
default: {
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
}
break;
} // default:
} // switch (tag)
} // while (!done)
} catch (org.apache.pekko.protobufv3.internal.InvalidProtocolBufferException e) {
parsedMessage = (org.apache.pekko.cluster.client.protobuf.msg.ClusterClientMessages.Contacts) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
onChanged();
} // finally
return this;
}
private int bitField0_;

private org.apache.pekko.protobufv3.internal.LazyStringList contactPoints_ = org.apache.pekko.protobufv3.internal.LazyStringArrayList.emptyList();
private org.apache.pekko.protobufv3.internal.LazyStringArrayList contactPoints_ =
org.apache.pekko.protobufv3.internal.LazyStringArrayList.emptyList();
private void ensureContactPointsIsMutable() {
if (!((bitField0_ & 0x00000001) != 0)) {
if (!contactPoints_.isModifiable()) {
contactPoints_ = new org.apache.pekko.protobufv3.internal.LazyStringArrayList(contactPoints_);
bitField0_ |= 0x00000001;
}
}
bitField0_ |= 0x00000001;
}
/**
* <code>repeated string contactPoints = 1;</code>
* @return A list containing the contactPoints.
*/
public org.apache.pekko.protobufv3.internal.ProtocolStringList
getContactPointsList() {
return contactPoints_.getUnmodifiableView();
contactPoints_.makeImmutable();
return contactPoints_;
}
/**
* <code>repeated string contactPoints = 1;</code>
@@ -550,11 +521,10 @@ public java.lang.String getContactPoints(int index) {
*/
public Builder setContactPoints(
int index, java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
ensureContactPointsIsMutable();
if (value == null) { throw new NullPointerException(); }
ensureContactPointsIsMutable();
contactPoints_.set(index, value);
bitField0_ |= 0x00000001;
onChanged();
return this;
}
@@ -565,11 +535,10 @@ public Builder setContactPoints(
*/
public Builder addContactPoints(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
ensureContactPointsIsMutable();
if (value == null) { throw new NullPointerException(); }
ensureContactPointsIsMutable();
contactPoints_.add(value);
bitField0_ |= 0x00000001;
onChanged();
return this;
}
@@ -583,6 +552,7 @@ public Builder addAllContactPoints(
ensureContactPointsIsMutable();
org.apache.pekko.protobufv3.internal.AbstractMessageLite.Builder.addAll(
values, contactPoints_);
bitField0_ |= 0x00000001;
onChanged();
return this;
}
@@ -591,8 +561,9 @@ public Builder addAllContactPoints(
* @return This builder for chaining.
*/
public Builder clearContactPoints() {
contactPoints_ = org.apache.pekko.protobufv3.internal.LazyStringArrayList.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
contactPoints_ =
org.apache.pekko.protobufv3.internal.LazyStringArrayList.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);;
onChanged();
return this;
}
@@ -603,11 +574,10 @@ public Builder clearContactPoints() {
*/
public Builder addContactPointsBytes(
org.apache.pekko.protobufv3.internal.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
ensureContactPointsIsMutable();
if (value == null) { throw new NullPointerException(); }
ensureContactPointsIsMutable();
contactPoints_.add(value);
bitField0_ |= 0x00000001;
onChanged();
return this;
}
@@ -644,7 +614,18 @@ public Contacts parsePartialFrom(
org.apache.pekko.protobufv3.internal.CodedInputStream input,
org.apache.pekko.protobufv3.internal.ExtensionRegistryLite extensionRegistry)
throws org.apache.pekko.protobufv3.internal.InvalidProtocolBufferException {
return new Contacts(input, extensionRegistry);
Builder builder = newBuilder();
try {
builder.mergeFrom(input, extensionRegistry);
} catch (org.apache.pekko.protobufv3.internal.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(builder.buildPartial());
} catch (org.apache.pekko.protobufv3.internal.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
} catch (java.io.IOException e) {
throw new org.apache.pekko.protobufv3.internal.InvalidProtocolBufferException(e)
.setUnfinishedMessage(builder.buildPartial());
}
return builder.buildPartial();
}
};

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

5,552 changes: 2,621 additions & 2,931 deletions cluster/src/main/java/org/apache/pekko/cluster/protobuf/msg/ClusterMessages.java

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

437 changes: 200 additions & 237 deletions docs/src/main/java/docs/ddata/protobuf/msg/TwoPhaseSetMessages.java

Large diffs are not rendered by default.

210 changes: 97 additions & 113 deletions docs/src/main/java/docs/persistence/proto/FlightAppModels.java

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
@@ -19,8 +19,10 @@ object Dependencies {
import DependencyHelpers._

object Protobuf {
// https://protobuf.dev/support/version-support/
// protobuf-java 3.25 corresponds with protoc 22.x-25.x
val protobufJavaVersion = "3.25.6"
val protocVersion = protobufJavaVersion
val protocVersion = "25.6"
}

lazy val java8CompatVersion = settingKey[String]("The version of scala-java8-compat to use.")
22 changes: 18 additions & 4 deletions project/Protobuf.scala
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ object Protobuf {
"The path that contain additional *.proto files that can be imported.")
lazy val protoc = SettingKey[String]("protobuf-protoc", "The path and name of the protoc executable.")
lazy val protocVersion = SettingKey[String]("protobuf-protoc-version", "The version of the protoc executable.")
lazy val generate = TaskKey[Unit]("protobuf-generate", "Compile the protobuf sources and do all processing.")
lazy val protobufGenerate = TaskKey[Unit]("protobufGenerate", "Compile the protobuf sources and do all processing.")

lazy val settings: Seq[Setting[_]] = Seq(
paths := Seq((Compile / sourceDirectory).value, (Test / sourceDirectory).value).map(_ / "protobuf"),
@@ -41,7 +41,7 @@ object Protobuf {
Compile / unmanagedJars += (LocalProject("protobuf-v3") / Compile / packageBin).value,
protoc := "protoc",
protocVersion := Dependencies.Protobuf.protocVersion,
generate := {
protobufGenerate := {
val sourceDirs = paths.value
val targetDirs = outputPaths.value
val log = streams.value.log
@@ -73,7 +73,20 @@ object Protobuf {
tmp,
dst,
_ => true,
transformFile(
transformFile("""/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* license agreements; and to You under the Apache License, version 2.0:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* This file is part of the Apache Pekko project, which was derived from Akka.
*/
/*
* Copyright (C) 2019-2022 Lightbend Inc. <https://www.lightbend.com>
*/
""",
_.replace("com.google.protobuf", "org.apache.pekko.protobufv3.internal")
// this is the one thing that protobufGenerate doesn't fully qualify and causes
// api doc generation to fail
@@ -174,10 +187,11 @@ object Protobuf {
/**
* Transform a file, line by line.
*/
def transformFile(transform: String => String)(source: File, target: File): Unit = {
def transformFile(header: String, transform: String => String)(source: File, target: File): Unit = {
IO.reader(source) { reader =>
IO.writer(target, "", IO.defaultCharset) { writer =>
val pw = new PrintWriter(writer)
pw.print(header)
IO.foreachLine(reader) { line =>
pw.println(transform(line))
}

Large diffs are not rendered by default.

2,416 changes: 1,126 additions & 1,290 deletions remote/src/main/java/org/apache/pekko/remote/ArteryControlFormats.java

Large diffs are not rendered by default.

2,749 changes: 1,270 additions & 1,479 deletions remote/src/main/java/org/apache/pekko/remote/ContainerFormats.java

Large diffs are not rendered by default.

1,355 changes: 630 additions & 725 deletions remote/src/main/java/org/apache/pekko/remote/SystemMessageFormats.java

Large diffs are not rendered by default.

5,274 changes: 2,477 additions & 2,797 deletions remote/src/main/java/org/apache/pekko/remote/WireFormats.java

Large diffs are not rendered by default.

196 changes: 93 additions & 103 deletions remote/src/test/java/org/apache/pekko/remote/ProtobufProtocol.java

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1,487 changes: 676 additions & 811 deletions stream/src/main/java/org/apache/pekko/stream/StreamRefMessages.java

Large diffs are not rendered by default.

0 comments on commit 91c83dc

Please sign in to comment.