Skip to content

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Jun 2, 2025

Motivation:

To support incremental migration, v2 has moved to the 'grpc-swift-2' package.

Modifications:

  • Update dependencies
  • Update generated code
  • Re-baseline availability

Result:

Easier to migrate from gRPC Swift 1 to 2

Motivation:

To support incremental migration, v2 has moved to the 'grpc-swift-2' package.

Modifications:

- Update dependencies
- Update generated code
- Re-baseline availability

Result:

Easier to migrate from gRPC Swift 1 to 2
@glbrntt glbrntt added the ⚠️ semver/major Breaks existing public API. label Jun 2, 2025
@@ -36,10 +36,10 @@ protoc_generate_grpc_swift="$bin_path/protoc-gen-grpc-swift"
# - $4 onwards: options to forward to the plugin
function generate_grpc {
local proto=$1
local args=("--plugin=$protoc_generate_grpc_swift" "--proto_path=${2}" "--grpc-swift_out=${3}")
local args=("--plugin=$protoc_generate_grpc_swift" "--proto_path=${2}" "--grpc-swift-2_out=${3}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a real change or a find/replace error?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see a matching change in grpc-swift-protobuf

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a real change. The _out and _opt options to protoc plugins are derived from the name of the protoc plugin, so protoc-gen-grpc-swift-2 has --grpc-swift-2_out and --grpc-swift-2-_opt.

The matching change in grpc-swift-protobuf is here: https://github.com/grpc/grpc-swift-protobuf/blob/df605cde2957657a078eb754ed24f3a0e05d3f54/dev/protos/generate.sh#L29-L42


IIRC you can actually alter the name by doing --plugin=foo=/path/to/protoc-gen-grpc-swift-2 which would allow you to use --foo_opt/--foo_out.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see. That's unfortunate. I think we may have missed some other changes in grpc-swift-protobuf then https://github.com/grpc/grpc-swift-protobuf/blob/df605cde2957657a078eb754ed24f3a0e05d3f54/Plugins/PluginsShared/PluginUtils.swift#L95

This one's okay, it uses the --plugin=name=... trick I mentioned above (also the CI would've caught the failure)

https://github.com/grpc/grpc-swift-protobuf/blob/df605cde2957657a078eb754ed24f3a0e05d3f54/Sources/GRPCProtobuf/Documentation.docc/Articles/Generating-stubs.md?plain=1#L104

Blast. Will fix this one.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


for option in "${@:4}"; do
args+=("--grpc-swift_opt=$option")
args+=("--grpc-swift-2_opt=$option")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@glbrntt glbrntt requested a review from rnro June 2, 2025 13:18
@glbrntt glbrntt merged commit dd34dae into grpc:main Jun 2, 2025
26 checks passed
@glbrntt glbrntt deleted the v2 branch June 2, 2025 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚠️ semver/major Breaks existing public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants