Improve pkg_tar warning message.
Put the label of the target in the warning message. Without it, it's
hard to figure out which target one should fix.
Change-Id: I694737e80ed74250ea793402443eaf5d2a13d622
PiperOrigin-RevId: 166184377
diff --git a/tools/build_defs/pkg/pkg.bzl b/tools/build_defs/pkg/pkg.bzl
index 70f5739..704e94e 100644
--- a/tools/build_defs/pkg/pkg.bzl
+++ b/tools/build_defs/pkg/pkg.bzl
@@ -193,7 +193,8 @@
if "srcs" not in kwargs:
if "files" in kwargs:
if not hasattr(kwargs["files"], "items"):
- print("pkg_tar: you provided a non dictionary to the `files` attribute. " +
+ label = "%s//%s:%s" % (REPOSITORY_NAME, PACKAGE_NAME, kwargs["name"])
+ print("%s: you provided a non dictionary to the pkg_tar `files` attribute. " % (label,) +
"This attribute was renamed to `srcs`. " +
"Consider renaming it in your BUILD file.")
kwargs["srcs"] = kwargs.pop("files")