Code cleanup on skylarkbuildapi classes. Removed redundant "abstract" and "public static" modifiers. PiperOrigin-RevId: 284659044
diff --git a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/SkylarkRuleContextApi.java b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/SkylarkRuleContextApi.java index d6c34d3..eca673f 100644 --- a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/SkylarkRuleContextApi.java +++ b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/SkylarkRuleContextApi.java
@@ -55,13 +55,13 @@ + "information.") public interface SkylarkRuleContextApi extends StarlarkValue { - public static final String DOC_NEW_FILE_TAIL = "Does not actually create a file on the file " - + "system, just declares that some action will do so. You must create an action that " - + "generates the file. If the file should be visible to other rules, declare a rule output " - + "instead when possible. Doing so enables Blaze to associate a label with the file that " - + "rules can refer to (allowing finer dependency control) instead of referencing the whole " - + "rule."; - public static final String EXECUTABLE_DOC = + String DOC_NEW_FILE_TAIL = + "Does not actually create a file on the file system, just declares that some action will do" + + " so. You must create an action that generates the file. If the file should be visible" + + " to other rules, declare a rule output instead when possible. Doing so enables Blaze" + + " to associate a label with the file that rules can refer to (allowing finer" + + " dependency control) instead of referencing the whole rule."; + String EXECUTABLE_DOC = "A <code>struct</code> containing executable files defined in <a " + "href='attr.html#label'>label type attributes</a> marked as <a " + "href='attr.html#label.executable'><code>executable=True</code><a>. The struct " @@ -72,7 +72,7 @@ + "corresponding struct field is generated. <a " + "href=\"https://github.com/bazelbuild/examples/blob/master/rules/actions_run/" + "execute.bzl\">See example of use</a>."; - public static final String FILES_DOC = + String FILES_DOC = "A <code>struct</code> containing files defined in <a href='attr.html#label'>label</a>" + " or <a href='attr.html#label_list'>label list</a> type attributes. The struct" + " fields correspond to the attribute names. The struct values are <code>list</code> of" @@ -83,7 +83,7 @@ + " dependency. <a" + " href=\"https://github.com/bazelbuild/examples/blob/master/rules/depsets/foo.bzl\">See" + " example of use</a>."; - public static final String FILE_DOC = + String FILE_DOC = "A <code>struct</code> containing files defined in <a href='attr.html#label'>label type" + " attributes</a> marked as <a" + " href='attr.html#label.allow_single_file'><code>allow_single_file</code></a>. The" @@ -98,7 +98,7 @@ + " dependency. <a" + " href=\"https://github.com/bazelbuild/examples/blob/master/rules/expand_template/hello.bzl\">See" + " example of use</a>."; - public static final String ATTR_DOC = + String ATTR_DOC = "A struct to access the values of the <a href='../rules.$DOC_EXT#attributes'>attributes</a>. " + "The values are provided by the user (if not, a default value is used). The attributes " + "of the struct and the types of their values correspond to the keys and values of the " @@ -106,7 +106,7 @@ + "href='globals.html#rule'><code>rule</code> function</a>. <a " + "href=\"https://github.com/bazelbuild/examples/blob/master/rules/attributes/" + "printer.bzl\">See example of use</a>."; - public static final String SPLIT_ATTR_DOC = + String SPLIT_ATTR_DOC = "A struct to access the values of attributes with split configurations. If the attribute is " + "a label list, the value of split_attr is a dict of the keys of the split (as strings) " + "to lists of the ConfiguredTargets in that branch of the split. If the attribute is a " @@ -114,7 +114,7 @@ + "to single ConfiguredTargets. Attributes with split configurations still appear in the " + "attr struct, but their values will be single lists with all the branches of the split " + "merged together."; - public static final String OUTPUTS_DOC = + String OUTPUTS_DOC = "A pseudo-struct containing all the predeclared output files, represented by " + "<a href='File.html'><code>File</code></a> objects. See the " + "<a href='../rules.$DOC_EXT#files'>Rules page</a> for more information and examples." @@ -147,14 +147,13 @@ name = "default_provider", structField = true, doc = "Deprecated. Use <a href=\"DefaultInfo.html\">DefaultInfo</a> instead.") - public ProviderApi getDefaultProvider(); + ProviderApi getDefaultProvider(); @SkylarkCallable( - name = "actions", - structField = true, - doc = "Contains methods for declaring output files and the actions that produce them." - ) - public SkylarkActionFactoryApi actions(); + name = "actions", + structField = true, + doc = "Contains methods for declaring output files and the actions that produce them.") + SkylarkActionFactoryApi actions(); @SkylarkCallable( name = "created_actions", @@ -168,68 +167,62 @@ + " them. <br/><br/>This is intended to help write tests for rule-implementation" + " helper functions, which may take in a <code>ctx</code> object and create actions" + " on it.") - public StarlarkValue createdActions() throws EvalException; + StarlarkValue createdActions() throws EvalException; @SkylarkCallable(name = "attr", structField = true, doc = ATTR_DOC) - public StructApi getAttr() throws EvalException; + StructApi getAttr() throws EvalException; @SkylarkCallable(name = "split_attr", structField = true, doc = SPLIT_ATTR_DOC) - public StructApi getSplitAttr() throws EvalException; + StructApi getSplitAttr() throws EvalException; @SkylarkCallable(name = "executable", structField = true, doc = EXECUTABLE_DOC) - public StructApi getExecutable() throws EvalException; + StructApi getExecutable() throws EvalException; @SkylarkCallable(name = "file", structField = true, doc = FILE_DOC) - public StructApi getFile() throws EvalException; + StructApi getFile() throws EvalException; @SkylarkCallable(name = "files", structField = true, doc = FILES_DOC) - public StructApi getFiles() throws EvalException; + StructApi getFiles() throws EvalException; @SkylarkCallable( - name = "workspace_name", - structField = true, - doc = "Returns the workspace name as defined in the WORKSPACE file." - ) - public String getWorkspaceName() throws EvalException; + name = "workspace_name", + structField = true, + doc = "Returns the workspace name as defined in the WORKSPACE file.") + String getWorkspaceName() throws EvalException; @SkylarkCallable( - name = "label", - structField = true, - doc = "The label of the target currently being analyzed." - ) - public Label getLabel() throws EvalException; + name = "label", + structField = true, + doc = "The label of the target currently being analyzed.") + Label getLabel() throws EvalException; @SkylarkCallable( - name = "fragments", - structField = true, - doc = "Allows access to configuration fragments in target configuration." - ) - public FragmentCollectionApi getFragments() throws EvalException; + name = "fragments", + structField = true, + doc = "Allows access to configuration fragments in target configuration.") + FragmentCollectionApi getFragments() throws EvalException; @SkylarkCallable( - name = "host_fragments", - structField = true, - doc = "Allows access to configuration fragments in host configuration." - ) - public FragmentCollectionApi getHostFragments() throws EvalException; + name = "host_fragments", + structField = true, + doc = "Allows access to configuration fragments in host configuration.") + FragmentCollectionApi getHostFragments() throws EvalException; @SkylarkCallable( - name = "configuration", - structField = true, - doc = - "Returns the default configuration. See the <a href=\"configuration.html\">" - + "configuration</a> type for more details." - ) - public BuildConfigurationApi getConfiguration() throws EvalException; + name = "configuration", + structField = true, + doc = + "Returns the default configuration. See the <a href=\"configuration.html\">" + + "configuration</a> type for more details.") + BuildConfigurationApi getConfiguration() throws EvalException; @SkylarkCallable( - name = "host_configuration", - structField = true, - doc = - "Returns the host configuration. See the <a href=\"configuration.html\">" - + "configuration</a> type for more details." - ) - public BuildConfigurationApi getHostConfiguration() throws EvalException; + name = "host_configuration", + structField = true, + doc = + "Returns the host configuration. See the <a href=\"configuration.html\">" + + "configuration</a> type for more details.") + BuildConfigurationApi getHostConfiguration() throws EvalException; @SkylarkCallable( name = "build_setting_value", @@ -240,7 +233,7 @@ + "depend on it.</b> <p>Returns the value of the build setting that is represented " + "by the current target. It is an error to access this field for rules that do not " + "set the <code>build_setting</code> attribute in their rule definition.") - public Object getBuildSettingValue() throws EvalException; + Object getBuildSettingValue() throws EvalException; @SkylarkCallable( name = "coverage_instrumented", @@ -265,14 +258,13 @@ named = true, doc = "A Target specifying a rule. If not provided, defaults to the current rule.") }) - public boolean instrumentCoverage(Object targetUnchecked) throws EvalException; + boolean instrumentCoverage(Object targetUnchecked) throws EvalException; @SkylarkCallable( - name = "features", - structField = true, - doc = "Returns the set of features that are explicitly enabled by the user for this rule." - ) - public ImmutableList<String> getFeatures() throws EvalException; + name = "features", + structField = true, + doc = "Returns the set of features that are explicitly enabled by the user for this rule.") + ImmutableList<String> getFeatures() throws EvalException; @SkylarkCallable( name = "disabled_features", @@ -281,55 +273,47 @@ ImmutableList<String> getDisabledFeatures() throws EvalException; @SkylarkCallable( - name = "bin_dir", - structField = true, - doc = "The root corresponding to bin directory." - ) - public FileRootApi getBinDirectory() throws EvalException; + name = "bin_dir", + structField = true, + doc = "The root corresponding to bin directory.") + FileRootApi getBinDirectory() throws EvalException; @SkylarkCallable( - name = "genfiles_dir", - structField = true, - doc = "The root corresponding to genfiles directory." - ) - public FileRootApi getGenfilesDirectory() throws EvalException; + name = "genfiles_dir", + structField = true, + doc = "The root corresponding to genfiles directory.") + FileRootApi getGenfilesDirectory() throws EvalException; + + @SkylarkCallable(name = "outputs", structField = true, doc = OUTPUTS_DOC) + ClassObject outputs() throws EvalException; @SkylarkCallable( - name = "outputs", - structField = true, - doc = OUTPUTS_DOC - ) - public ClassObject outputs() throws EvalException; + name = "rule", + structField = true, + doc = + "Returns rule attributes descriptor for the rule that aspect is applied to." + + " Only available in aspect implementation functions.") + SkylarkAttributesCollectionApi rule() throws EvalException; @SkylarkCallable( - name = "rule", - structField = true, - doc = - "Returns rule attributes descriptor for the rule that aspect is applied to." - + " Only available in aspect implementation functions." - ) - public SkylarkAttributesCollectionApi rule() throws EvalException; - - @SkylarkCallable( - name = "aspect_ids", - structField = true, - doc = - "Returns a list ids for all aspects applied to the target." - + " Only available in aspect implementation functions." - ) - public ImmutableList<String> aspectIds() throws EvalException; + name = "aspect_ids", + structField = true, + doc = + "Returns a list ids for all aspects applied to the target." + + " Only available in aspect implementation functions.") + ImmutableList<String> aspectIds() throws EvalException; @SkylarkCallable( name = "var", structField = true, doc = "Dictionary (String to String) of configuration variables.") - public Dict<String, String> var() throws EvalException; + Dict<String, String> var() throws EvalException; @SkylarkCallable( name = "toolchains", structField = true, doc = "Toolchains required for this rule.") - public ToolchainContextApi toolchains() throws EvalException; + ToolchainContextApi toolchains() throws EvalException; @SkylarkCallable( name = "tokenize", @@ -344,7 +328,7 @@ type = String.class, doc = "The string to split."), }) - public Sequence<String> tokenize(String optionString) throws EvalException; + Sequence<String> tokenize(String optionString) throws EvalException; @SkylarkCallable( name = "expand", @@ -374,7 +358,7 @@ type = Label.class, doc = "The label resolver."), }) - public String expand( + String expand( @Nullable String expression, Sequence<?> artifacts, // <FileT> Label labelResolver) @@ -400,55 +384,46 @@ + "file root.</li></ul> <br>" + DOC_NEW_FILE_TAIL, parameters = { - @Param( - name = "var1", - allowedTypes = { - @ParamType(type = String.class), - @ParamType(type = FileRootApi.class), - @ParamType(type = FileApi.class), - }, - doc = "" - ), - @Param( - name = "var2", - allowedTypes = { - @ParamType(type = String.class), - @ParamType(type = FileApi.class), - }, - defaultValue = "unbound", - doc = "" - ), - @Param( - name = "var3", - allowedTypes = { - @ParamType(type = String.class), - }, - defaultValue = "unbound", - doc = "" - ) + @Param( + name = "var1", + allowedTypes = { + @ParamType(type = String.class), + @ParamType(type = FileRootApi.class), + @ParamType(type = FileApi.class), + }, + doc = ""), + @Param( + name = "var2", + allowedTypes = { + @ParamType(type = String.class), + @ParamType(type = FileApi.class), + }, + defaultValue = "unbound", + doc = ""), + @Param( + name = "var3", + allowedTypes = { + @ParamType(type = String.class), + }, + defaultValue = "unbound", + doc = "") }, - useLocation = true - ) - public FileApi newFile(Object var1, - Object var2, - Object var3, - Location loc) throws EvalException; + useLocation = true) + FileApi newFile(Object var1, Object var2, Object var3, Location loc) throws EvalException; @SkylarkCallable( - name = "experimental_new_directory", - documented = false, - parameters = { - @Param(name = "name", type = String.class), - @Param( - name = "sibling", - type = FileApi.class, - defaultValue = "None", - noneable = true, - named = true - ) - } - ) - public FileApi newDirectory(String name, Object siblingArtifactUnchecked) throws EvalException; + name = "experimental_new_directory", + documented = false, + parameters = { + @Param(name = "name", type = String.class), + @Param( + name = "sibling", + type = FileApi.class, + defaultValue = "None", + noneable = true, + named = true) + }) + FileApi newDirectory(String name, Object siblingArtifactUnchecked) throws EvalException; @SkylarkCallable( name = "check_placeholders", @@ -467,7 +442,7 @@ type = Sequence.class, doc = "The allowed placeholders."), }) - public boolean checkPlaceholders(String template, Sequence<?> allowedPlaceholders) // <String> + boolean checkPlaceholders(String template, Sequence<?> allowedPlaceholders) // <String> throws EvalException; @SkylarkCallable( @@ -507,39 +482,36 @@ type = Dict.class, doc = "Additional substitutions to make beyond the default make variables."), }) - public String expandMakeVariables( + String expandMakeVariables( String attributeName, String command, final Dict<?, ?> additionalSubstitutions) // <String, String> throws EvalException; @SkylarkCallable( - name = "info_file", - structField = true, - documented = false, - doc = - "Returns the file that is used to hold the non-volatile workspace status for the " - + "current build request." - ) - public FileApi getStableWorkspaceStatus() throws InterruptedException, EvalException; + name = "info_file", + structField = true, + documented = false, + doc = + "Returns the file that is used to hold the non-volatile workspace status for the " + + "current build request.") + FileApi getStableWorkspaceStatus() throws InterruptedException, EvalException; @SkylarkCallable( - name = "version_file", - structField = true, - documented = false, - doc = - "Returns the file that is used to hold the volatile workspace status for the " - + "current build request." - ) - public FileApi getVolatileWorkspaceStatus() throws InterruptedException, EvalException; + name = "version_file", + structField = true, + documented = false, + doc = + "Returns the file that is used to hold the volatile workspace status for the " + + "current build request.") + FileApi getVolatileWorkspaceStatus() throws InterruptedException, EvalException; @SkylarkCallable( - name = "build_file_path", - structField = true, - documented = true, - doc = "Returns path to the BUILD file for this rule, relative to the source root." - ) - public String getBuildFileRelativePath() throws EvalException; + name = "build_file_path", + structField = true, + documented = true, + doc = "Returns path to the BUILD file for this rule, relative to the source root.") + String getBuildFileRelativePath() throws EvalException; @SkylarkCallable( name = "action", @@ -684,7 +656,7 @@ allowReturnNones = true, useLocation = true, useStarlarkThread = true) - public NoneType action( + NoneType action( Sequence<?> outputs, Object inputs, Object executableUnchecked, @@ -732,8 +704,8 @@ allowReturnNones = true, useLocation = true, useStarlarkThread = true) - public String expandLocation( - String input, Sequence<?> targets, Location loc, StarlarkThread thread) throws EvalException; + String expandLocation(String input, Sequence<?> targets, Location loc, StarlarkThread thread) + throws EvalException; @SkylarkCallable( name = "file_action", @@ -757,7 +729,7 @@ allowReturnNones = true, useLocation = true, useStarlarkThread = true) - public NoneType fileAction( + NoneType fileAction( FileApi output, String content, Boolean executable, Location loc, StarlarkThread thread) throws EvalException; @@ -790,7 +762,7 @@ allowReturnNones = true, useLocation = true, useStarlarkThread = true) - public NoneType emptyAction(String mnemonic, Object inputs, Location loc, StarlarkThread thread) + NoneType emptyAction(String mnemonic, Object inputs, Location loc, StarlarkThread thread) throws EvalException; @SkylarkCallable( @@ -829,7 +801,7 @@ allowReturnNones = true, useLocation = true, useStarlarkThread = true) - public NoneType templateAction( + NoneType templateAction( FileApi template, FileApi output, Dict<?, ?> substitutionsUnchecked, @@ -897,7 +869,7 @@ doc = "The map of symlinks to be added to the runfiles.") }, useLocation = true) - public RunfilesApi runfiles( + RunfilesApi runfiles( Sequence<?> files, Object transitiveFiles, Boolean collectData, @@ -981,7 +953,7 @@ }, useLocation = true, useStarlarkThread = true) - public Tuple<Object> resolveCommand( + Tuple<Object> resolveCommand( String command, Object attributeUnchecked, Boolean expandLocations, @@ -1014,5 +986,5 @@ }, useLocation = false, useStarlarkThread = false) - public Tuple<Object> resolveTools(Sequence<?> tools) throws EvalException; + Tuple<Object> resolveTools(Sequence<?> tools) throws EvalException; }