Closed asa closed 4 months ago
How do other projects handle this? I would guess that it must be a common problem that projects run into with Bazel.
Most people vendorize from what I can see (copy the remote project into third_party, change all the includes from <blah/foo.h> to "third_party/blah/foo.h"
There is actually already a hook for this that google is internally using?
https://github.com/google/protobuf/blob/master/src/google/protobuf/compiler/cpp/cpp_file.cc#L315
I modified that file to output the "third_party/protobuf" version and its working for me now. It would of course be nicer to have the bazel external repo handle this case nicely, but alas.
On Fri, Dec 15, 2017 at 10:47 AM, Adam Cozzette notifications@github.com wrote:
How do other projects handle this? I would guess that it must be a common problem that projects run into with Bazel.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/google/protobuf/issues/4051#issuecomment-352081860, or mute the thread https://github.com/notifications/unsubscribe-auth/AAF3meMsHZTGf1k-KJdvqmebKcADKbtLks5tAr69gaJpZM4RCpy3 .
That internal ifdef is kind of hard to explain but I don't think it's exactly doing the vendoring you're thinking of.
The one thing I don't understand is that it seems to me like we must be running into the same problem with both our regular library code and code generated by protoc, since both include headers in a way that searches the system paths (e.g. message_lite.h includes <google/protobuf/stubs/common.h>
). Or does Bazel have some way of handling it well with checked-in code but not with generated code?
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.
This issue is labeled inactive
because the last activity was over 90 days ago.
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.
This issue was closed and archived because there has been no new activity in the 14 days since the inactive
label was added.
using a simple cc_proto_library rule, the resulting pb.h file includes <google/protobuf/stubs/common.h> this starts searching the host filesystem, which had better have the same version of protobuf headers installed or there are problems.
I would expect this include to look like the following to work correctly:
include "external/com_google_protobuf/src/google/protobuf/stubs/common.h"
perhaps the build rule can know its building with bazel and insert this accordingly?