diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 74e19f83..ef92aa45 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -47,6 +47,11 @@ def api_dependencies(): name = "opentelemetry_proto", build_file_content = OPENTELEMETRY_LOGS_BUILD_CONTENT, ) + external_http_archive( + name = "com_github_bufbuild_buf", + build_file_content = BUF_BUILD_CONTENT, + tags = ["manual"], + ) PROMETHEUSMETRICS_BUILD_CONTENT = """ load("@envoy_api//bazel:api_build_system.bzl", "api_cc_py_proto_library") @@ -150,3 +155,17 @@ go_proto_library( visibility = ["//visibility:public"], ) """ + +BUF_BUILD_CONTENT = """ +package( + default_visibility = ["//visibility:public"], +) + +filegroup( + name = "buf", + srcs = [ + "@com_github_bufbuild_buf//:bin/buf", + ], + tags = ["manual"], # buf is downloaded as a linux binary; tagged manual to prevent build for non-linux users +) +""" diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index bb35ff77..49d7997f 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -118,4 +118,16 @@ REPOSITORY_LOCATIONS_SPEC = dict( urls = ["https://github.com/open-telemetry/opentelemetry-proto/archive/v{version}.tar.gz"], use_category = ["api"], ), + com_github_bufbuild_buf = dict( + project_name = "buf", + project_desc = "A new way of working with Protocol Buffers.", # Used for breaking change detection in API protobufs + project_url = "https://buf.build", + version = "0.48.2", + sha256 = "ee0ea6c4a7bbb016d79b056905c0a1f018e7c5e47b37038c993a77b1bc732c0d", + strip_prefix = "buf", + urls = ["https://github.com/bufbuild/buf/releases/download/v{version}/buf-Linux-x86_64.tar.gz"], + release_date = "2021-07-30", + use_category = ["api"], + tags = ["manual"], + ), )