-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
api: generate c++ grpc stubs #3857
Conversation
Signed-off-by: Ben Plotnick <[email protected]>
@bplotnick can you merge master? There were flake fixes that went in. |
Signed-off-by: Ben Plotnick <[email protected]>
So i forgot to run the api tests (doh) and i think this is going to need a bit more work. The problem is the one I alluded to in the description. Now |
@bplotnick why can't you do the |
@htuch, that seems to make the The reason I didn't go down this route is that i thought I would've had to add the external dep in the same macro as the load. When i tried doing this, I ran into the same problem detailed here: bazelbuild/bazel#1550 My current approach that i'm trying (about to commit) is to move the _com_github_grpc_grpc() macro into the api and then do conditional loading for Btw, I'm still pretty new to Bazel, so please feel free to correct me if my terminology or understanding is wrong. Also, i'm happy to discuss this on Slack if you prefer that 😄 |
Signed-off-by: Ben Plotnick <[email protected]>
Signed-off-by: Ben Plotnick <[email protected]>
Signed-off-by: Ben Plotnick <[email protected]>
Signed-off-by: Ben Plotnick <[email protected]>
@htuch I had another go at this and managed to get it working with the strategy I laid out before (moving the grpc dependency stuff to I pulled I also bumped grpc to Lemme know what you think. |
test/common/network/dns_impl_test.cc
Outdated
// Only expecting a single question. | ||
// Only expecting a single question. | ||
#pragma GCC diagnostic push | ||
#pragma GCC diagnostic ignored "-Wold-style-cast" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this seems pretty ugly. Can we fix the gRPC c-ares BUILD to do something similar to what we did in https://github.com/envoyproxy/envoy/blob/master/ci/prebuilt/BUILD#L9? This handles the includes as system includes IIRC, which avoids Wold-style-cast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure how to get these as -isystem
. I thought that what the grpc cares BUILD does should have done the trick, but apparently not.
api/bazel/repositories.bzl
Outdated
|
||
_com_github_grpc_grpc() | ||
|
||
def _com_github_grpc_grpc(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, what you've done is push a bunch of deps down into api/bazel
, since we can then have a single API related setup Skylark function. This, to me, seems totally reasonable. the downside is we lose some of the nice machinery for managing repository locations that @jmillikin-stripe setup there. Ideally we also port that back into api/bazel
, but that might be too much unrelated work for this PR. @jmillikin-stripe do you have any opinions as Envoy Bazel owner?
Can't we just move or copy the repository_locations stuff into |
@jmillikin-stripe I don't want to expand the scope of this PR so i'll tackle copying the build logic to Do you happen to know a better solution for the |
Does Clang stop warning about old-style casts if you use |
Signed-off-by: Ben Plotnick <[email protected]>
Signed-off-by: Ben Plotnick <[email protected]>
@jmillikin-stripe that seemed to do the trick, thanks! |
Yeah, that works. It's a bit ugly; we have inconsistent treatment of headers in include style. Can you add a TODO to fix this? Also, please at least add a TODO for porting the |
This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Signed-off-by: Ben Plotnick <[email protected]>
Signed-off-by: Ben Plotnick <[email protected]>
@htuch I finally got back to this PR. I added one TODO for porting the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, looks like there is merge conflicts and need to reconcile with #4047.
@@ -1,3 +1,5 @@ | |||
#include <ares.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not a big fan of this; it's inconsistent with the way we treat all other external dependencies, and the user might easily believe its coming from the system vs. the gRPC external dependency. Is there no way we can improve this (@jmillikin-stripe)? If not, we should put comments at each of these include sites to explain what's going on and the nature of this exception..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it'd make sense to use #include <>
style for all external dependencies? The presence of "local"-style includes of external deps is fairly strange for C++ code, and IMO is an unwanted abstraction leak from the build system into the code being built.
@@ -2,7 +2,6 @@ | |||
# target in //ci/prebuilt/BUILD to the underlying build recipe in | |||
# ci/build_container/build_recipes. | |||
TARGET_RECIPES = { | |||
"ares": "cares", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also remove https://github.com/envoyproxy/envoy/blob/master/ci/build_container/build_recipes/cares.sh?
actual = "@com_github_cares_cares//:ares", | ||
) | ||
|
||
if "com_github_cares_cares" not in native.existing_rules(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about the @jmillikin-stripe ask regarding setting up the repository_locations.bzl
infrastructure in api/bazel
as well as in bazel
?
@@ -1,5 +1,6 @@ | |||
GOOGLEAPIS_SHA = "d642131a6e6582fc226caf9893cb7fe7885b3411" # May 23, 2018 | |||
GOGOPROTO_SHA = "1adfc126b41513cc696b209667c8656ea7aac67c" # v1.0.0 | |||
GRPC_SHA = "befc7220cadb963755de86763a04ab6f9dc14200" # v1.13.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
This pull request has been automatically closed because it has not had activity in the last 14 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Signed-off-by: Ben Plotnick [email protected]
Description: Generate c++ grpc stubs
This passes
use_grpc_plugin
topgv_cc_proto_library
, which enables c++ grpc stubs to be generated. There are some necessary binds that need to be done unfortunately. This would be easier if we could doload("@com_github_grpc_grpc//bazel:grpc_deps", "grpc_deps")
, but you can'tload
within a macro. I'm not sure if there's a better way to do this.Note that bazel targets depping the
_cc
targets will also have to add these binds. Generally, they can callgrpc_deps()
as I mentioned before. But perhaps this should go inapi_dependencies
instead so that users can use that?Risk Level: Low
Testing: We've been using this internally for a little while now and it works.