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