Skip to content

Commit a3e242d

Browse files
committed
Invert clang-format default for cuttlefish packages
Change the default of `clang_format_enabled` to `True` in `rules.bzl`. Remove explicit `clang_format_enabled = True` from compliant targets. Set `clang_format_enabled = False` for non-compliant targets across the workspace. Also fix a duplicate header in cvdalloc/BUILD.bazel. Bug: b/512215781 Assisted-by: gemini-next:current
1 parent a094c8e commit a3e242d

87 files changed

Lines changed: 246 additions & 61 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.

base/cvd/allocd/net/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ cf_cc_library(
1414
"netlink_client.h",
1515
"netlink_request.h",
1616
],
17+
clang_format_enabled = False,
1718
deps = [
1819
"//cuttlefish/common/libs/fs",
1920
"@abseil-cpp//absl/log",

base/cvd/cuttlefish/bazel/rules.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def _cf_cc_binary_implementation(name, clang_format_enabled, clang_tidy_enabled,
5050
cf_cc_binary = macro(
5151
inherit_attrs = cc_binary,
5252
attrs = {
53-
"clang_format_enabled": attr.bool(configurable = False, default = False, doc = "Decide if a corresponding format_test target is generated"),
53+
"clang_format_enabled": attr.bool(configurable = False, default = True, doc = "Decide if a corresponding format_test target is generated"),
5454
"clang_tidy_enabled": attr.bool(configurable = False, default = True, doc = "Decide if a corresponding clang_tidy_test target is generated"),
5555
"copts": attr.string_list(configurable = False, default = []),
5656
"linkopts": attr.string_list(configurable = False, default = []),
@@ -85,7 +85,7 @@ def _cf_cc_library_implementation(name, clang_format_enabled, clang_tidy_enabled
8585
cf_cc_library = macro(
8686
inherit_attrs = cc_library,
8787
attrs = {
88-
"clang_format_enabled": attr.bool(configurable = False, default = False, doc = "Decide if a corresponding format_test target is generated"),
88+
"clang_format_enabled": attr.bool(configurable = False, default = True, doc = "Decide if a corresponding format_test target is generated"),
8989
"clang_tidy_enabled": attr.bool(configurable = False, default = True, doc = "Decide if a corresponding clang_tidy_test target is generated"),
9090
"copts": attr.string_list(configurable = False, default = []),
9191
},
@@ -123,7 +123,7 @@ def _cf_cc_test_implementation(name, clang_format_enabled, clang_tidy_enabled, c
123123
cf_cc_test = macro(
124124
inherit_attrs = cc_test,
125125
attrs = {
126-
"clang_format_enabled": attr.bool(configurable = False, default = False, doc = "Decide if a corresponding format_test target is generated"),
126+
"clang_format_enabled": attr.bool(configurable = False, default = True, doc = "Decide if a corresponding format_test target is generated"),
127127
"clang_tidy_enabled": attr.bool(configurable = False, default = True, doc = "Decide if a corresponding clang_tidy_test target is generated"),
128128
"copts": attr.string_list(configurable = False, default = []),
129129
"deps": attr.label_list(configurable = False),

base/cvd/cuttlefish/common/frontend/socket_vsock_proxy/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ cf_cc_binary(
1313
"server.h",
1414
"socket_vsock_proxy.cpp",
1515
],
16+
clang_format_enabled = False,
1617
deps = [
1718
"//cuttlefish/common/libs/fs",
1819
"//cuttlefish/common/libs/utils:contains",

base/cvd/cuttlefish/common/libs/confui/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ cf_cc_library(
2020
"protocol_types.h",
2121
"utils.h",
2222
],
23+
clang_format_enabled = False,
2324
deps = [
2425
"//cuttlefish/common/libs/fs",
2526
"//cuttlefish/common/libs/utils:contains",

base/cvd/cuttlefish/common/libs/fs/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ cf_cc_library(
2828
"shared_fd.h",
2929
"shared_select.h",
3030
],
31+
clang_format_enabled = False,
3132
linkopts = select({
3233
"@platforms//os:linux": ["-lrt"],
3334
"//conditions:default": [],
@@ -48,6 +49,7 @@ cf_cc_test(
4849
srcs = [
4950
"shared_fd_test.cpp",
5051
],
52+
clang_format_enabled = False,
5153
deps = [
5254
":fs",
5355
"//libbase",
@@ -58,6 +60,7 @@ cf_cc_library(
5860
name = "shared_fd_stream",
5961
srcs = ["shared_fd_stream.cpp"],
6062
hdrs = ["shared_fd_stream.h"],
63+
clang_format_enabled = False,
6164
deps = [
6265
"//cuttlefish/common/libs/fs",
6366
],

base/cvd/cuttlefish/common/libs/key_equals_value/BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ cf_cc_library(
1010
name = "key_equals_value",
1111
srcs = ["key_equals_value.cc"],
1212
hdrs = ["key_equals_value.h"],
13-
clang_format_enabled = True,
1413
deps = [
1514
"//cuttlefish/common/libs/fs",
1615
"//cuttlefish/common/libs/utils:contains",
@@ -22,7 +21,6 @@ cf_cc_library(
2221
cf_cc_test(
2322
name = "key_equals_value_test",
2423
srcs = ["key_equals_value_test.cc"],
25-
clang_format_enabled = True,
2624
deps = [
2725
"//cuttlefish/common/libs/key_equals_value",
2826
"//cuttlefish/result",

base/cvd/cuttlefish/common/libs/transport/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ cf_cc_library(
1414
"channel.h",
1515
"channel_sharedfd.h",
1616
],
17-
clang_format_enabled = True,
1817
deps = [
1918
"//cuttlefish/common/libs/fs",
2019
"//cuttlefish/result",

base/cvd/cuttlefish/common/libs/utils/BUILD.bazel

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ cf_cc_library(
88
name = "archive",
99
srcs = ["archive.cpp"],
1010
hdrs = ["archive.h"],
11+
clang_format_enabled = False,
1112
deps = [
1213
"//cuttlefish/common/libs/utils:subprocess",
1314
"//cuttlefish/common/libs/utils:subprocess_managed_stdio",
@@ -32,6 +33,7 @@ cf_cc_library(
3233
cf_cc_test(
3334
name = "base64_test",
3435
srcs = ["base64_test.cpp"],
36+
clang_format_enabled = False,
3537
deps = [
3638
"//cuttlefish/common/libs/utils:base64",
3739
"//cuttlefish/result:result_matchers",
@@ -72,6 +74,7 @@ cf_cc_library(
7274
name = "disk_usage",
7375
srcs = ["disk_usage.cpp"],
7476
hdrs = ["disk_usage.h"],
77+
clang_format_enabled = False,
7578
deps = [
7679
"//cuttlefish/common/libs/utils:subprocess",
7780
"//cuttlefish/common/libs/utils:subprocess_managed_stdio",
@@ -109,6 +112,7 @@ cf_cc_library(
109112
name = "files",
110113
srcs = ["files.cpp"],
111114
hdrs = ["files.h"],
115+
clang_format_enabled = False,
112116
target_compatible_with = [
113117
"@platforms//os:linux", # SEEK_DATA
114118
],
@@ -176,6 +180,7 @@ cf_cc_library(
176180
name = "host_info",
177181
srcs = ["host_info.cpp"],
178182
hdrs = ["host_info.h"],
183+
clang_format_enabled = False,
179184
deps = [
180185
"//libbase",
181186
"@abseil-cpp//absl/base:no_destructor",
@@ -227,6 +232,7 @@ cf_cc_library(
227232
name = "network",
228233
srcs = ["network.cpp"],
229234
hdrs = ["network.h"],
235+
clang_format_enabled = False,
230236
deps = [
231237
"//cuttlefish/common/libs/utils:files",
232238
"//cuttlefish/common/libs/utils:subprocess",
@@ -288,6 +294,7 @@ cf_cc_library(
288294
hdrs = [
289295
"random.h",
290296
],
297+
clang_format_enabled = False,
291298
)
292299

293300
cf_cc_library(
@@ -315,6 +322,7 @@ cf_cc_library(
315322
name = "signals",
316323
srcs = ["signals.cpp"],
317324
hdrs = ["signals.h"],
325+
clang_format_enabled = False,
318326
deps = [
319327
"//libbase",
320328
"@abseil-cpp//absl/log:check",
@@ -330,6 +338,7 @@ cf_cc_library(
330338
name = "socket2socket_proxy",
331339
srcs = ["socket2socket_proxy.cpp"],
332340
hdrs = ["socket2socket_proxy.h"],
341+
clang_format_enabled = False,
333342
target_compatible_with = [
334343
"@platforms//os:linux",
335344
],
@@ -360,6 +369,7 @@ cf_cc_library(
360369
name = "subprocess_managed_stdio",
361370
srcs = ["subprocess_managed_stdio.cc"],
362371
hdrs = ["subprocess_managed_stdio.h"],
372+
clang_format_enabled = False,
363373
deps = [
364374
"//cuttlefish/common/libs/fs",
365375
"//cuttlefish/common/libs/utils:subprocess",
@@ -373,6 +383,7 @@ cf_cc_library(
373383
name = "tee_logging",
374384
srcs = ["tee_logging.cpp"],
375385
hdrs = ["tee_logging.h"],
386+
clang_format_enabled = False,
376387
deps = [
377388
"//cuttlefish/common/libs/fs",
378389
"//cuttlefish/common/libs/utils:contains",
@@ -438,6 +449,7 @@ cf_cc_library(
438449
name = "users",
439450
srcs = ["users.cpp"],
440451
hdrs = ["users.h"],
452+
clang_format_enabled = False,
441453
deps = [
442454
"//cuttlefish/common/libs/utils:contains",
443455
"//cuttlefish/result",
@@ -450,6 +462,7 @@ cf_cc_library(
450462
name = "vsock_connection",
451463
srcs = ["vsock_connection.cpp"],
452464
hdrs = ["vsock_connection.h"],
465+
clang_format_enabled = False,
453466
clang_tidy_enabled = False, # TODO: b/403278821 - fix warnings and re-enable after migration work
454467
target_compatible_with = [
455468
"@platforms//os:linux",
@@ -479,6 +492,7 @@ cf_cc_library(
479492
name = "wait_for_unix_socket",
480493
srcs = ["wait_for_unix_socket.cpp"],
481494
hdrs = ["wait_for_unix_socket.h"],
495+
clang_format_enabled = False,
482496
deps = [
483497
"//cuttlefish/common/libs/utils:files",
484498
"//cuttlefish/common/libs/utils:subprocess",

base/cvd/cuttlefish/flag_parser/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ cf_cc_library(
88
name = "flag_parser",
99
srcs = ["flag_parser.cpp"],
1010
hdrs = ["flag_parser.h"],
11+
clang_format_enabled = False,
1112
deps = [
1213
"//cuttlefish/result",
1314
"//libbase",
@@ -21,6 +22,7 @@ cf_cc_library(
2122
cf_cc_test(
2223
name = "flag_parser_test",
2324
srcs = ["flag_parser_test.cpp"],
25+
clang_format_enabled = False,
2426
# `layering_check` conflicts with the combination of the clang prebuilt and
2527
# the cmake build rules used for @libxml2.
2628
features = ["-layering_check"],

base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ cf_cc_library(
1010
name = "alloc",
1111
srcs = ["alloc.cc"],
1212
hdrs = ["alloc.h"],
13+
clang_format_enabled = False,
1314
deps = [
1415
"//cuttlefish/common/libs/fs",
1516
"//cuttlefish/host/commands/cvdalloc:interface",
@@ -23,6 +24,7 @@ cf_cc_library(
2324
cf_cc_binary(
2425
name = "assemble_cvd",
2526
srcs = ["assemble_cvd.cc"],
27+
clang_format_enabled = False,
2628
deps = [
2729
"//cuttlefish/common/libs/fs",
2830
"//cuttlefish/common/libs/utils:contains",
@@ -85,6 +87,7 @@ cf_cc_library(
8587
name = "boot_config",
8688
srcs = ["boot_config.cc"],
8789
hdrs = ["boot_config.h"],
90+
clang_format_enabled = False,
8891
deps = [
8992
"//cuttlefish/common/libs/utils:files",
9093
"//cuttlefish/common/libs/utils:size_utils",
@@ -109,6 +112,7 @@ cf_cc_library(
109112
name = "boot_image_utils",
110113
srcs = ["boot_image_utils.cc"],
111114
hdrs = ["boot_image_utils.h"],
115+
clang_format_enabled = False,
112116
deps = [
113117
"//cuttlefish/common/libs/fs",
114118
"//cuttlefish/common/libs/utils:files",
@@ -145,6 +149,7 @@ cf_cc_library(
145149
name = "bootconfig_args",
146150
srcs = ["bootconfig_args.cpp"],
147151
hdrs = ["bootconfig_args.h"],
152+
clang_format_enabled = False,
148153
deps = [
149154
"//cuttlefish/common/libs/utils:contains",
150155
"//cuttlefish/common/libs/utils:json",
@@ -162,6 +167,7 @@ cf_cc_library(
162167
name = "clean",
163168
srcs = ["clean.cc"],
164169
hdrs = ["clean.h"],
170+
clang_format_enabled = False,
165171
deps = [
166172
"//cuttlefish/common/libs/utils:files",
167173
"//cuttlefish/common/libs/utils:in_sandbox",
@@ -250,6 +256,7 @@ cf_cc_library(
250256
name = "disk_image_flags_vectorization",
251257
srcs = ["disk_image_flags_vectorization.cc"],
252258
hdrs = ["disk_image_flags_vectorization.h"],
259+
clang_format_enabled = False,
253260
deps = [
254261
"//cuttlefish/host/commands/assemble_cvd:assemble_cvd_flags",
255262
"//cuttlefish/host/commands/assemble_cvd:super_image_mixer",
@@ -274,6 +281,7 @@ cf_cc_library(
274281
name = "display",
275282
srcs = ["display.cpp"],
276283
hdrs = ["display.h"],
284+
clang_format_enabled = False,
277285
deps = [
278286
"//cuttlefish/flag_parser",
279287
"//cuttlefish/host/libs/config:config_flag",
@@ -290,6 +298,7 @@ cf_cc_library(
290298
name = "flag_feature",
291299
srcs = ["flag_feature.cpp"],
292300
hdrs = ["flag_feature.h"],
301+
clang_format_enabled = False,
293302
deps = [
294303
"//cuttlefish/host/libs/config:config_flag",
295304
"//cuttlefish/host/libs/feature",
@@ -304,6 +313,7 @@ cf_cc_library(
304313
name = "flags",
305314
srcs = ["flags.cc"],
306315
hdrs = ["flags.h"],
316+
clang_format_enabled = False,
307317
deps = [
308318
"//cuttlefish/common/libs/utils:base64",
309319
"//cuttlefish/common/libs/utils:container",
@@ -388,6 +398,7 @@ cf_cc_library(
388398
name = "guest_config",
389399
srcs = ["guest_config.cc"],
390400
hdrs = ["guest_config.h"],
401+
clang_format_enabled = False,
391402
deps = [
392403
"//cuttlefish/common/libs/key_equals_value",
393404
"//cuttlefish/common/libs/utils:device_type",
@@ -421,6 +432,7 @@ cf_cc_library(
421432
name = "graphics_flags",
422433
srcs = ["graphics_flags.cc"],
423434
hdrs = ["graphics_flags.h"],
435+
clang_format_enabled = False,
424436
deps = [
425437
"//cuttlefish/common/libs/utils:contains",
426438
"//cuttlefish/common/libs/utils:files",
@@ -507,6 +519,7 @@ cf_cc_library(
507519
name = "misc_info",
508520
srcs = ["misc_info.cc"],
509521
hdrs = ["misc_info.h"],
522+
clang_format_enabled = False,
510523
deps = [
511524
"//cuttlefish/common/libs/fs",
512525
"//cuttlefish/common/libs/utils:contains",
@@ -548,6 +561,7 @@ cf_cc_library(
548561
name = "resolve_instance_files",
549562
srcs = ["resolve_instance_files.cc"],
550563
hdrs = ["resolve_instance_files.h"],
564+
clang_format_enabled = False,
551565
deps = [
552566
"//cuttlefish/host/commands/assemble_cvd:assemble_cvd_flags",
553567
"//cuttlefish/host/commands/assemble_cvd/flags:boot_image",
@@ -568,6 +582,7 @@ cf_cc_library(
568582
name = "super_image_mixer",
569583
srcs = ["super_image_mixer.cc"],
570584
hdrs = ["super_image_mixer.h"],
585+
clang_format_enabled = False,
571586
deps = [
572587
"//cuttlefish/common/libs/key_equals_value",
573588
"//cuttlefish/common/libs/utils:archive",
@@ -592,6 +607,7 @@ cf_cc_library(
592607
name = "touchpad",
593608
srcs = ["touchpad.cpp"],
594609
hdrs = ["touchpad.h"],
610+
clang_format_enabled = False,
595611
deps = [
596612
"//cuttlefish/flag_parser",
597613
"//cuttlefish/host/libs/config:config_flag",
@@ -607,6 +623,7 @@ cf_cc_library(
607623
name = "vendor_dlkm_utils",
608624
srcs = ["vendor_dlkm_utils.cc"],
609625
hdrs = ["vendor_dlkm_utils.h"],
626+
clang_format_enabled = False,
610627
deps = [
611628
"//cuttlefish/common/libs/fs",
612629
"//cuttlefish/common/libs/utils:contains",
@@ -636,6 +653,7 @@ cf_cc_library(
636653
hdrs = [
637654
"assemble_cvd_flags.h",
638655
],
656+
clang_format_enabled = False,
639657
deps = [
640658
"//cuttlefish/common/libs/utils:environment",
641659
"//cuttlefish/host/commands/assemble_cvd:flags_defaults",
@@ -652,6 +670,7 @@ cf_cc_library(
652670
name = "media",
653671
srcs = ["media.cpp"],
654672
hdrs = ["media.h"],
673+
clang_format_enabled = False,
655674
deps = [
656675
"//cuttlefish/flag_parser",
657676
"//cuttlefish/host/libs/config:config_flag",

0 commit comments

Comments
 (0)