Skip to content

Commit 952d7f7

Browse files
[bazel] Run buildifier on Bazel build files
This is an automated change with the following commands: $ find . -name "BUILD.bazel" -o -name "*.bzl" \ -exec buildifier -lint=fix {} \; * Add missing `load()` statements for things provided by @rules_cc. This is required for Bazel >9. * Sort attributes on build targets. * Add missing trailing commas where applicable.
1 parent a1e9cf0 commit 952d7f7

149 files changed

Lines changed: 272 additions & 77 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bazel/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
12
load("@rules_python//python:defs.bzl", "py_binary")
23

34
package(default_visibility = ["//visibility:public"])

bazel/defs.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
load("@bazel_skylib//rules:write_file.bzl", "write_file")
22
load("@rules_cc//cc:defs.bzl", "cc_library")
3+
load("@rules_cc//cc/common:cc_common.bzl", "cc_common")
4+
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
35

46
def _pico_generate_pio_header_impl(ctx):
57
generated_headers = []

bazel/pico_btstack_make_gatt_header.bzl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cpp_toolchain", "use_cc_toolchain")
2+
load("@rules_cc//cc/common:cc_common.bzl", "cc_common")
3+
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
24

35
def _pico_btstack_make_gatt_header_impl(ctx):
46
cc_toolchain = find_cpp_toolchain(ctx)
@@ -21,7 +23,6 @@ def _pico_btstack_make_gatt_header_impl(ctx):
2123
"-I",
2224
ctx.file._btstack_hdr.dirname,
2325
] + [
24-
2526
],
2627
inputs = [
2728
ctx.file.src,
@@ -37,7 +38,7 @@ def _pico_btstack_make_gatt_header_impl(ctx):
3738

3839
return [
3940
DefaultInfo(files = depset(direct = [out])),
40-
CcInfo(compilation_context = cc_ctx)
41+
CcInfo(compilation_context = cc_ctx),
4142
]
4243

4344
pico_btstack_make_gatt_header = rule(

bazel/toolchain/BUILD.bazel

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ cc_args(
100100
"-Og",
101101
"-g3",
102102
],
103-
})
103+
}),
104104
)
105105

106106
cc_args(
@@ -115,7 +115,7 @@ cc_args(
115115
"-O2",
116116
"-DNDEBUG",
117117
],
118-
})
118+
}),
119119
)
120120

121121
cc_args(
@@ -128,7 +128,7 @@ cc_args(
128128
"//bazel/constraint:pico_compilation_no_fastbuild_args_set": [],
129129
# The conditions default are kept as nothing here, The bazel docs default are -gmlt -Wl,-S.
130130
"//conditions:default": [],
131-
})
131+
}),
132132
)
133133

134134
configurable_toolchain_feature(
@@ -163,7 +163,6 @@ configurable_toolchain_feature(
163163
linkopts = ["-Wl,-z,max-page-size=4096"],
164164
)
165165

166-
167166
cc_feature(
168167
name = "dbg",
169168
args = [":debug_args"],
@@ -203,30 +202,13 @@ _HOST_CPU_CONSTRAINTS = {
203202

204203
[cc_toolchain(
205204
name = "arm_gcc_{}-{}_toolchain_cortex-m".format(host_os, host_cpu),
206-
tool_map = "@arm_gcc_{}-{}//:all_tools".format(host_os, host_cpu),
207205
args = select({
208206
"//bazel/constraint:rp2040": [":cortex-m0"],
209207
"//bazel/constraint:rp2350": [":cortex-m33"],
210208
"//conditions:default": [],
211209
}) + [
212210
":bazel_no_absolute_paths",
213211
],
214-
exec_compatible_with = [
215-
_HOST_CPU_CONSTRAINTS[host_cpu],
216-
_HOST_OS_CONSTRAINTS[host_os],
217-
],
218-
tags = ["manual"], # Don't try to build this in wildcard builds.
219-
known_features = [
220-
"@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features",
221-
"@pico-sdk//bazel/toolchain:dbg",
222-
"@pico-sdk//bazel/toolchain:opt",
223-
"@pico-sdk//bazel/toolchain:fastbuild",
224-
"@pico-sdk//bazel/toolchain:gc_sections",
225-
"@pico-sdk//bazel/toolchain:cxx_no_exceptions",
226-
"@pico-sdk//bazel/toolchain:cxx_no_rtti",
227-
"@pico-sdk//bazel/toolchain:cxx_no_cxa_atexit",
228-
"@pico-sdk//bazel/toolchain:override_max_page_size",
229-
],
230212
enabled_features = [
231213
"@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features",
232214
] + select({
@@ -245,11 +227,27 @@ _HOST_CPU_CONSTRAINTS = {
245227
"//bazel/constraint:pico_use_default_max_page_size_enabled": [],
246228
"//conditions:default": [":override_max_page_size"],
247229
}),
230+
exec_compatible_with = [
231+
_HOST_CPU_CONSTRAINTS[host_cpu],
232+
_HOST_OS_CONSTRAINTS[host_os],
233+
],
234+
known_features = [
235+
"@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features",
236+
"@pico-sdk//bazel/toolchain:dbg",
237+
"@pico-sdk//bazel/toolchain:opt",
238+
"@pico-sdk//bazel/toolchain:fastbuild",
239+
"@pico-sdk//bazel/toolchain:gc_sections",
240+
"@pico-sdk//bazel/toolchain:cxx_no_exceptions",
241+
"@pico-sdk//bazel/toolchain:cxx_no_rtti",
242+
"@pico-sdk//bazel/toolchain:cxx_no_cxa_atexit",
243+
"@pico-sdk//bazel/toolchain:override_max_page_size",
244+
],
245+
tags = ["manual"], # Don't try to build this in wildcard builds.
246+
tool_map = "@arm_gcc_{}-{}//:all_tools".format(host_os, host_cpu),
248247
) for host_os, host_cpu in HOSTS]
249248

250249
[cc_toolchain(
251250
name = "clang_{}-{}_toolchain_cortex-m".format(host_os, host_cpu),
252-
tool_map = "@clang_{}-{}//:all_tools".format(host_os, host_cpu),
253251
args = select({
254252
"//bazel/constraint:rp2040": [
255253
":armv6m-none-eabi",
@@ -264,22 +262,6 @@ _HOST_CPU_CONSTRAINTS = {
264262
":bazel_no_absolute_paths",
265263
":llvm-libc_args",
266264
],
267-
exec_compatible_with = [
268-
_HOST_CPU_CONSTRAINTS[host_cpu],
269-
_HOST_OS_CONSTRAINTS[host_os],
270-
],
271-
tags = ["manual"], # Don't try to build this in wildcard builds.
272-
known_features = [
273-
"@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features",
274-
"@pico-sdk//bazel/toolchain:dbg",
275-
"@pico-sdk//bazel/toolchain:opt",
276-
"@pico-sdk//bazel/toolchain:fastbuild",
277-
"@pico-sdk//bazel/toolchain:gc_sections",
278-
"@pico-sdk//bazel/toolchain:cxx_no_exceptions",
279-
"@pico-sdk//bazel/toolchain:cxx_no_rtti",
280-
"@pico-sdk//bazel/toolchain:cxx_no_cxa_atexit",
281-
"@pico-sdk//bazel/toolchain:override_max_page_size",
282-
],
283265
enabled_features = [
284266
"@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features",
285267
] + select({
@@ -298,6 +280,23 @@ _HOST_CPU_CONSTRAINTS = {
298280
"//bazel/constraint:pico_use_default_max_page_size_enabled": [],
299281
"//conditions:default": [":override_max_page_size"],
300282
}),
283+
exec_compatible_with = [
284+
_HOST_CPU_CONSTRAINTS[host_cpu],
285+
_HOST_OS_CONSTRAINTS[host_os],
286+
],
287+
known_features = [
288+
"@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features",
289+
"@pico-sdk//bazel/toolchain:dbg",
290+
"@pico-sdk//bazel/toolchain:opt",
291+
"@pico-sdk//bazel/toolchain:fastbuild",
292+
"@pico-sdk//bazel/toolchain:gc_sections",
293+
"@pico-sdk//bazel/toolchain:cxx_no_exceptions",
294+
"@pico-sdk//bazel/toolchain:cxx_no_rtti",
295+
"@pico-sdk//bazel/toolchain:cxx_no_cxa_atexit",
296+
"@pico-sdk//bazel/toolchain:override_max_page_size",
297+
],
298+
tags = ["manual"], # Don't try to build this in wildcard builds.
299+
tool_map = "@clang_{}-{}//:all_tools".format(host_os, host_cpu),
301300
) for host_os, host_cpu in HOSTS]
302301

303302
[toolchain(

bazel/toolchain/configurable_feature.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ load("@rules_cc//cc/toolchains:args_list.bzl", "cc_args_list")
33
load("@rules_cc//cc/toolchains:feature.bzl", "cc_feature")
44

55
def configurable_toolchain_feature(name, copts = [], cxxopts = [], linkopts = []):
6-
76
all_args = []
87

98
if copts:

bazel/toolchain/objcopy.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "OBJ_COPY_ACTION_NAME")
22
load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cpp_toolchain", "use_cc_toolchain")
3+
load("@rules_cc//cc/common:cc_common.bzl", "cc_common")
34

45
def _objcopy_to_bin_impl(ctx):
56
cc_toolchain = find_cpp_toolchain(ctx)

bazel/util/label_flag_matches.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""A wrapper that enables a `config_setting` matcher for label_flag flags."""
22

33
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
4-
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain")
54

65
def _match_label_flag_impl(ctx):
76
matches = str(ctx.attr.expected_value.label) == str(ctx.attr.flag.label)

bazel/util/sdk_define.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
2+
load("@rules_cc//cc/common:cc_common.bzl", "cc_common")
3+
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
24

35
def _pico_sdk_define_impl(ctx):
46
val = ctx.attr.from_flag[BuildSettingInfo].value

bazel/util/transition.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ rp2040_bootloader_binary = declare_transtion(
9393
"_allowlist_function_transition": attr.label(
9494
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
9595
),
96-
"_link_extra_libs": attr.label(default = "//bazel:empty_cc_lib"),
96+
"_link_extra_libs": attr.label(default = "//bazel:empty_cc_lib"),
9797
},
9898
flag_overrides = {
9999
# We don't want --custom_malloc to ever apply to the bootloader, so
@@ -104,7 +104,7 @@ rp2040_bootloader_binary = declare_transtion(
104104
# binary via `link_extra_libs`, so we must drop these deps when
105105
# building the bootloader binaries themselves in order to avoid a
106106
# circular dependency.
107-
"@bazel_tools//tools/cpp:link_extra_libs": "_link_extra_libs",
107+
"@bazel_tools//tools/cpp:link_extra_libs": "_link_extra_libs",
108108
},
109109
)
110110

src/boards/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
12
load("//bazel:defs.bzl", "pico_board_config")
23
load("//bazel/util:multiple_choice_flag.bzl", "declare_flag_choices", "flag_choice")
34

0 commit comments

Comments
 (0)