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

Add neoeinstein-prost-crate v0.3.1 plugin #609

Merged
merged 5 commits into from
Jun 22, 2023
Merged

Conversation

cobbinma
Copy link
Contributor

add neoeinstein-prost-crate to community plugins

Closes #608

add neoeinstein-prost-crate to community plugins to generate include file in rust projects
@CLAassistant
Copy link

CLAassistant commented Jun 21, 2023

CLA assistant check
All committers have signed the CLA.

@pkwarren
Copy link
Member

Thanks @cobbinma for the contribution. We previously discussed the prost-crate plugin here: #96 (comment)

It relies on accessing files which aren't available to remote plugins, so it would need to be used with no_features to work as a remote plugin. At the time of getting the other prost plugins working, we opted to skip this one as it most likely won't work as expected. In order to gain full control over all of the plugin's features, you'd want to execute it as a local plugin as described here: https://github.com/neoeinstein/protoc-gen-prost/tree/main/protoc-gen-prost-crate#usage-with-buf

@cobbinma
Copy link
Contributor Author

Thanks @pkwarren.

As I only need the features that can be run remotely, can the plugin be added so that we can use it with no_features?

I am currently using it this way and would like to keep doing so:

  - remote: buf.build/prost/plugins/crate:v0.3.1-1
    out: autogen/lang/rust
    opt:
      - no_features

@mfridman
Copy link
Member

As I only need the features that can be run remotely, can the plugin be added so that we can use it with no_features?

Although this works for some use cases, it's also not something we can easily test. I.e., all plugins in this repository are run through at least 1 module and the output is committed as a sum file. We would have to special case this plugin and trust it "just works" without any validation.

Furthermore, no_features is not the default, so if users are running this plugin remotely it'll fail and lead to surprising behaviour. This leads to a bit of a maintenance burden for us.

I'm hesitant to add this plugin unless it has sane default behaviour and can be tested.

@cobbinma
Copy link
Contributor Author

@mfridman I have added go sum files and a plugins test override, similar to the other rust plugins.

I agree with your comments and think it is unfortunate no_features is not the default behaviour.

The repository does have documentation on why the gen_crate option doesn't work with buf remotely and what options do work.

https://github.com/neoeinstein/protoc-gen-prost/tree/main/protoc-gen-prost-crate#usage-with-buf

@pkwarren
Copy link
Member

@cobbinma - Is this plugin functional on its own without specifying any options? We set no_include on prost-serde and tonic just for the purposes of our testing in this repo (which runs each plugin individually), however the plugins are functional with the default options.

@@ -55,6 +55,7 @@ exec docker run --log-driver=none --rm -i {{.ImageName}}:{{.Version}} "$@"
// these plugins until the tests are updated to support running all plugin dependencies in sequence.
testOverrideOptions = map[string][]string{
"buf.build/community/neoeinstein-prost-serde": {"no_include"},
"buf.build/community/neoeinstein-prost-crate": {"no_features"},
Copy link
Member

Choose a reason for hiding this comment

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

nit: Can you move this up one line to keep these plugin names sorted?

@cobbinma
Copy link
Contributor Author

@cobbinma - Is this plugin functional on its own without specifying any options? We set no_include on prost-serde and tonic just for the purposes of our testing in this repo (which runs each plugin individually), however the plugins are functional with the default options.

@pkwarren
According to the usage with buf documentation it should be, but it returns an error for me when running without options.

❯ buf generate --include-imports
WARN    Plugin "buf.build/prost/crate" is deprecated
Failure: plugin buf.build/prost/plugins/crate:v0.3.1-1: Cargo.toml: does not exist

@pkwarren pkwarren merged commit 3f8280f into bufbuild:main Jun 22, 2023
3 checks passed
@cobbinma cobbinma deleted the issue/608 branch June 22, 2023 15:35
@maoueh
Copy link

maoueh commented Jun 22, 2023

Really cool, is it usable right now or there is some wait on Buf side?

@pkwarren
Copy link
Member

pkwarren commented Jun 22, 2023

Really cool, is it usable right now or there is some wait on Buf side?

It is available now and ready for use: https://buf.build/community/neoeinstein-prost-crate

There are limitations as documented here: https://github.com/neoeinstein/protoc-gen-prost/blob/main/protoc-gen-prost-crate/README.md. In particular, remote plugins don't have access to arbitrary files from the filesystem, so the gen_crate option isn't supported.

@maoueh
Copy link

maoueh commented Jun 22, 2023

Yep I'm aware thanks, I'm using it in the way it works.

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

Successfully merging this pull request may close these issues.

Plugin request for Buf Schema Registry: protoc-gen-prost-crate
5 participants