Skip to content

Commit 1d99ad3

Browse files
committed
repo: Add buf linting
initially just for unused imports Fix #45 Signed-off-by: Ryan Northey <[email protected]>
1 parent 1e77728 commit 1d99ad3

File tree

5 files changed

+50
-0
lines changed

5 files changed

+50
-0
lines changed

bazel/repositories.bzl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ def xds_api_dependencies():
66
"bazel_gazelle",
77
locations = REPOSITORY_LOCATIONS,
88
)
9+
xds_http_archive(
10+
"com_github_bufbuild_buf",
11+
locations = REPOSITORY_LOCATIONS,
12+
build_file_content = BUF_BUILD_CONTENT,
13+
tags = ["manual"],
14+
)
915
xds_http_archive(
1016
"com_envoyproxy_protoc_gen_validate",
1117
locations = REPOSITORY_LOCATIONS,
@@ -31,3 +37,16 @@ def xds_api_dependencies():
3137
# TODO(roth): Remove once all callers are updated to use the new name.
3238
def udpa_api_dependencies():
3339
xds_api_dependencies()
40+
41+
BUF_BUILD_CONTENT = """
42+
package(
43+
default_visibility = ["//visibility:public"],
44+
)
45+
46+
filegroup(
47+
name = "buf",
48+
srcs = [
49+
"@com_github_bufbuild_buf//:bin/buf",
50+
],
51+
)
52+
"""

bazel/repository_locations.bzl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ REPOSITORY_LOCATIONS = dict(
77
sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
88
urls = ["https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz"],
99
),
10+
com_github_bufbuild_buf = dict(
11+
sha256 = "826ad701db09805eb425723ad3ea0c13ce7ca8353d6a1fb473399db915dafdf9",
12+
strip_prefix = "buf",
13+
urls = ["https://github.com/bufbuild/buf/releases/download/v1.4.0/buf-Linux-x86_64.tar.gz"],
14+
),
1015
com_envoyproxy_protoc_gen_validate = dict(
1116
sha256 = "c695fc5a2e5a1b52904cd8a58ce7a1c3a80f7f50719496fd606e551685c01101",
1217
strip_prefix = "protoc-gen-validate-0.6.1",

buf.lock

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Generated by buf. DO NOT EDIT.
2+
version: v1
3+
deps:
4+
- remote: buf.build
5+
owner: envoyproxy
6+
repository: protoc-gen-validate
7+
commit: dc09a417d27241f7b069feae2cd74a0e
8+
- remote: buf.build
9+
owner: gogo
10+
repository: protobuf
11+
commit: 4df00b267f944190a229ce3695781e99
12+
- remote: buf.build
13+
owner: googleapis
14+
repository: googleapis
15+
commit: d1a849b8f8304950832335723096e954

buf.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: v1
2+
deps:
3+
- buf.build/envoyproxy/protoc-gen-validate
4+
- buf.build/googleapis/googleapis:d1a849b8f8304950832335723096e954
5+
- buf.build/gogo/protobuf
6+
lint:
7+
use:
8+
- IMPORT_USED

ci/check.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
set -e
44

5+
bazel run @com_github_bufbuild_buf//:bin/buf lint -- --path xds
6+
bazel run @com_github_bufbuild_buf//:bin/buf lint -- --path udpa
7+
58
bazel test --config=ci //...
69

710
rm -rf go/xds go/udpa

0 commit comments

Comments
 (0)