From 286f1e9839f34efc910ce49f040bac23716f8520 Mon Sep 17 00:00:00 2001 From: laurentlb Date: Wed, 19 Jul 2017 14:53:15 +0200 Subject: [PATCH] Mark PACKAGE_NAME and REPOSITORY_NAME as deprecated. RELNOTES: None. PiperOrigin-RevId: 162475651 --- site/docs/skylark/macros.md | 2 +- .../java/com/google/devtools/build/lib/syntax/Runtime.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/site/docs/skylark/macros.md b/site/docs/skylark/macros.md index 77821982875586..b8a2dc56517917 100644 --- a/site/docs/skylark/macros.md +++ b/site/docs/skylark/macros.md @@ -24,7 +24,7 @@ def my_macro(name, visibility=None): ``` If you need to know the package name (i.e. which BUILD file is calling the -macro), use the constant [PACKAGE_NAME](lib/globals.html#PACKAGE_NAME). +macro), use the function [native.package_name()](lib/native.html#package_name). ## Examples diff --git a/src/main/java/com/google/devtools/build/lib/syntax/Runtime.java b/src/main/java/com/google/devtools/build/lib/syntax/Runtime.java index 4c2b10dea8b634..4b5230b8bdcf77 100644 --- a/src/main/java/com/google/devtools/build/lib/syntax/Runtime.java +++ b/src/main/java/com/google/devtools/build/lib/syntax/Runtime.java @@ -97,7 +97,8 @@ public void repr(SkylarkPrinter printer) { public static final NoneType NONE = new NoneType(); @SkylarkSignature(name = "PACKAGE_NAME", returnType = String.class, - doc = "The name of the package being evaluated. " + doc = "Deprecated. Use package_name() " + + "instead. The name of the package being evaluated. " + "For example, in the BUILD file some/package/BUILD, its value " + "will be some/package. " + "If the BUILD file calls a function defined in a .bzl file, PACKAGE_NAME will " @@ -117,7 +118,8 @@ public void repr(SkylarkPrinter printer) { public static final String PKG_NAME = "PACKAGE_NAME"; @SkylarkSignature(name = "REPOSITORY_NAME", returnType = String.class, - doc = "The name of the repository the rule or build extension is called from. " + doc = "Deprecated. Use repository_name() " + + "instead. The name of the repository the rule or build extension is called from. " + "For example, in packages that are called into existence by the WORKSPACE stanza " + "local_repository(name='local', path=...) it will be set to " + "@local. In packages in the main repository, it will be empty. "