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

Provide better support for imports at the plugin level #1407

Closed
smaye81 opened this issue Sep 15, 2022 · 2 comments
Closed

Provide better support for imports at the plugin level #1407

smaye81 opened this issue Sep 15, 2022 · 2 comments

Comments

@smaye81
Copy link
Member

smaye81 commented Sep 15, 2022

Currently, the Buf CLI provides options for include-imports and include-wkt, which handles the generation of imports and WKT.

      --include-imports        Also generate all imports except for Well-Known Types.
      --include-wkt            Also generate Well-Known Types. Cannot be set without --include-imports.

However, because this is at the command level, this will be applied to every plugin in buf.gen.yaml, which works fine for some languages (such as JS) but can be problematic for languages such as Go because of how go_package works.

A better approach might be to move these commands inside buf.gen.yaml and scoped to individual plugins. That way, each plugin can be told what files to generate code for independently.

For further context and a real-world example of the difficulties this causes, see connectrpc/connect-es#262.

@smaye81 smaye81 changed the title Provider better support for imports at the plugin level Provide better support for imports at the plugin level Sep 15, 2022
@bufdev
Copy link
Member

bufdev commented Sep 15, 2022

We might want to re-think buf.gen.yaml in a v2 of the config definition. Originally, the motivation was to have buf.gen.yaml be input-independent - all input-related functionality was in flags, all input-independent plugin config was in buf.gen.yaml. This would let you reuse buf.gen.yamls across different inputs.

Real-world usage has not played out this way - most people check a buf.gen.yaml into the root of their repository. Managed mode also blurred the lines. We may want to have an updated buf.gen.yaml that allows inputs to be specified.

@bufdev
Copy link
Member

bufdev commented Jan 14, 2023

Merging this into #1424

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

No branches or pull requests

2 participants