Skip to content

Conversation

@Ubehebe
Copy link
Contributor

@Ubehebe Ubehebe commented Sep 21, 2017

_path_ignoring_repository munges bazel filesystem paths into proto import paths, in order to pass to protoc -I. Currently, the function assumes that the include's path begins with the bazel workspace root, which can therefore be sheared off the front of the path.

This assumption is incorrect. For an include living in an external repository (say, @com_google_protobuf//:timestamp_proto), the filesystem path is something like
bazel-out/darwin_x86_64/fastbuild/genfiles/external/com_google_protobuf/google/protobuf/timestamp.proto. (See also: http://docs.bazel.build/versions/master/skylark/lib/Label.html#workspace_root.)

This commit changes _path_ignoring_repository to handle this case correctly.

_path_ignoring_repository munges bazel filesystem paths into proto
import paths, in order to pass to protoc -I. Currently, the function
assumes that the include's path begins with the bazel workspace root,
which can therefore be sheared off the front of the path.

This assumption is incorrect. For an include living in an external
repository (say, `@com_google_protobuf//:timestamp_proto`),
the filesystem path is something like
`bazel-out/darwin_x86_64-fastbuild/genfiles/external/com_google_protobuf/google/protobuf/timestamp.proto`.
(See also:
http://docs.bazel.build/versions/master/skylark/lib/Label.html#workspace_root.)
This commit changes _path_ignoring_repository to handle this case correctly.
@grpc-kokoro
Copy link

Thanks for your pull request. The automated tests will run as soon as one of the admins verifies this change is ok for us to run on our infrastructure.

@Ubehebe
Copy link
Contributor Author

Ubehebe commented Sep 21, 2017

I didn't see any test coverage for the Skylark rules, but let me know if you want me to add some.

@ejona86
Copy link
Member

ejona86 commented Sep 21, 2017

okay to test

@ejona86 ejona86 merged commit 131a0ff into grpc:master Sep 21, 2017
@ejona86
Copy link
Member

ejona86 commented Sep 21, 2017

@Ubehebe, thanks!

@lock lock bot locked and limited conversation to collaborators Sep 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants