Skip to content

Re-generate protobuf files to be compatible with google-protobuf v4.x #10

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

Closed

Conversation

valscion
Copy link
Contributor

@valscion valscion commented Mar 13, 2024

The compiled Ruby files will no longer work with google-protobuf v4.26.0 that has been released March 12, 2024.

The generated outcome is the result of

cd lib/
protoc **/*.proto --ruby_out=.
$ protoc --version
libprotoc 29.3

@valscion

This comment was marked as outdated.

@valscion

This comment was marked as outdated.

@valscion
Copy link
Contributor Author

valscion commented May 7, 2025

Hi @mostlyobvious or others — anything I could do here to get this over the finish line?

We are still stuck to google-protobuf v3.x unless we'd use the code from this branch.

A new major version of protobuf-nested-struct with these changes in would allow us to not use a git dependency here.

Do you want some test coverage or something here?

I've verified that bundle exec rspec still works here.

https://github.com/protocolbuffers/protobuf/releases/tag/v26.0-rc3

The compiled Ruby files will no longer work with google-protobuf v4.26.0
that has been released March 12, 2024.
@valscion valscion force-pushed the compile-protobuf-files-again branch from a172075 to 1e5a5b1 Compare May 7, 2025 06:30
Result of:

```
cd lib/
protoc **/*.proto --ruby_out=.
```
@valscion valscion force-pushed the compile-protobuf-files-again branch from 1e5a5b1 to cd7d1a1 Compare May 7, 2025 06:37
@mostlyobvious
Copy link
Member

@valscion on it today

@valscion
Copy link
Contributor Author

valscion commented May 7, 2025

Let me know if there's anything more you need from me, happy to help ☺️

@valscion
Copy link
Contributor Author

valscion commented May 8, 2025

For what it's worth, it does seem like these changes also worked with the 3.x version of google-protobuf gem. So this change might be backwards-compatible after all.

mostlyobvious added a commit that referenced this pull request May 13, 2025
    $ cd lib/
    $ protoc --version # libprotoc 25.7
    $ protoc **/*.proto --ruby_out=lib/

> The protoc version can be inferred from the Protobuf Ruby minor version number.
> Example: Protobuf Ruby version 3.25.x uses protoc version 25.x.

This generates slightly different code, as the DSL is deprecated and
will be removed in newer protobuf releases.

Reference:
#10 (comment)
https://protobuf.dev/news/2023-04-20/
https://protobuf.dev/support/version-support/
@mostlyobvious
Copy link
Member

Thank you for all the links and research you've done here — it was helpful. I had to remind myself the inner workings of protobuf and their versioning policy.

The last version of google-protobuf 3.x targeted protoc in version 25.7. I've regenerated the Ruby files from .proto using that particular binary version and it already gets rid of the DSL. This DSL seems to be the main breaking change going from protoc 26.x and forward.

I'll release v1.2.0 first that explicitly targets 3.25.x of google-protobuf.

Then continue bumping both: the google-protobuf and protoc versions until the latest avaiable — in separate PRs.

@mostlyobvious
Copy link
Member

mostlyobvious commented May 13, 2025

Released v1.2.0 + v1.2.1

I think at this point it should already work for your use case. I'll revisit what changes (in the gem perspective) in the newer protoc versions later.

@mostlyobvious
Copy link
Member

Since protoc 26 and up until latest protoc 30 the generated code differs only in lack of TypeError rescue and warnings of fallbacks. So there is little need to require the newest proto version, however having at least version 26 is sensible in 2025.

I've rebased your PR , added minimal gem version requirement and will eventually release it as 2.0

@mostlyobvious
Copy link
Member

Released v2.0.0

Let me know how it goes for you!

@valscion valscion deleted the compile-protobuf-files-again branch May 14, 2025 10:18
@valscion
Copy link
Contributor Author

Thank you! These changes should work for us, I don't see why not. I'll let you know once we get to upgrading our protobuf-related dependencies ☺️

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

Successfully merging this pull request may close these issues.

2 participants