github.com/stackb/rules_proto@v0.0.0-20240221195024-5428336c51f1/pkg/protoc/plugin.go (about) 1 package protoc 2 3 import ( 4 "github.com/bazelbuild/bazel-gazelle/label" 5 "github.com/bazelbuild/bazel-gazelle/rule" 6 ) 7 8 // Plugin implementations are capable of predicting the sources that are 9 // generated by a particular protoc plugin. 10 type Plugin interface { 11 // Name is the name of the plugin and its associated configuration. 12 Name() string 13 // Configure creates the plugin configuration. If nil is returned, the 14 // plugin should be skipped for the current package/library. 15 Configure(ctx *PluginContext) *PluginConfiguration 16 } 17 18 // PluginOptionsResolver is an optional interface that a plugin can implement. 19 // This works in conjunction with proto_compile for plugins that need to do late 20 // determination of options. Rule is the rule being generated, and from is the 21 // label for that rule. 22 type PluginOptionsResolver interface { 23 ResolvePluginOptions(ctx *PluginConfiguration, r *rule.Rule, from label.Label) []string 24 }