Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion examples/bzlmod/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ proto_library(
name = "root_proto",
srcs = [
"file.proto",
"unused.proto",
],
visibility = ["//visibility:public"],
deps = ["@buf_deps//validate:validate_proto"],
Expand Down
57 changes: 19 additions & 38 deletions examples/bzlmod/MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions examples/bzlmod/file.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@
// limitations under the License.

syntax = "proto3";

import "unused.proto";
import "validate/validate.proto";
1 change: 1 addition & 0 deletions examples/unused/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
common --enable_bzlmod --experimental_proto_descriptor_sets_include_source_info
57 changes: 57 additions & 0 deletions examples/unused/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Copyright 2021-2025 Buf Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_buf//buf:defs.bzl", "buf_format", "buf_lint_test")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@gazelle//:def.bzl", "gazelle", "gazelle_binary")

exports_files(
["buf.yaml"],
visibility = ["//visibility:public"],
)

gazelle(
name = "gazelle",
gazelle = ":gazelle-buf",
)

gazelle_binary(
name = "gazelle-buf",
languages = [
"@gazelle//language/proto", # Built-in rule from gazelle for Protos.
# Any languages that depend on Gazelle's proto plugin must come after it.
"@rules_buf//gazelle/buf:buf", # Loads the Buf extension
],
visibility = ["//visibility:public"],
)

proto_library(
name = "root_proto",
srcs = [
"file.proto",
"unused.proto",
],
visibility = ["//visibility:public"],
deps = ["@buf_deps//validate:validate_proto"],
)

buf_lint_test(
name = "root_proto_lint",
config = "//:buf.yaml",
targets = [":root_proto"],
)

buf_format(
name = "buf_format",
)
41 changes: 41 additions & 0 deletions examples/unused/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2021-2025 Buf Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"Bazel dependencies"

bazel_dep(name = "rules_buf", version = "0.0.0", dev_dependency = True)
bazel_dep(name = "gazelle", version = "0.34.0", dev_dependency = True)

bazel_dep(name = "protobuf", version = "29.0", repo_name = "com_google_protobuf")
bazel_dep(name = "rules_proto", version = "7.0.2")

local_path_override(
module_name = "rules_buf",
path = "../..",
)

buf = use_extension("@rules_buf//buf:extensions.bzl", "buf")

# Override the default version of buf
buf.toolchains(version = "v1.47.2")

# See https://buf.build/docs/build-systems/bazel#buf-dependencies
buf.dependency(module = "buf.build/envoyproxy/protoc-gen-validate:eac44469a7af47e7839a7f1f3d7ac004")
buf.dependency(module = "buf.build/acme/petapis:7abdb7802c8f4737a1a23a35ca8266ef")

# Allow references to labels under @buf_deps
use_repo(buf, "buf_deps")

# Allow people to use `bazel run @rules_buf_toolchains//:buf -- --version`
use_repo(buf, "rules_buf_toolchains")
Loading
Loading