Skip to content

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Aug 19, 2025

Modification:

The code generator imports SwiftProtobuf if the file being generated has a dependency on any of the protos bundled by SwiftProtobuf. This can yield unnecessary imports which may warn if used in conjunction with access levels on imports.

The problem is that the grpc generator checks for dependencies on the FileDescriptor which may include messages defined in the same file as a service. If any of those messages depend on a well known type (WKT) then an import will be added even though the code being generated doesn't include message code.

Modifications:

  • Only include a SwiftProtobuf import if an input or output type for an RPC is a bundled proto.
  • Fix a test where a WKT is used in a message but not as an input/output type for an RPC.

Result:

Fewer warnings

Modification:

The code generator imports SwiftProtobuf if the file being generated has
a dependency on any of the protos bundled by SwiftProtobuf. This can
yield unnecessary imports which may warn if used in conjunction with
access levels on imports.

The problem is that the grpc generator checks for dependencies on the
FileDescriptor which may include messages defined in the same file as a
service. If any of those messages depend on a well known type (WKT) then
an import will be added even though the code being generated doesn't
include message code.

Modifications:

- Only include a SwiftProtobuf import if an input or output type for an
  RPC is a bundled proto.
- Fix a test where a WKT is used in a message but not as an input/output
  type for an RPC.

Result:

Fewer warnings
@glbrntt glbrntt added the 🔨 semver/patch No public API change. label Aug 19, 2025
@glbrntt glbrntt enabled auto-merge (squash) August 19, 2025 14:43
@glbrntt glbrntt merged commit 10b648d into grpc:main Aug 19, 2025
33 of 36 checks passed
@glbrntt glbrntt deleted the avoid-warnings-with-wkts branch August 19, 2025 15:52
dongjoon-hyun added a commit to apache/spark-connect-swift that referenced this pull request Oct 1, 2025
…gen-grpc-swift-2 v2.1.1

### What changes were proposed in this pull request?

This PR aims to regenerate `Spark Connect`-generated Swift source code with `protoc-gen-grpc-swift-2` v2.1.1 from apache/spark@c165355. Previously, it was generated by `2.0.0` from apache/spark@c165355 .
- #205 (2025-06-30)

### Why are the changes needed?

Without changing the Spark protobuf files, this PR only applies code-generation bug fixes including concurrency patches:

- https://formulae.brew.sh/formula/protoc-gen-grpc-swift
  - https://github.com/grpc/grpc-swift-protobuf/releases/tag/2.1.0
      - grpc/grpc-swift-protobuf#77
      - grpc/grpc-swift-protobuf#85
  - https://github.com/grpc/grpc-swift-protobuf/releases/tag/2.1.1
      - grpc/grpc-swift-protobuf#86

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #249 from dongjoon-hyun/SPARK-53774.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants