Feature Request: Allow generation of ProtoInfo objects without the checkSourceFilesAreInSamePackage check occurring #10744
Labels
P4
This is either out of scope or we don't have bandwidth to review a PR. (No assignee)
stale
Issues or PRs that are stale (no activity for 30 days)
team-Rules-CPP
Issues for C++ rules
type: feature request
Description of the problem / feature request:
Presently there is no way to bypass the checkSourceFilesAreInSamePackage check during ProtoInfo creation. This differs from other rules that utilize the checkSrcsSamePackage method in RuleContext where one can configure the error to only be a warning.
Feature request: what underlying problem are you trying to solve with this feature?
In a poly-repo environment, Protos generally get created to live with the services that utilize them. To avoid proto package chains, we create a package that contains all the proto files and utilize that to build all packages. This ensures that any illegal chains are avoided, and allows easy access to cross repo protos in a single location. Each repo gets configured to point to a version of the package containing all the protos, allowing complete access of protos across repos easily.
With Bazel this system becomes an issue due to the checkSourceFilesAreInSamePackage check. If we are in repo A and make a change to a proto file (proto 1) that is a dependency of a proto (proto 2) in another repo we need to ensure that that proto 2 is built utilizing the changed proto 1. This isn’t allowed presently without checking in proto 2 to the repo with proto 1 in it. We’d like to avoid that check specifically for this scenario.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Create 3 protos. Proto 3 depends on a message in Proto 2 which depends on a message in Proto 1. Ensure that Proto 2 is in a separate package from Proto 3 and Proto 1 (Proto 3 and 1 should be in the same package).
What operating system are you running Bazel on?
Mac OS X
What's the output of
bazel info release
?release 2.1.0-homebrew
Have you found anything relevant by searching the web?
Discussion around not exposing ProtoInfo in Starlark:
protocolbuffers/protobuf#6163 (comment)
Any other information, logs, or outputs that you want to share?
Initial ideas for options:
If there are other recommendations on how to handle this, we'd love to hear them.
The text was updated successfully, but these errors were encountered: