Document name binding in load()
Fixes
@@ -45,7 +45,9 @@ build_test(name = ...)
</pre>
<p>This will execute the
-
+ <a href="{{ page.version_prefix }}/docs/skylark/index.html">Skylark</a>
+ module <code>tools/build_rules/build_test.bzl</code> and import the symbol
+ <code>build_test</code> in the local environment. This is useful for
<a href="{{ page.version_prefix }}/docs/skylark/index.html">Skylark</a>
module <code>tools/build_rules/build_test.bzl</code> and import the symbol
<code>build_test</code> in the local environment. This is useful for
@@ -53,8 +55,23 @@ build_test(name = ...)
using more arguments, you can load more symbols at once.</p>
<pre class="code">
-load(":build_defs.bzl", "COMPILER_FLAGS", "LINKER_FLAGS")
+load("//tools/build_rules:build_defs.bzl", "COMPILER_FLAGS", "LINKER_FLAGS")
+</pre>
+
+<p>
+ In <code>load()</code> statement, keyword arguments have special meaning.
+ They can be used to import a value from a <code>.bzl</code> file under a new
+ name. For example:
+</p>
+
+<pre class="code">
+load(""//tools/build_rules:build_defs.bzl", BUILD_DEF_COMPILER_FLAGS="COMPILER_FLAGS", "LINKER_FLAGS")
</pre>
+<p>
+This will make <code>COMPILER_FLAGS</code> exported from
+<code>build_defs.bzl</code> available under the name
+<code>BUILD_DEF_COMPILER_FLAGS</code> in the current file.
+</p>
<p>
The label must refer to an existing package. For example, for the above
@@ -68,7 +85,7 @@ load(":build_defs.bzl", "COMPILER_FLAGS", "LINKER_FLAGS")
</p>
<p>
- The <code>load</code> statement still supports the legacy syntax that refers
+ Note: The <code>load</code> statement still supports the legacy syntax that refers
to Skylark modules by their paths and not by their labels. This statement is
equivalent to the first example:
</p>
