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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose protoc-gen-grpc-swift as a gRPC generator #711

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

crockeo
Copy link

@crockeo crockeo commented Nov 5, 2021

Up until now rules_swift only exposed protoc-gen-swiftgrpc, the 0.x gRPC generated for Swift. This PR adds support for the 1.x gRPC generator, protoc-gen-grpc-swift. protoc-gen-grpc-swift generates code that depends on GPRC and NIO, so most of the code in this PR is setting up builds for GRPC and NIO. Not sure if this needs to live in rules_swift, but it's good enough for now 馃檪

Some remaining todos:

  • Audit all of the additional builds to ensure they have their required dependencies (cross-reference w/ upstream builds)
  • Create builds for CNIOWindows and CNIOLinux
  • Fix issue where generated .grpc.swift files can't compile because they don't import their accompanying .pb.swift
  • Only compile the relevant set of support libraries (SwiftGRPC for swiftgrpc, GRPC/NIO for grpc-swift)

@google-cla
Copy link

google-cla bot commented Nov 5, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

馃摑 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

鈩癸笍 Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no label Nov 5, 2021
@crockeo
Copy link
Author

crockeo commented Nov 6, 2021

@googlebot I signed it!

@google-cla google-cla bot added cla: yes and removed cla: no labels Nov 6, 2021
Comment on lines +267 to +275
# grpc-swift depends on SwiftProtobuf to determine which modules need to be imported
# into the generated .grpc.swift file for the generated .gRPC.swift file
#
# SwiftProtobuf explicitly disallows the current .proto file's module name
# but when generating the .grpc.swift and .pb.swift files to different locations
# one MUST import the current .proto file's module name
if ctx.attr.protoc_plugin_name == "grpc-swift":
proto_module_name = deps[0][SwiftInfo].direct_modules[0].name
extra_module_imports.append(proto_module_name)
Copy link
Author

Choose a reason for hiding this comment

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

this seems like a hack that i don't want to commit to rules_swift. we should have a better way to determine if we want to exclude the current module or not, but that involves at least two upstream tickets (against grpc-swift and swift-protobuf).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant