Skip to content

Commit

Permalink
s/clean_plugin_outs/clean/
Browse files Browse the repository at this point in the history
  • Loading branch information
bufdev committed Aug 1, 2024
1 parent af3bcd4 commit f95f69b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## [Unreleased]

- Add `clean` as a top-level option in `buf.gen.yaml`, matching the `buf generate --clean` flag. If
set to true, this will delete the directories, jar files, or zip files set to `out` for each
plugin.
- Fix git input handling of annotated tags.
- Update `buf registry login` to complete the login flow in the browser by default. This allows
users to login with their browser and have the token automatically provided to the CLI.
Expand All @@ -18,8 +21,6 @@
- Add `buf generate --clean` flag that will delete the directories, jar files, or zip files that the
plugins will write to, prior to generation. Allows cleaning of existing assets without having
to call `rm -rf`.
- Add `clean_plugin_outs` as a top-level option in `buf.gen.yaml`. If set to true, this will delete the directories,
jar files, or zip files set to `out` for each plugin.
- Deprecate `--username` flag on and username prompt on `buf registry login`. A username is no longer
required to log in.
- Add `--list-services` and `--list-methods` flags to `buf curl`, which trigger the command to list
Expand Down
2 changes: 1 addition & 1 deletion private/buf/cmd/buf/command/generate/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ plugins:
_, _ = templateBuilder.WriteString("\n")
}
if cleanOptionInConfig {
templateBuilder.WriteString("clean_plugin_outs: true\n")
templateBuilder.WriteString("clean: true\n")
}
testRunStdoutStderr(
t,
Expand Down
18 changes: 9 additions & 9 deletions private/bufpkg/bufconfig/buf_gen_yaml_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,11 @@ func writeBufGenYAMLFile(writer io.Writer, bufGenYAMLFile BufGenYAMLFile) error
return err
}
externalBufGenYAMLFileV2 := externalBufGenYAMLFileV2{
Version: FileVersionV2.String(),
CleanPluginOuts: bufGenYAMLFile.GenerateConfig().CleanPluginOuts(),
Plugins: externalPluginConfigsV2,
Managed: externalManagedConfigV2,
Inputs: externalInputConfigsV2,
Version: FileVersionV2.String(),
Clean: bufGenYAMLFile.GenerateConfig().CleanPluginOuts(),
Plugins: externalPluginConfigsV2,
Managed: externalManagedConfigV2,
Inputs: externalInputConfigsV2,
}
data, err := encoding.MarshalYAML(&externalBufGenYAMLFileV2)
if err != nil {
Expand Down Expand Up @@ -484,11 +484,11 @@ type externalTypesConfigV1 struct {
type externalBufGenYAMLFileV2 struct {
Version string `json:"version,omitempty" yaml:"version,omitempty"`
Managed externalGenerateManagedConfigV2 `json:"managed,omitempty" yaml:"managed,omitempty"`
// CleanPluginOuts, if set to true, will delete the output directories, zip files, or jar files
// Clean, if set to true, will delete the output directories, zip files, or jar files
// before generation is run.
CleanPluginOuts bool `json:"clean_plugin_outs,omitempty" yaml:"clean_plugin_outs,omitempty"`
Plugins []externalGeneratePluginConfigV2 `json:"plugins,omitempty" yaml:"plugins,omitempty"`
Inputs []externalInputConfigV2 `json:"inputs,omitempty" yaml:"inputs,omitempty"`
Clean bool `json:"clean,omitempty" yaml:"clean,omitempty"`
Plugins []externalGeneratePluginConfigV2 `json:"plugins,omitempty" yaml:"plugins,omitempty"`
Inputs []externalInputConfigV2 `json:"inputs,omitempty" yaml:"inputs,omitempty"`
}

// externalGeneratePluginConfigV2 represents a single plugin config in a v2 buf.gen.yaml file.
Expand Down
4 changes: 2 additions & 2 deletions private/bufpkg/bufconfig/buf_gen_yaml_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ plugins:
t,
// input
`version: v2
clean_plugin_outs: true
clean: true
plugins:
- local: custom-gen-go
out: gen/go
Expand All @@ -115,7 +115,7 @@ plugins:
`,
// expected output
`version: v2
clean_plugin_outs: true
clean: true
plugins:
- local: custom-gen-go
out: gen/go
Expand Down
2 changes: 1 addition & 1 deletion private/bufpkg/bufconfig/generate_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func newGenerateConfigFromExternalFileV2(
return nil, err
}
return &generateConfig{
cleanPluginOuts: externalFile.CleanPluginOuts,
cleanPluginOuts: externalFile.Clean,
managedConfig: managedConfig,
pluginConfigs: pluginConfigs,
}, nil
Expand Down

0 comments on commit f95f69b

Please sign in to comment.