Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(build): Add prostoc_args #577

Merged

Conversation

grippy
Copy link
Contributor

@grippy grippy commented Mar 6, 2021

Motivation

Compiling protobuf v3 files with optional fields requires setting Prost Config.protoc_args.

To enable compiling optional fields, some versions of protoc require the --experimental_allow_proto3_optional flag. This experimental flag was added in Protobuf 3.12. The recent Protobuf 3.15 release implies this flag is no longer required.

However, I have protoc v3.15.5 locally and I still get this error: protoc failed: msg.proto: This file contains proto3 optional fields, but --experimental_allow_proto3_optional was not set..

Solution

This change modifies the Tonic build config to store protoc_args and pass them to the Prost config prior to compiling protos.

Copy link
Member

@LucioFranco LucioFranco left a comment

Choose a reason for hiding this comment

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

Thanks!

@LucioFranco LucioFranco changed the title Tonic Build: Configure Prost protoc_args feat(build): Add prostoc_args Apr 7, 2021
@LucioFranco LucioFranco merged commit 480a794 into hyperium:master Apr 7, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants