bazelbuild / rules_swift

Bazel rules to build Swift on Apple and Linux platforms
Apache License 2.0
309 stars 133 forks source link

Remove direct uses of :protoc binary #1203

Open keith opened 3 months ago

keith commented 3 months ago

https://github.com/bazelbuild/rules_proto/discussions/213

adincebic commented 3 months ago

Hey @keith I am interested in working on this. However I need some guidance since it seems to me that we have much more complicated setup than rules_python and rules_ts. So if you could provide a rough outline what files should I take a look at, that would be nice. I saw that we have protoc_wrapper package which contains direct references to @com_google_protobuf//:protoc. Besides that there is proto package as well.

keith commented 3 months ago

cc @AttilaTheFun who might be able to help here too

I think we need to keep our universal_protoc rule to support shared caches across x86_64 and arm64, so I guess the ideal would be to eliminate that target in the other codepath. and base which binary we use based on the //swift:universal_tools_config flag.

AttilaTheFun commented 3 months ago

@keith @adincebic the new swift_proto_library rules I implemented are fully customizable in terms of the protoc binary and protoc plugins. I needed this capability to use the SwiftProtobuf and grpc-swift dependencies from rules_swift_package_manager instead.

(In fact, you can actually use an entirely custom swift proto compiler like Square's Wire which is not protoc based.)

The new rules were merged into rules_swift 1.X and the old rules were marked as deprecated, and in rules_swift 2.X the old rules were deleted.

You're welcome to replace the default protoc and plugin binaries in the repository.

cc @brentleyjones @luispadron