Merge user-defined tags with default tags in stardoc macro (#247)
### Description
This pull request introduces changes to the `stardoc` macro to enhance its functionality by including user-defined tags in auxiliary targets. Previously, auxiliary targets only included default tags, and there was no way to specify additional tags.
### Changes Made
1. **Tag Handling:**
- **Update:** Modified the `stardoc` macro to merge user-defined tags with default tags for auxiliary targets.
- **Default Behavior:** By default, auxiliary targets receive the `["manual"]` tag.
- **User-defined Tags:** If user-defined tags are provided, they are appended to the default tag list.
2. **Code Modifications:**
- **File Updated:** `stardoc/stardoc.bzl`
- **Details:** Added logic to handle the merging of tags in the `stardoc` macro. Ensured that user-defined tags are correctly
combined with default tags before being applied to auxiliary targets.
Fixes #245
diff --git a/stardoc/stardoc.bzl b/stardoc/stardoc.bzl
index fc8825c..7997f37 100644
--- a/stardoc/stardoc.bzl
+++ b/stardoc/stardoc.bzl
@@ -92,6 +92,12 @@
if "testonly" in kwargs:
auxiliary_target_kwargs["testonly"] = kwargs["testonly"]
+ if "tags" in kwargs:
+ user_tags = kwargs["tags"]
+
+ # Merge tags from kwargs without duplicating "manual"
+ auxiliary_target_kwargs["tags"] += [tag for tag in user_tags if tag not in auxiliary_target_kwargs["tags"]]
+
if format == "proto" and Label(name + ".binaryproto") == Label(out):
extractor_is_main_target = True
extractor_name = name