Skip to content
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

google-protobuf and grpc gems fail #86

Closed
aaliddell opened this issue Feb 14, 2021 · 2 comments · Fixed by #102
Closed

google-protobuf and grpc gems fail #86

aaliddell opened this issue Feb 14, 2021 · 2 comments · Fixed by #102

Comments

@aaliddell
Copy link

When trying to use google-protobuf and grpc gems, the paths created do not match the globs in the generated BUILD.bazel file.

For example, here's the library rule generated for grpc:

ruby_library(
  name = "grpc",
  srcs = glob(
    include = [
      ".bundle/config",
      "lib/ruby/2.7.0/gems/grpc-1.35.0/lib/**/*",
      "lib/ruby/2.7.0/specifications/grpc-1.35.0.gemspec",
      
    ],
    exclude = ["**/* *.*", "**/* */*"],
  ),
  deps = [":google-protobuf", ":googleapis-common-protos-types"],
  includes = ["lib/ruby/2.7.0/gems/grpc-1.35.0/lib"],
)

The glob in the srcs attr does not match any of the files, as both the gem name and contents are possibly incorrect.
In grpc's case, the path is lib/ruby/2.7.0/gems/grpc-1.35.0-x86_64-linux/... and does not contain a 'lib' directory.
In google-protobuf's case, the path is lib/ruby/2.7.0/gems/google-protobuf-3.14.0-x86_64-linux/... and does contain a 'lib' directory.

Therefore, when trying to require 'grpc' it cannot find any files:

/usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- grpc (LoadError)

Context: rules-proto-grpc/rules_proto_grpc#65

@kigster
Copy link
Contributor

kigster commented Jul 8, 2021

This is a known limitation.

When adding gems we were hard coding the lib folder. The PR submitted by @mmizutani should fix it.

@kigster kigster added rule::ruby_bundle work-in-progress This is not yet ready for review labels Jul 8, 2021
@kigster kigster removed the work-in-progress This is not yet ready for review label Jul 9, 2021
@aaliddell
Copy link
Author

Cycling back around to this: grpc still fails to load due to missing a file at etc/roots.pem. It's a pretty odd layout that can be fixed by adding includes = {"grpc": ["etc"]} to the ruby_bundle call, but I dunno if there's a fix you want to do here for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants