Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use SwiftProtobuf's new CodeGenerator interface #2043

Merged
merged 4 commits into from
Sep 5, 2024

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Sep 3, 2024

Motivation:

SwiftProtobuf 1.27.0 added a new CodeGenerator interface in 1.27.0 and deprecated the old API. This didn't include (non-deprecated) access to the source proto which is required for reflection data, however, this was added in 1.28.0.

Modification:

  • Rename options.swift to Options.swift
  • Rewrite main as GenerateGRPC, the functionality is unchanged but did require a bit of code shuffling. As part of this some global methods became private methods on the new GenerateGRPC struct.
  • Add support for protobuf editions.

Result:

  • Fewer warnings
  • Can use protobuf editions

Motivation:

SwiftProtobuf 1.27.0 added a new `CodeGenerator` interface in 1.27.0 and
deprecated the old API. This didn't include (non-deprecated) access to
the source proto which is required for reflection data, however, this
was added in 1.28.0.

Modification:

- Rename `options.swift` to `Options.swift`
- Rewrite `main` as `GenerateGRPC`, the functionality is unchanged but
  did require a bit of code shuffling. As part of this some global
  methods became private methods on the new `GenerateGRPC` `struct`.
- Add support for protobuf editions.

Result:

- Fewer warnings
- Can use protobuf editions
@glbrntt glbrntt requested a review from gjcairo September 3, 2024 15:30
@glbrntt glbrntt added the semver/patch No public API change. label Sep 3, 2024
@glbrntt glbrntt linked an issue Sep 3, 2024 that may be closed by this pull request
@glbrntt glbrntt enabled auto-merge (squash) September 3, 2024 15:31
@glbrntt glbrntt merged commit 6f396ca into grpc:main Sep 5, 2024
15 of 17 checks passed
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.

Add support for protobuf editions
2 participants