Skip to content

Commit bf712cc

Browse files
protobuf-github-botcomius
authored andcommitted
Run buildifier
Adds missing loads for Java rules. Remove unused loads. Some other minor fixes. PiperOrigin-RevId: 728701378
1 parent 4f4ac6a commit bf712cc

File tree

25 files changed

+29
-26
lines changed

25 files changed

+29
-26
lines changed

BUILD.bazel

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
44
load("@rules_license//rules:license.bzl", "license")
5-
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
65
load("//bazel:cc_proto_library.bzl", "cc_proto_library")
76
load("//bazel:java_lite_proto_library.bzl", "java_lite_proto_library")
87
load("//bazel:java_proto_library.bzl", "java_proto_library")

bazel/java_lite_proto_library.bzl

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ def java_lite_proto_library(**kwattrs):
1313
if not hasattr(native, "java_lite_proto_library"):
1414
_java_lite_proto_library(**kwattrs)
1515
else:
16-
native.java_lite_proto_library(**kwattrs)
16+
native.java_lite_proto_library(**kwattrs) # buildifier: disable=native-java-lite-proto

bazel/java_proto_library.bzl

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ def java_proto_library(**kwattrs):
1313
if not hasattr(native, "java_proto_library"):
1414
_java_proto_library(**kwattrs)
1515
else:
16-
native.java_proto_library(**kwattrs)
16+
native.java_proto_library(**kwattrs) # buildifier: disable=native-java-proto

bazel/private/toolchains/BUILD.bazel

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
load("//bazel/toolchains:proto_lang_toolchain.bzl", "proto_lang_toolchain")
21
load("//bazel/toolchains:proto_toolchain.bzl", "proto_toolchain")
32

43
# Keep this file as small as possible and free of any unnecessary loads

bazel/proto_library.bzl

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ def proto_library(**kwattrs):
1717
_proto_library(**kwattrs)
1818
else:
1919
# On older Bazel versions keep using native rules, so that mismatch in ProtoInfo doesn't happen
20-
native.proto_library(**kwattrs)
20+
native.proto_library(**kwattrs) # buildifier: disable=native-proto

bazel/toolchains/proto_lang_toolchain.bzl

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def proto_lang_toolchain(*, name, toolchain_type = None, exec_compatible_with =
3535
_proto_lang_toolchain_rule(name = name, **attrs)
3636
else:
3737
# On older Bazel versions keep using native rules, so that mismatch in ProtoInfo doesn't happen
38-
native.proto_lang_toolchain(name = name, **attrs)
38+
native.proto_lang_toolchain(name = name, **attrs) # buildifier: disable=native-proto-lang-toolchain
3939

4040
if toolchain_type:
4141
native.toolchain(

compatibility/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
load("@rules_buf//buf:defs.bzl", "buf_breaking_test")
2+
load("@rules_java//java:java_library.bzl", "java_library")
23

34
# Simple build tests for compatibility of gencode from previous major versions
45
# with the current runtime.

conformance/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# Conformance testing for Protobuf.
99

1010
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "objc_library")
11+
load("@rules_java//java:java_binary.bzl", "java_binary")
1112
load(
1213
"@rules_pkg//pkg:mappings.bzl",
1314
"pkg_filegroup",

conformance/test_protos/BUILD.bazel

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
load("@rules_cc//cc:defs.bzl", "objc_library")
21
load("//:protobuf.bzl", "internal_csharp_proto_library", "internal_objc_proto_library", "internal_py_proto_library")
32
load("//bazel:cc_proto_library.bzl", "cc_proto_library")
43
load("//bazel:java_lite_proto_library.bzl", "java_lite_proto_library")

editions/BUILD

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ load("//bazel:cc_proto_library.bzl", "cc_proto_library")
44
load("//bazel:java_lite_proto_library.bzl", "java_lite_proto_library")
55
load("//bazel:java_proto_library.bzl", "java_proto_library")
66
load("//bazel:proto_library.bzl", "proto_library")
7-
load("//bazel:py_proto_library.bzl", "py_proto_library")
87
load("//bazel:upb_proto_library.bzl", "upb_c_proto_library", "upb_proto_reflection_library")
98
load(":defaults.bzl", "compile_edition_defaults", "embed_edition_defaults")
109

examples/BUILD.bazel

+2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
# example.
66

77
load("@bazel_skylib//rules:build_test.bzl", "build_test")
8+
load("@com_google_protobuf//bazel:cc_proto_library.bzl", "cc_proto_library")
89
load("@com_google_protobuf//bazel:java_lite_proto_library.bzl", "java_lite_proto_library")
910
load("@com_google_protobuf//bazel:java_proto_library.bzl", "java_proto_library")
1011
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
1112
load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library")
1213
load("@rules_cc//cc:defs.bzl", "cc_binary")
14+
load("@rules_java//java:java_binary.bzl", "java_binary")
1315
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
1416
load("@rules_python//python:py_binary.bzl", "py_binary")
1517

java/internal/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@rules_java//java:java_test.bzl", "java_test")
12
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
23

34
package(default_visibility = ["//java:__subpackages__"])

java/kotlin-lite/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@rules_java//java:java_test.bzl", "java_test")
12
load("@rules_jvm_external//:kt_defs.bzl", "kt_jvm_export")
23
load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")
34
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")

java/kotlin/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@rules_java//java:java_test.bzl", "java_test")
12
load("@rules_jvm_external//:kt_defs.bzl", "kt_jvm_export")
23
load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")
34
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")

java/lite/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
load("@bazel_skylib//rules:build_test.bzl", "build_test")
2-
load("@rules_pkg//pkg:mappings.bzl", "pkg_filegroup", "pkg_files", "strip_prefix")
2+
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
33
load("//bazel/toolchains:proto_lang_toolchain.bzl", "proto_lang_toolchain")
44
load("//conformance:defs.bzl", "conformance_test")
55
load("//java/internal:testing.bzl", "junit_tests")

java/util/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@rules_java//java:java_library.bzl", "java_library")
12
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
23
load("//:protobuf_version.bzl", "PROTOBUF_JAVA_VERSION")
34
load("//bazel:java_proto_library.bzl", "java_proto_library")

lua/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# license that can be found in the LICENSE file or at
66
# https://developers.google.com/open-source/licenses/bsd
77

8+
load("//bazel:proto_library.bzl", "proto_library")
89
load(
910
"//lua:lua_proto_library.bzl",
1011
"lua_proto_library",

protobuf.bzl

+7-7
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,21 @@ def _proto_gen_impl(ctx):
8989
if source_dir:
9090
has_sources = any([src.is_source for src in srcs])
9191
if has_sources:
92-
import_flags += ["-I" + source_dir]
92+
import_flags.append("-I" + source_dir)
9393
else:
94-
import_flags += ["-I."]
94+
import_flags.append("-I.")
9595

9696
has_generated = any([not src.is_source for src in srcs])
9797
if has_generated:
98-
import_flags += ["-I" + gen_dir]
98+
import_flags.append("-I" + gen_dir)
9999

100100
if ctx.attr.includes:
101101
for include in ctx.attr.includes:
102102
if include == ".":
103103
# This is effectively source_dir, which has already been handled,
104104
# and may be generated incorrectly here.
105105
continue
106-
import_flags += ["-I" + _GetPath(ctx, include)]
106+
import_flags.append("-I" + _GetPath(ctx, include))
107107

108108
import_flags = depset(direct = import_flags)
109109

@@ -160,7 +160,7 @@ def _proto_gen_impl(ctx):
160160
outs.extend(_RubyOuts([src.basename]))
161161

162162
# Otherwise, rely on user-supplied outs.
163-
args += [("--%s_out=" + path_tpl) % (lang, gen_dir)]
163+
args.append(("--%s_out=" + path_tpl) % (lang, gen_dir))
164164

165165
if ctx.attr.outs:
166166
outs.extend(ctx.attr.outs)
@@ -181,8 +181,8 @@ def _proto_gen_impl(ctx):
181181

182182
if ctx.attr.plugin_options:
183183
outdir = ",".join(ctx.attr.plugin_options) + ":" + outdir
184-
args += [("--plugin=protoc-gen-%s=" + path_tpl) % (lang, plugin.path)]
185-
args += ["--%s_out=%s" % (lang, outdir)]
184+
args.append(("--plugin=protoc-gen-%s=" + path_tpl) % (lang, plugin.path))
185+
args.append("--%s_out=%s" % (lang, outdir))
186186
tools.append(plugin)
187187

188188
if not in_gen_dir:

python/BUILD.bazel

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
load("@bazel_skylib//lib:selects.bzl", "selects")
99
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "string_flag")
10-
load("@rules_pkg//pkg:mappings.bzl", "pkg_files")
1110
load("//python:build_targets.bzl", "build_targets")
1211
load("//python:py_extension.bzl", "py_extension")
1312
load("//upb/bazel:build_defs.bzl", "UPB_DEFAULT_COPTS")

ruby/lib/google/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@rules_java//java:java_binary.bzl", "java_binary")
12
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
23
load("@rules_ruby//ruby:defs.bzl", "ruby_library")
34

rust/BUILD

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
44
load("@rules_pkg//pkg:mappings.bzl", "pkg_filegroup", "pkg_files", "strip_prefix")
55
load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")
66
load("//bazel/toolchains:proto_lang_toolchain.bzl", "proto_lang_toolchain")
7-
load("//rust:dist.bzl", "pkg_cross_compiled_binaries")
87

98
licenses(["notice"])
109

rust/defs.bzl

+6
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ def _rust_proto_library_impl(ctx):
8989
dep = deps[0]
9090
rust_proto_info = dep[RustProtoInfo]
9191

92+
proto_common.check_collocated(
93+
ctx.label,
94+
dep[ProtoInfo],
95+
ctx.attr._proto_lang_toolchain[proto_common.ProtoLangToolchainInfo],
96+
)
97+
9298
if len(rust_proto_info.dep_variant_infos) != 1:
9399
fail(
94100
"{}: rust_proto_library does not support src-less proto_library targets."

rust/test/cpp/interop/BUILD

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
load("@rules_rust//rust:defs.bzl", "rust_test")
44
load("//bazel:cc_proto_library.bzl", "cc_proto_library")
5+
load("//bazel:proto_library.bzl", "proto_library")
56
load(
67
"//rust:defs.bzl",
78
"rust_cc_proto_library",

upb/bazel/BUILD

-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
load("@bazel_skylib//lib:selects.bzl", "selects")
99
load("@rules_python//python:defs.bzl", "py_binary")
1010

11-
package(default_applicable_licenses = ["//:license"])
12-
13-
licenses(["notice"])
14-
1511
py_binary(
1612
name = "amalgamate",
1713
srcs = ["amalgamate.py"],

upb/cmake/BUILD.bazel

-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
# https://developers.google.com/open-source/licenses/bsd
77

88
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
9-
load(
10-
"//upb/bazel:build_defs.bzl",
11-
"make_shell_script",
12-
)
139
load(
1410
":build_defs.bzl",
1511
"staleness_test",

0 commit comments

Comments
 (0)