This repository has been archived by the owner on Mar 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 345
/
prototool.yaml
190 lines (166 loc) · 7.36 KB
/
prototool.yaml
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# Paths to exclude when searching for Protobuf files.
# These can either be file or directory names.
# If there is a directory name, that directory and all sub-directories will be excluded.
excludes:
- path/to/a
- path/to/b/file.proto
# Protoc directives.
protoc:
# The Protobuf version to use from https://github.com/protocolbuffers/protobuf/releases.
# By default use 3.11.0.
# You probably want to set this to make your builds completely reproducible.
version: 3.11.0
# Additional paths to include with -I to protoc.
# By default, the directory of the config file is included,
# or the current directory if there is no config file.
includes:
- ../../vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis
# If not set, compile will fail if there are unused imports.
# Setting this will ignore unused imports.
allow_unused_imports: true
# Create directives.
create:
# List of mappings from relative directory to base package.
# This affects how packages are generated with create.
packages:
# This means that a file created "foo.proto" in the current directory will have package "bar".
# A file created "a/b/foo.proto" will have package "bar.a.b".
- directory: .
name: bar
# This means that a file created "idl/code.uber/a/b/c.proto" will have package "uber.a.b".
- directory: idl/code.uber
name: uber
# Lint directives.
lint:
# The lint group to use.
# Available groups: "uber1", "uber2", "google", "empty".
# The default group is the "uber1" lint group for backwards compatibility reasons,
# however we recommend using the "uber2" lint group.
# The special group "empty" has no linters, allowing you to manually specify all
# lint rules in lint.rules.add.
# Run prototool lint --list-all-lint-groups to see all available lint groups.
# Run prototool lint --list-lint-group GROUP to list the linters in the given lint group.
group: uber2
# Linter files to ignore.
# These can either be file or directory names.
# If there is a directory name, that directory and all sub-directories will be ignored.
ignores:
- id: RPC_NAMES_CAMEL_CASE
files:
- path/to/foo.proto
- path/to/bar.proto
- id: SYNTAX_PROTO3
files:
- path/to/dir
# Linter rules.
# Run prototool lint --list-all-linters to see all available linters.
# Run prototool lint --list-linters to see the currently configured linters.
rules:
# The specific linters to add.
add:
- ENUM_NAMES_CAMEL_CASE
- ENUM_NAMES_CAPITALIZED
# The specific linters to remove.
remove:
- ENUM_NAMES_CAMEL_CASE
# The path to the file header or the file header content for all Protobuf files.
# If either path or content is set and the FILE_HEADER linter is turned on,
# files will be checked to begin with the given header, and format --fix
# will place this header before the syntax declaration. Note that
# format --fix will delete anything before the syntax declaration
# if this is set.
#
# Set path to use a file's contents for the header. Path must be relative.
# Set content to directly specify the header.
# **Both path and content cannot be set at the same time. They are only done
# so here for example purposes.**
#
# If is_commented is set, this file is assumed to already have comments
# and will be added directly. If is_commented is not set, "// " will be
# added before every line.
file_header:
path: path/to/protobuf_file_header.txt
content: |
//
// Acme, Inc. (c) 2019
//
is_commented: true
# Override the default java_package file option prefix of "com".
# If this is set, this will affect lint, create, and format --fix to use.
# this prefix instead of "com".
java_package_prefix: au.com
# Breaking change detector directives.
break:
# Include beta packages in breaking change detection.
# Beta packages have the form "foo.bar.vMAJORbetaBETA" where MAJOR > 0 and BETA > 0.
# By default, beta packages are ignored.
include_beta: true
# Allow stable packages to depend on beta packages.
# By default, the breaking change detector will error if a stable package
# depends on a breaking package.
# If include_beta is true, this is implicitly set.
allow_beta_deps: true
# Code generation directives.
generate:
# Options that will apply to all plugins of type go and gogo.
go_options:
# The base import path. This should be the go path of the prototool.yaml file.
# This is required if you have any go plugins.
import_path: uber/foo/bar.git/idl/uber
# Extra modifiers to include with Mfile=package.
extra_modifiers:
google/api/annotations.proto: google.golang.org/genproto/googleapis/api/annotations
google/api/http.proto: google.golang.org/genproto/googleapis/api/annotations
# The list of plugins.
plugins:
# The plugin name. This will go to protoc with --name_out, so it either needs
# to be a built-in name (like java), or a plugin name with a binary
# protoc-gen-name.
- name: gogo
# The type, if any. Valid types are go, gogo.
# Use go if your plugin is a standard Golang plugin
# that uses github.com/golang/protobuf imports, use gogo
# if it uses github.com/gogo/protobuf imports. For protoc-gen-go
# use go, For protoc-gen-gogo, protoc-gen-gogoslick, etc, use gogo.
type: gogo
# Extra flags to specify.
# The only flag you will generally set is plugins=grpc for Golang.
# The Mfile=package flags are automatically set.
# ** Otherwise, generally do not set this unless you know what you are doing. **
flags: plugins=grpc
# The path to output generated files to.
# If the directory does not exist, it will be created when running generation.
# This needs to be a relative path.
output: ../../.gen/proto/go
# Optional override for the plugin path. For example, if you set set path to
# /usr/local/bin/gogo_plugin", prototool will add the
# "--plugin=protoc-gen-gogo=/usr/local/bin/gogo_plugin" flag to protoc calls.
# If set to "gogo_plugin", prototool will search your path for "gogo_plugin",.
# and fail if "gogo_plugin" cannot be found.
path: gogo_plugin
- name: yarpc-go
type: gogo
output: ../../.gen/proto/go
- name: grpc-gateway
type: go
output: ../../.gen/proto/go
- name: java
output: ../../.gen/proto/java
# Optional file suffix for plugins that output a single file as opposed
# to writing a set of files to a directory. This is only valid in two
# known cases:
# - For the java plugin, set this to "jar" to produce jars
# https://developers.google.com/protocol-buffers/docs/reference/java-generated#invocation
# - For the descriptor_set plugin, this is required as using descriptor_set
# requires a file to be given instead of a directory.
file_suffix: jar
# descriptor_set is special, and uses the --descriptor_set_out flag on protoc.
# file_suffix is required, and the options include_imports and include_source_info
# can be optionally set to add the flags --include_imports and --include_source-info.
# The include_imports and include_source_info options are not valid for any
# other plugin name.
- name: descriptor_set
output: ../../.gen/proto/descriptor
file_suffix: bin
include_imports: true
include_source_info: true