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

[Ruby] Include "descriptor_pb.rb" well-known protobuf rb in repository #9219

Closed

Conversation

lfittl
Copy link
Contributor

@lfittl lfittl commented Nov 13, 2021

Since #8850 there is a hard requirement for descriptor_pb.rb to exist in order for the gem to load. Unfortunately that file only gets created when running rake build.

An installation through bundler where this gem is sourced through the "git" source option won't call the Rakefile at all, causing a LoadError for google/protobuf/descriptor_pb. See also someone running into this problem when testing a different PR: #8420 (comment)

This change fixes this by including the descriptor_pb.rb file directly in the repository. It also adds the other well-known lib/google/*_pb.rb files to the .gitignore list to make it explicit these are not intended to be committed. Afterwards this gem can again be included via a git source, like this:

gem 'google-protobuf', github: 'lfittl/protobuf', branch: 'ruby-support-bundle-git-source', glob: 'ruby/*.gemspec'

This is normally built by the "genproto" task thats triggered as part of
"rake build", but an installation through bundler where this gem is
sourced through the "git" source option won't call the Rakefile at all,
causing a LoadError for google/protobuf/descriptor_pb.
Copy link
Member

@acozzette acozzette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request! This looks good but I think we would need two additional changes before we can accept this:

  1. Add the new file to ruby_EXTRA_DIST around here. This will fix the failing distcheck tests.
  2. Update generate_descriptor_proto.sh to keep descriptor_pb.rb up to date. That script is responsible for updating other checked-in generated code files like this one.

@acozzette
Copy link
Member

@lfittl I'm going to go ahead and close this since it's been a few weeks with no activity, but feel free to comment here if you would like to reopen this.

@acozzette acozzette closed this Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants