-
-
Notifications
You must be signed in to change notification settings - Fork 152
/
types.go
110 lines (82 loc) · 2.23 KB
/
types.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package main
import (
"text/template"
)
// Language represents one directory in this repo
type Language struct {
// Name of the language
Name string
// The display name of the language
DisplayName string
// List of rules
Rules []*Rule
// Additional notes about the language
Notes *template.Template
// Languages that this language depend on
DependsOn []string
// Extra lines for MODULE.bazel for examples etc
ModulePrefixLines string
ModuleSuffixLines string
// Additional CI-specific env vars in the form "K=V"
PresubmitEnvVars map[string]string
// Platforms for which to skip testing this lang
// The special value 'all' will skip app platforms
SkipTestPlatforms []string
// Extra aliases to add to defs.bzl. Stored as alias name -> real name
Aliases map[string]string
// Extra loads to add to defs.bzl. Stored as name -> source file name
ExtraDefs map[string]string
}
type Rule struct {
// Name of the rule
Name string
// Base name of the rule (typically the lang name)
Base string
// Kind of the rule (proto|grpc)
Kind string
// Description
Doc string
// Template for build file
BuildExample *template.Template
// Template for bzl file
Implementation *template.Template
// List of attributes
Attrs []*Attr
// List of plugins
Plugins []string
// Not expected to be functional
Experimental bool
// Additional CI-specific env vars in the form "K=V"
PresubmitEnvVars map[string]string
// Platforms for which to skip testing this rule, overrides language level
// The special value 'all' will skip app platforms
SkipTestPlatforms []string
// If the rule is a test rule
IsTest bool
}
// Flag captures information about a bazel build flag.
type Flag struct {
Category string
Name string
Value string
Description string
}
type Attr struct {
Name string
Type string
Default string
Doc string
Mandatory bool
Providers []string
}
// Templating types
type CommonTemplatingFields struct {
CompileArgsForwardingSnippet string
LibraryArgsForwardingSnippet string
}
var commonTemplatingFields = &CommonTemplatingFields{compileArgsForwardingSnippet, libraryArgsForwardingSnippet}
type RuleTemplatingData struct {
Lang *Language
Rule *Rule
Common *CommonTemplatingFields
}