'Is there a way in a Bazel macro to get the package that called it?

In a bazel macro I want to get the package name that called it. Is there a way to do this?



Solution 1:[1]

native.package_name() will return the current package name from within a macro, or just package_name() from within a BUILD file.

https://bazel.build/rules/lib/native#package_name

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Matt Mackay