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

Move clean config option to the top level of generation config #3165

Merged
merged 7 commits into from
Jul 18, 2024

Conversation

oliversun9
Copy link
Contributor

This PR targets branch add-buf-gen-yaml-clean and moves clean to buf.gen.yaml's top level, from the plugin level.

@oliversun9 oliversun9 requested a review from doriable July 17, 2024 19:13
Copy link
Contributor

github-actions bot commented Jul 17, 2024

The latest Buf updates on your PR.

NameStatus
build✅ passed
lint✅ passed
format✅ passed
breaking✅ passed

// Always expect non-fake data, because the existing ".jar" or ".zip"
// file is always replaced by the output. This is the existing and correct
// behavior.
require.True(t, len(data) > 1, "expected non-fake data at %q", fullOutputPath)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Flagging this. It seems the clean option doesn't affect .jar and .zip outputs since they have always been cleaned (the generator rewrites the .jar or .zip file), prior to the --clean flag and clean option.

Comment on lines 487 to 489
// Clean, if set to true, will delete the output directories, zip files, or jar files
// before generation is run.
Clean bool `json:"clean,omitempty" yaml:"clean,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

Since this is at the top level, I think we might need to make the key a little more specific. I know it looks a little longer, but just clean might not be very clear without referring to the docs. Maybe we should name it clean_plugin_outs? ^^"

Copy link
Member

@doriable doriable left a comment

Choose a reason for hiding this comment

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

Had offline discussion, just the config key name change, and then we can merge this into the rest of the buf.gen.yaml changes to review together.

@oliversun9 oliversun9 requested a review from doriable July 18, 2024 16:38
CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Doria Keung <doriable@users.noreply.github.com>
@@ -22,6 +22,9 @@ import (

// GenerateConfig is a generation configuration.
type GenerateConfig interface {
// DeleteOuts is whether to delete the output directories, zip files, or jar files before
// generation is run.
DeleteOuts() bool
Copy link
Member

Choose a reason for hiding this comment

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

Would keep this consistent with the name clean_plugin_outs

@@ -38,6 +41,7 @@ type GenerateConfig interface {

// NewGenerateConfig returns a validated GenerateConfig.
func NewGenerateConfig(
clean bool,
Copy link
Member

Choose a reason for hiding this comment

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

Would name this deletePluginOuts to match the generateConfig structure.

@@ -55,6 +60,7 @@ func NewGenerateConfig(
// *** PRIVATE ***

type generateConfig struct {
deleteOuts bool
Copy link
Member

Choose a reason for hiding this comment

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

Nit: would name this deletePluginOuts

@oliversun9 oliversun9 merged commit bd8b4ee into add-buf-gen-yaml-clean Jul 18, 2024
11 checks passed
@oliversun9 oliversun9 deleted the osun/gen-yaml-global-clean branch July 18, 2024 17:19
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.

2 participants