diff options
author | laszlocsomor <laszlocsomor@google.com> | 2017-07-10 15:51:47 +0200 |
---|---|---|
committer | László Csomor <laszlocsomor@google.com> | 2017-07-10 17:44:41 +0200 |
commit | 730594414cf3e45305a945c055484cc69c96f6bb (patch) | |
tree | 59000f9312e255644b87e7f7fbd738a236f353f3 /src/main/java/com/google/devtools/build/lib/cmdline | |
parent | d5930eae8660a1192c8235206f83c28c9bd471a1 (diff) |
Skylark, docs: fix docs of Label.relative(name)
It appeared in the docs that the function had no
argument.
Fixes https://github.com/bazelbuild/bazel/issues/3339
RELNOTES: none
PiperOrigin-RevId: 161388878
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/cmdline')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/cmdline/Label.java | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/cmdline/Label.java b/src/main/java/com/google/devtools/build/lib/cmdline/Label.java index 247ea4d98a..d1dcce76e7 100644 --- a/src/main/java/com/google/devtools/build/lib/cmdline/Label.java +++ b/src/main/java/com/google/devtools/build/lib/cmdline/Label.java @@ -20,6 +20,7 @@ import com.google.devtools.build.lib.cmdline.LabelValidator.BadLabelException; import com.google.devtools.build.lib.concurrent.BlazeInterners; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe; +import com.google.devtools.build.lib.skylarkinterface.Param; import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable; import com.google.devtools.build.lib.skylarkinterface.SkylarkModule; import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory; @@ -440,27 +441,37 @@ public final class Label implements Comparable<Label>, Serializable, SkylarkValu * Resolves a relative or absolute label name. If given name is absolute, then this method calls * {@link #parseAbsolute}. Otherwise, it calls {@link #getLocalTargetLabel}. * - * <p>For example: - * {@code :quux} relative to {@code //foo/bar:baz} is {@code //foo/bar:quux}; + * <p>For example: {@code :quux} relative to {@code //foo/bar:baz} is {@code //foo/bar:quux}; * {@code //wiz:quux} relative to {@code //foo/bar:baz} is {@code //wiz:quux}. * * @param relName the relative label name; must be non-empty. */ - @SkylarkCallable(name = "relative", doc = + @SkylarkCallable( + name = "relative", + doc = "Resolves a label that is either absolute (starts with <code>//</code>) or relative to the" - + " current package. If this label is in a remote repository, the argument will be resolved " - + "relative to that repository. If the argument contains a repository, it will be returned " - + "as-is. Reserved labels will also be returned as-is.<br>" - + "For example:<br>" - + "<pre class=language-python>\n" - + "Label(\"//foo/bar:baz\").relative(\":quux\") == Label(\"//foo/bar:quux\")\n" - + "Label(\"//foo/bar:baz\").relative(\"//wiz:quux\") == Label(\"//wiz:quux\")\n" - + "Label(\"@repo//foo/bar:baz\").relative(\"//wiz:quux\") == Label(\"@repo//wiz:quux\")\n" - + "Label(\"@repo//foo/bar:baz\").relative(\"//visibility:public\") == " - + "Label(\"//visibility:public\")\n" - + "Label(\"@repo//foo/bar:baz\").relative(\"@other//wiz:quux\") == " - + "Label(\"@other//wiz:quux\")\n" - + "</pre>") + + " current package. If this label is in a remote repository, the argument will be " + + " resolved relative to that repository. If the argument contains a repository, it" + + " will be returned as-is. Reserved labels will also be returned as-is.<br>" + + "For example:<br>" + + "<pre class=language-python>\n" + + "Label(\"//foo/bar:baz\").relative(\":quux\") == Label(\"//foo/bar:quux\")\n" + + "Label(\"//foo/bar:baz\").relative(\"//wiz:quux\") == Label(\"//wiz:quux\")\n" + + "Label(\"@repo//foo/bar:baz\").relative(\"//wiz:quux\") == " + + "Label(\"@repo//wiz:quux\")\n" + + "Label(\"@repo//foo/bar:baz\").relative(\"//visibility:public\") == " + + "Label(\"//visibility:public\")\n" + + "Label(\"@repo//foo/bar:baz\").relative(\"@other//wiz:quux\") == " + + "Label(\"@other//wiz:quux\")\n" + + "</pre>", + parameters = { + @Param( + name = "relName", + type = String.class, + doc = "The label that will be resolved relative to this one." + ) + } + ) public Label getRelative(String relName) throws LabelSyntaxException { if (relName.length() == 0) { throw new LabelSyntaxException("empty package-relative label"); |