make tidy attribute tri-state
Bazel boolean attributes can only support true or false states, but the
clang-tidy logic changes for modules which don't set a specific value.
Therefore, the tidy attribute should really be a tri-state of "true",
"false", or "" (unset).
Test: b test //build/bazel/rules/...
Bug: 268681923
Change-Id: I85fbaa612d175f475757db806cea6c018901fe3e
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index e20cffd..626faed 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -3640,8 +3640,17 @@
ModuleTypeUnderTestFactory: cc.LibraryFactory,
Blueprint: `
cc_library_static {
- name: "foo",
- srcs: ["foo.cpp"],
+ name: "foo",
+ srcs: ["foo.cpp"],
+}
+cc_library_static {
+ name: "foo-no-tidy",
+ srcs: ["foo.cpp"],
+ tidy: false,
+}
+cc_library_static {
+ name: "foo-tidy",
+ srcs: ["foo.cpp"],
tidy: true,
tidy_checks: ["check1", "check2"],
tidy_checks_as_errors: ["check1error", "check2error"],
@@ -3652,7 +3661,16 @@
MakeBazelTarget("cc_library_static", "foo", AttrNameToString{
"local_includes": `["."]`,
"srcs": `["foo.cpp"]`,
- "tidy": `True`,
+ }),
+ MakeBazelTarget("cc_library_static", "foo-no-tidy", AttrNameToString{
+ "local_includes": `["."]`,
+ "srcs": `["foo.cpp"]`,
+ "tidy": `"never"`,
+ }),
+ MakeBazelTarget("cc_library_static", "foo-tidy", AttrNameToString{
+ "local_includes": `["."]`,
+ "srcs": `["foo.cpp"]`,
+ "tidy": `"local"`,
"tidy_checks": `[
"check1",
"check2",