diff options
author | 2018-06-21 12:21:58 -0700 | |
---|---|---|
committer | 2018-06-21 12:23:15 -0700 | |
commit | 6ab3a075f528ec759bebe9b14c9a16a021f0dc4a (patch) | |
tree | 2ac2a907a16c5aa0cebb2fae1942a1356e06f471 /src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaCommonApi.java | |
parent | 1a025f53f85c70323a3657b692ed9394f6efe721 (diff) |
Remove several uses of @SkylarkCallable.mandatoryPositionals
mandatoryPositionals is going away soon. While it is less verbose than the alternative, it does not allow for documentation to be specified (nor type-checking), and is thus inferior to the alternative. Killing mandatoryPositionals will also make the interpreter code cleaner.
RELNOTES: None.
PiperOrigin-RevId: 201566377
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaCommonApi.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaCommonApi.java | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaCommonApi.java b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaCommonApi.java index 64c90c68c0..3f8a1dd073 100644 --- a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaCommonApi.java +++ b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaCommonApi.java @@ -181,10 +181,15 @@ public interface JavaCommonApi<FileT extends FileApi, JavaInfoT extends JavaInfo doc = "Compiles Java source files/jars from the implementation of a Skylark rule and returns a " + "provider that represents the results of the compilation and can be added to the set of " + "providers emitted by this rule.", - // There is one mandatory positional: the Skylark rule context. - mandatoryPositionals = 1, parameters = { @Param( + name = "ctx", + positional = true, + named = false, + type = SkylarkRuleContextApi.class, + doc = "The rule context." + ), + @Param( name = "source_jars", positional = false, named = true, @@ -473,9 +478,14 @@ public interface JavaCommonApi<FileT extends FileApi, JavaInfoT extends JavaInfo name = "default_javac_opts", // This function is experimental for now. documented = false, - // There's only one mandatory positional,the Skylark context - mandatoryPositionals = 1, parameters = { + @Param( + name = "ctx", + positional = true, + named = false, + type = SkylarkRuleContextApi.class, + doc = "The rule context." + ), @Param(name = "java_toolchain_attr", positional = false, named = true, type = String.class) }) // TODO(b/78512644): migrate callers to passing explicit javacopts or using custom toolchains, and @@ -486,8 +496,16 @@ public interface JavaCommonApi<FileT extends FileApi, JavaInfoT extends JavaInfo @SkylarkCallable( name = "merge", doc = "Merges the given providers into a single JavaInfo.", - // We have one positional argument: the list of providers to merge. - mandatoryPositionals = 1 + parameters = { + @Param( + name = "providers", + positional = true, + named = false, + type = SkylarkList.class, + generic1 = JavaInfoApi.class, + doc = "The list of providers to merge." + ), + } ) public JavaInfoT mergeJavaProviders(SkylarkList<JavaInfoT> providers); @@ -496,8 +514,15 @@ public interface JavaCommonApi<FileT extends FileApi, JavaInfoT extends JavaInfo doc = "Returns a new Java provider whose direct-jars part is the union of both the direct and" + " indirect jars of the given Java provider.", - // There's only one mandatory positional, the Java provider. - mandatoryPositionals = 1 + parameters = { + @Param( + name = "java_info", + positional = true, + named = false, + type = JavaInfoApi.class, + doc = "The java info." + ), + } ) public JavaInfoT makeNonStrict(JavaInfoT javaInfo); |