Skip to content

Commit 2b6fa25

Browse files
committed
Fix test libraries
1 parent d0da380 commit 2b6fa25

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

cc/defs2.bzl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,10 @@ def _add_library(**kwargs):
270270
"//conditions:default": ["treat_warnings_as_errors"],
271271
}) + features
272272

273-
kwargs["tags"] = [LIBRARY, level] + (["portable"] if portable else []) + kwargs.get("tags", [])
274-
kwargs["target_compatible_with"] = kwargs.get("target_compatible_with", [])
273+
is_test_library = "test_library" in kwargs.get("tags", [])
275274

276-
if "test_library" in kwargs["tags"]:
277-
kwargs["tags"].append("test_srcs")
275+
kwargs["tags"] = ["test_srcs" if is_test_library else LIBRARY, level] + (["portable"] if portable else []) + kwargs.get("tags", [])
276+
kwargs["target_compatible_with"] = kwargs.get("target_compatible_with", [])
278277

279278
_create_srcs(**kwargs)
280279
_create_hdrs(**kwargs)
@@ -374,7 +373,7 @@ def _add_test(**kwargs):
374373
if not (type == UNIT or type == INTEGRATION):
375374
fail("The 'type' attribute must be either UNIT or INTEGRATION")
376375

377-
kwargs["tags"] = [BINARY, TEST, level, type, "test_srcs"] + kwargs.get("tags", [])
376+
kwargs["tags"] = [TEST, level, type, "test_srcs"] + kwargs.get("tags", [])
378377

379378
kwargs["target_compatible_with"] = kwargs.get("target_compatible_with", []) + _test_compatible_with()
380379

0 commit comments

Comments
 (0)