forked from stackb/rules_proto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
proto_compiled_sources.go
54 lines (47 loc) · 1.46 KB
/
proto_compiled_sources.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package protoc
import (
"github.com/bazelbuild/bazel-gazelle/rule"
)
func init() {
Rules().MustRegisterRule("stackb:rules_proto:proto_compiled_sources", &protoCompiledSources{})
}
// protoCompiledSources implements LanguageRule for the 'proto_compiled_sources' rule.
type protoCompiledSources struct{}
// KindInfo implements part of the LanguageRule interface.
func (s *protoCompiledSources) KindInfo() rule.KindInfo {
return rule.KindInfo{
NonEmptyAttrs: map[string]bool{
"srcs": true,
},
MergeableAttrs: map[string]bool{
"srcs": true,
"plugins": true,
"output_mappings": true,
"options": true,
},
SubstituteAttrs: map[string]bool{
"out": true,
},
}
}
// Name implements part of the LanguageRule interface.
func (s *protoCompiledSources) Name() string {
return "proto_compiled_sources"
}
// LoadInfo implements part of the LanguageRule interface.
func (s *protoCompiledSources) LoadInfo() rule.LoadInfo {
return rule.LoadInfo{
Name: "@build_stack_rules_proto//rules:proto_compiled_sources.bzl",
Symbols: []string{"proto_compiled_sources"},
}
}
// ProvideRule implements part of the LanguageRule interface.
func (s *protoCompiledSources) ProvideRule(cfg *LanguageRuleConfig, config *ProtocConfiguration) RuleProvider {
return &protoCompileRule{
kind: "proto_compiled_sources",
nameSuffix: "compiled_sources",
outputsAttrName: "srcs",
config: config,
ruleConfig: cfg,
}
}