diff options
Diffstat (limited to 'src/main/java/com/google')
5 files changed, 17 insertions, 5 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/FileProvider.java b/src/main/java/com/google/devtools/build/lib/analysis/FileProvider.java index b4035c0ba7..9821a836d3 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/FileProvider.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/FileProvider.java @@ -62,7 +62,7 @@ public final class FileProvider implements TransitiveInfoProvider { * <p>Also, some rules may generate artifacts that are not listed here by way of defining other * implicit targets, for example, deploy jars. */ - @SkylarkCallable(name = "files_to_build", doc = "", structField = true) + @SkylarkCallable(name = "files_to_build", documented = false, structField = true) public NestedSet<Artifact> getFilesToBuild() { return filesToBuild; } diff --git a/src/main/java/com/google/devtools/build/lib/packages/Target.java b/src/main/java/com/google/devtools/build/lib/packages/Target.java index ad83dafeed..52c6e8f595 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/Target.java +++ b/src/main/java/com/google/devtools/build/lib/packages/Target.java @@ -35,13 +35,13 @@ public interface Target { /** * Returns the label of this target. (e.g. "//foo:bar") */ - @SkylarkCallable(name = "label", doc = "") + @SkylarkCallable(name = "label", documented = false) Label getLabel(); /** * Returns the name of this rule (relative to its owning package). */ - @SkylarkCallable(name = "name", doc = "") + @SkylarkCallable(name = "name", documented = false) String getName(); /** diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSkylarkCommon.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSkylarkCommon.java index 1211c81237..7bcf8f35ff 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSkylarkCommon.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSkylarkCommon.java @@ -29,7 +29,6 @@ public class AndroidSkylarkCommon { @SkylarkCallable( name = "create_device_broker_info", - doc = "", documented = false, parameters = {@Param(name = "type", type = String.class)} ) diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaRuntimeClasspathProvider.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaRuntimeClasspathProvider.java index ddbaa7a6fc..63fbeedc6d 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaRuntimeClasspathProvider.java +++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaRuntimeClasspathProvider.java @@ -41,7 +41,7 @@ public final class JavaRuntimeClasspathProvider implements TransitiveInfoProvide /** * Returns the artifacts included on the runtime classpath of this binary. */ - @SkylarkCallable(name = "runtime_classpath", doc = "", structField = true) + @SkylarkCallable(name = "runtime_classpath", documented = false, structField = true) public NestedSet<Artifact> getRuntimeClasspath() { return runtimeClasspath; } diff --git a/src/main/java/com/google/devtools/build/lib/skylarkinterface/processor/SkylarkCallableProcessor.java b/src/main/java/com/google/devtools/build/lib/skylarkinterface/processor/SkylarkCallableProcessor.java index a5b242bc81..10a42e4379 100644 --- a/src/main/java/com/google/devtools/build/lib/skylarkinterface/processor/SkylarkCallableProcessor.java +++ b/src/main/java/com/google/devtools/build/lib/skylarkinterface/processor/SkylarkCallableProcessor.java @@ -52,6 +52,9 @@ import javax.tools.Diagnostic; * Each parameter, if explicitly typed, may only use either 'type' or 'allowedTypes', * not both. * </li> + * <li> + * Either the doc string is non-empty, or documented is false. + * </li> * </ul> * * <p>These properties can be relied upon at runtime without additional checks. @@ -91,6 +94,7 @@ public final class SkylarkCallableProcessor extends AbstractProcessor { } try { + verifyDocumented(methodElement, annotation); verifyNotStructFieldWithInvalidExtraParams(methodElement, annotation); verifyParamSemantics(methodElement, annotation); verifyNumberOfParameters(methodElement, annotation); @@ -103,6 +107,15 @@ public final class SkylarkCallableProcessor extends AbstractProcessor { return true; } + private void verifyDocumented(ExecutableElement methodElement, SkylarkCallable annotation) + throws SkylarkCallableProcessorException { + if (annotation.documented() && annotation.doc().isEmpty()) { + throw new SkylarkCallableProcessorException( + methodElement, + "The 'doc' string must be non-empty if 'documented' is true."); + } + } + private void verifyNotStructFieldWithInvalidExtraParams( ExecutableElement methodElement, SkylarkCallable annotation) throws SkylarkCallableProcessorException { |