bazelbuild / stardoc

Stardoc: Starlark Documentation Generator
Apache License 2.0
107 stars 42 forks source link

Include tags passed into the stardoc macro with auxiliary stardoc targets #245

Closed evan-flynn-apexai closed 1 month ago

evan-flynn-apexai commented 1 month ago

The auxilary targets created within the stardoc macro do not include any tags that are passed into the top-level stardoc macro. It would be nice to allow users who want to specify custom tags to do so and pass them along to the auxiliary targets too.

Something like this is what I had in mind similar to what is done today for the testonly attribute

---
 stardoc/stardoc.bzl | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/stardoc/stardoc.bzl b/stardoc/stardoc.bzl
index 6a3fbe7..a650e56 100644
--- a/stardoc/stardoc.bzl
+++ b/stardoc/stardoc.bzl
@@ -85,6 +85,9 @@ def stardoc(
     if "testonly" in kwargs:
         auxiliary_target_kwargs["testonly"] = kwargs["testonly"]

+    if "tags" in kwargs:
+        auxiliary_target_kwargs["tags"] = kwargs["tags"]
+
     if use_starlark_doc_extract and hasattr(native, "starlark_doc_extract"):
         # Use native.starlark_doc_extract as extractor
         if format == "proto" and Label(name + ".binaryproto") == Label(out):
tetromino commented 1 month ago

Good point! But do note that we already define auxiliary_target_kwargs["tags"] at https://github.com/bazelbuild/stardoc/blob/master/stardoc/stardoc.bzl#L89 - so we want to merge the two lists of tags rather than just set it.

yashathwani commented 1 month ago

Could you please assign the issue to me ? Thankyou

tetromino commented 1 month ago

@yashathwani, if you are interested, you can simply send a PR

yashathwani commented 1 month ago

@tetromino @evan-flynn-apexai I have raised a pull request to address the feature with passing tags from the main stardoc target to the auxiliary targets (#245). Could you please review and merge it if everything looks good? Thank you!

yashathwani commented 1 month ago

@tetromino @evan-flynn-apexai could you please review the pull request