Skip to content

Add parameters option for protoc opts#54

Merged
kzys merged 1 commit intocontainerd:mainfrom
dmcgowan:add-parameter-support
Jul 1, 2022
Merged

Add parameters option for protoc opts#54
kzys merged 1 commit intocontainerd:mainfrom
dmcgowan:add-parameter-support

Conversation

@dmcgowan
Copy link
Member

@dmcgowan dmcgowan commented May 5, 2022

Adds support for custom parameters to be passed to the protoc generators.

This is part of an effort to generate ttrpc services alongside existing grpc services. A custom parameter will be added to the ttrpc generator which allows prefixing the TTRPC service names when they are generated.

Configuration would look something like...

[parameters.go-ttrpc]
prefix = "TTRPC"

@kzys
Copy link
Member

kzys commented Jun 22, 2022

@samuelkarp Does it make sense to support source_relative by having this change?

@kzys
Copy link
Member

kzys commented Jun 22, 2022

I'd like to use TOML's key/value pairs like

[go-ttrpc]
prefix = "TTRPC"

rather than introducing go-ttrpc:prefix syntax. Not really sure the place to have this configuration though.

Would it be something people would configure per prefixes, like https://github.com/containerd/containerd/blob/0fac756b645275aa855f3d5ab7d1dfd74fadc1ed/Protobuild.toml#L16?

@dmcgowan
Copy link
Member Author

@kzys I like that, I'm not quite sure how to achieve that though with the library

@dmcgowan dmcgowan force-pushed the add-parameter-support branch from a8820f0 to 77e5d18 Compare June 24, 2022 21:07
@dmcgowan
Copy link
Member Author

Updated. The parameters key has to stay but they can be specified like

[parameters.go-ttrpc]
prefix = "TTRPC"

or

[overrides.parameters.go-ttrpc]
prefix = "TTRPC"

Copy link
Member

@kzys kzys left a comment

Choose a reason for hiding this comment

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

Looks good!

@samuelkarp Can you take a look? Would it cover the source_relative use case? I believe it does.

Adds support for custom parameters to be passed to the protoc
generators.

Signed-off-by: Derek McGowan <[email protected]>
@dmcgowan dmcgowan force-pushed the add-parameter-support branch from 77e5d18 to 6d693b6 Compare June 25, 2022 00:56
@dmcgowan
Copy link
Member Author

@kzys I confirmed this could be used to add the option, but would still need logic to handle the go path accordingly and I found another issue with relative includes. This would allow implementation though without adding a new configuration option since the parameter for the go generator could be checked for directly.

@kzys kzys merged commit 14832cc into containerd:main Jul 1, 2022
@samuelkarp
Copy link
Member

@kzys Almost; there's still an issue with the go_out generation though.

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

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants