forked from stackb/rules_proto
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjava_plugin.go
More file actions
31 lines (25 loc) · 821 Bytes
/
java_plugin.go
File metadata and controls
31 lines (25 loc) · 821 Bytes
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 (
"path"
"github.com/bazelbuild/bazel-gazelle/label"
"github.com/stackb/rules_proto/pkg/protoc"
)
func init() {
protoc.Plugins().MustRegisterPlugin(&JavaPlugin{})
}
// JavaPlugin implements Plugin for the built-in protoc java plugin.
type JavaPlugin struct{}
// Name implements part of the Plugin interface.
func (p *JavaPlugin) Name() string {
return "builtin:java"
}
// Configure implements part of the Plugin interface.
func (p *JavaPlugin) Configure(ctx *protoc.PluginContext) *protoc.PluginConfiguration {
srcjar := path.Join(ctx.Rel, ctx.ProtoLibrary.BaseName()+".srcjar")
return &protoc.PluginConfiguration{
Label: label.New("build_stack_rules_proto", "plugin/builtin", "java"),
Outputs: []string{srcjar},
Out: srcjar,
Options: ctx.PluginConfig.GetOptions(),
}
}