From bcaa7d17944695c4e84d0f686e23833e586bf701 Mon Sep 17 00:00:00 2001 From: "A. Cody Schuffelen" Date: Thu, 9 Jul 2026 15:27:08 -0700 Subject: [PATCH] Enforce buildifier formatting in cuttlefish/bazel/*.bzl Bug: b/532697459 --- base/cvd/cuttlefish/bazel/BUILD.bazel | 10 ++++++++++ base/cvd/cuttlefish/bazel/local.bzl | 1 - base/cvd/cuttlefish/bazel/rules.bzl | 19 ++++++++++++------- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/base/cvd/cuttlefish/bazel/BUILD.bazel b/base/cvd/cuttlefish/bazel/BUILD.bazel index c89de6d45c7..b75d7c41b3b 100644 --- a/base/cvd/cuttlefish/bazel/BUILD.bazel +++ b/base/cvd/cuttlefish/bazel/BUILD.bazel @@ -11,3 +11,13 @@ # 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("//cuttlefish/bazel:rules.bzl", "cf_build_test") + +cf_build_test( + name = "cf_build_test", + srcs = [ + "local.bzl", + "rules.bzl", + ], +) diff --git a/base/cvd/cuttlefish/bazel/local.bzl b/base/cvd/cuttlefish/bazel/local.bzl index 30b00ab7549..f7ad43b151b 100644 --- a/base/cvd/cuttlefish/bazel/local.bzl +++ b/base/cvd/cuttlefish/bazel/local.bzl @@ -28,7 +28,6 @@ def _common_attrs(): } def _local_repository_impl(repository_ctx): - target = repository_ctx.path(repository_ctx.attr.path) for child in target.readdir(): repository_ctx.symlink(child, repository_ctx.path(child.basename)) diff --git a/base/cvd/cuttlefish/bazel/rules.bzl b/base/cvd/cuttlefish/bazel/rules.bzl index ba171834911..250787ce3f2 100644 --- a/base/cvd/cuttlefish/bazel/rules.bzl +++ b/base/cvd/cuttlefish/bazel/rules.bzl @@ -12,6 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. +""" +Macros wrapping executable, library, and test targets that generate linter +invocation targets. +""" + load("@aspect_rules_lint//format:defs.bzl", "format_test") load("@cc_compatibility_proxy//:proxy.bzl", "cc_binary", "cc_library", "cc_test") load("@rules_shell//shell:sh_binary.bzl", "sh_binary") @@ -33,7 +38,7 @@ def _cf_build_test_implementation(name, srcs, **kwargs): buildifier_test( name = name + "_LINT_TEST", srcs = [":" + name + "_LINT_TEST_starlark_files"], - **kwargs, + **kwargs ) cf_build_test = macro( @@ -42,7 +47,7 @@ cf_build_test = macro( "srcs": attr.label_list( configurable = False, default = [], - ) + ), }, implementation = _cf_build_test_implementation, ) @@ -54,7 +59,7 @@ def _cf_cc_binary_implementation(name, clang_format_enabled, clang_tidy_enabled, name = name, copts = (copts or []) + COPTS, linkopts = (linkopts or []) + LINKOPTS, - **kwargs, + **kwargs ) if clang_format_enabled: format_test( @@ -89,7 +94,7 @@ def _cf_cc_library_implementation(name, clang_format_enabled, clang_tidy_enabled cc_library( name = name, copts = (copts or []) + COPTS, - **kwargs, + **kwargs ) if clang_format_enabled: format_test( @@ -127,7 +132,7 @@ def _cf_cc_test_implementation(name, clang_format_enabled, clang_tidy_enabled, c "@googletest//:gtest", "@googletest//:gtest_main", ], - **kwargs, + **kwargs ) if clang_format_enabled: format_test( @@ -159,7 +164,7 @@ cf_cc_test = macro( def _cf_sh_binary_implementation(name, shellcheck_enabled, **kwargs): sh_binary( name = name, - **kwargs, + **kwargs ) if shellcheck_enabled: shellcheck_test( @@ -180,7 +185,7 @@ cf_sh_binary = macro( def _cf_sh_library_implementation(name, shellcheck_enabled, **kwargs): sh_library( name = name, - **kwargs, + **kwargs ) if shellcheck_enabled: shellcheck_test(