By popular demand, we'll now be offering separate py_grpc_library and
py_proto_library targets sharing the same interface as within google3.
This change necessitated some modifications to how we pull in our own
Python-level dependencies and how we make those available to those
pulling in our project via Bazel.
There is now a grpc_python_deps() Bazel workspace rule that pulls in the
appropriate dependencies, which should be called from the client
project's WORKSPACE file. A test has been added to the bazel/test/
directory to verify that this behavior works as intended.
It's worth noting that the protobuf repository's usage of Starlark
bind() caused a great deal of trouble in ensuring that we could also
pull in six.
This change also required a change in the way generated proto code is
imported in the channelz and health-check modules, as well as in their
associated tests. We were importing them two different ways, each
relative. This resulted in two different module objects being imported
into the process, which were incompatible. I am not sure exactly what
caused this behavior to begin, as this should have been possible before
this PR. As a workaround, I am simply trying two different absolute
imports and using the one that works. This should function both inside
and outside of Bazel environments.
The Google Benchmark CMake build needs CMake 3.5.1 or newer. CMake 3.5.1
was released May 24, 2016 and is available in Debian stable and Ubuntu
16.04 and 18.04.
A closer reading of the API for getsockopt revealed that we were
depending on an implementation detail of getsockopt on Linux. This
assumption breaks down on MacOS.
getsockopt merely guarantees that it will return on 0 in case of failure
and a value greater than 0 in case of success. There is no guarantee as
to *which* non-zero value you will receive. On Linux, it seems to be 1,
the value which was explicitly set. On MacOS, it seems to be the value
of the FLAG which was set, i.e. 512 for SO_REUSEPORT.
This commit ensures the check we use does not rely on either of these
implementation details.