Documentation ¶
Overview ¶
Package bufgen does configuration-based generation.
It is used by the buf generate command.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GenerateOption ¶
type GenerateOption func(*generateOptions)
GenerateOption is an option for Generate.
func GenerateWithBaseOutDirPath ¶
func GenerateWithBaseOutDirPath(baseOutDirPath string) GenerateOption
GenerateWithBaseOutDirPath returns a new GenerateOption that uses the given base directory as the output directory.
The default is to use the current directory.
func GenerateWithDeleteOuts ¶ added in v1.35.0
func GenerateWithDeleteOuts(deleteOuts bool) GenerateOption
GenerateWithDeleteOuts returns a new GenerateOption that results in the output directories, zip files, or jar files being deleted before generation is run.
func GenerateWithIncludeImportsOverride ¶ added in v1.32.0
func GenerateWithIncludeImportsOverride(includeImports bool) GenerateOption
GenerateWithIncludeImportsOverride is a strict override on whether imports are generated. This overrides IncludeImports from the GeneratePluginConfig.
This option has presence, i.e. setting this option to false is not the same as not setting it, as the latter does not override the config.
Note that this does NOT result in the Well-Known Types being generated when set to true, use GenerateWithIncludeWellKnownTypes to include the Well-Known Types.
func GenerateWithIncludeWellKnownTypesOverride ¶ added in v1.32.0
func GenerateWithIncludeWellKnownTypesOverride(includeWellKnownTypes bool) GenerateOption
GenerateWithIncludeWellKnownTypesOverride is a strict override on whether the well known types are generated. This overrides IncludeWKT from the GeneratePluginConfig.
This option has presence, i.e. setting this option to false is not the same as not setting it, as the latter does not override the config.
Setting this option to true has no effect if GenerateWithIncludeImports is not set to true.
type Generator ¶
type Generator interface { // Generate calls the generation logic. // // The config is assumed to be valid. If created by ReadConfig, it will // always be valid. Generate( ctx context.Context, container app.EnvStdioContainer, config bufconfig.GenerateConfig, images []bufimage.Image, options ...GenerateOption, ) error }
Generator generates Protobuf stubs based on configurations.
type Strategy ¶
type Strategy int
Strategy is a generation stategy.
func ParseStrategy ¶
ParseStrategy parses the Strategy.
If the empty string is provided, this is interpreted as StrategyDirectory.