Fix error when building *_library targets directly
PiperOrigin-RevId: 219133111
diff --git a/src/TulsiGenerator/Bazel/tulsi/tulsi_aspects.bzl b/src/TulsiGenerator/Bazel/tulsi/tulsi_aspects.bzl
index 96f3ad8..77519db 100644
--- a/src/TulsiGenerator/Bazel/tulsi/tulsi_aspects.bzl
+++ b/src/TulsiGenerator/Bazel/tulsi/tulsi_aspects.bzl
@@ -1007,6 +1007,16 @@
]
if len(artifacts) > 0:
artifact = artifacts[0]
+ else:
+ # Special support for *_library targets, which Tulsi allows building at
+ # the top-level.
+ artifacts = [
+ x.path
+ for x in target.files.to_list()
+ if x.extension == "a"
+ ]
+ if len(artifacts) > 0:
+ artifact = artifacts[0]
# Collect generated files for bazel_build.py to copy under Tulsi root.
all_files_depsets = []