github.com/stackb/rules_proto@v0.0.0-20240221195024-5428336c51f1/pkg/plugin/builtin/ruby_plugin.go (about)

     1  package builtin
     2  
     3  import (
     4  	"github.com/bazelbuild/bazel-gazelle/label"
     5  	"github.com/stackb/rules_proto/pkg/protoc"
     6  )
     7  
     8  func init() {
     9  	protoc.Plugins().MustRegisterPlugin(&RubyPlugin{})
    10  }
    11  
    12  // RubyPlugin implements Plugin for the built-in protoc ruby plugin.
    13  type RubyPlugin struct{}
    14  
    15  // Name implements part of the Plugin interface.
    16  func (p *RubyPlugin) Name() string {
    17  	return "builtin:ruby"
    18  }
    19  
    20  // Configure implements part of the Plugin interface.
    21  func (p *RubyPlugin) Configure(ctx *protoc.PluginContext) *protoc.PluginConfiguration {
    22  	return &protoc.PluginConfiguration{
    23  		Label: label.New("build_stack_rules_proto", "plugin/builtin", "ruby"),
    24  		Outputs: protoc.FlatMapFiles(
    25  			protoc.RelativeFileNameWithExtensions(ctx.Rel, "_pb.rb"),
    26  			protoc.Always,
    27  			ctx.ProtoLibrary.Files()...,
    28  		),
    29  		Options: ctx.PluginConfig.GetOptions(),
    30  	}
    31  }