implementation
function when "
+ "you create a rule.")
public final class SkylarkRuleContext {
public static final String PROVIDER_CLASS_PREFIX = "com.google.devtools.build.lib.";
private 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.";
static final LoadingCacheSee {@link RuleContext#getExecutablePrerequisite(String, Mode)}.
*/
@SkylarkCallable(name = "executable", structField = true,
doc = "A struct
containing executable files defined in label type "
+ "attributes marked as executable=True
. The struct fields correspond "
+ "to the attribute names. The struct value is always a file
s or "
+ "None
. If an optional attribute is not specified in the rule "
+ "then the corresponding struct value is None
. If a label type is not "
+ "marked as executable=True
, no corresponding struct field is generated.")
public SkylarkClassObject getExecutable() {
return executableObject;
}
/**
* See {@link RuleContext#getPrerequisiteArtifact(String, Mode)}.
*/
@SkylarkCallable(name = "file", structField = true,
doc = "A struct
containing files defined in label type "
+ "attributes marked as single_file=True
. The struct fields correspond "
+ "to the attribute names. The struct value is always a file
or "
+ "None
. If an optional attribute is not specified in the rule "
+ "then the corresponding struct value is None
. If a label type is not "
+ "marked as single_file=True
, no corresponding struct field is generated.")
public SkylarkClassObject getFile() {
return fileObject;
}
/**
* See {@link RuleContext#getPrerequisiteArtifacts(String, Mode)}.
*/
@SkylarkCallable(name = "files", structField = true,
doc = "A struct
containing files defined in label or label list "
+ "type attributes. The struct fields correspond to the attribute names. The struct "
+ "values are list
of file
s. If an optional attribute is "
+ "not specified in the rule, an empty list is generated.")
public SkylarkClassObject getFiles() {
return filesObject;
}
/**
* See {@link RuleContext#getPrerequisite(String, Mode)}.
*/
@SkylarkCallable(name = "target", structField = true,
doc = "A struct
containing prerequisite targets defined in label type "
+ "attributes. The struct fields correspond to the attribute names. The struct value "
+ "is always a target
or None
. If an optional attribute "
+ "is not specified in the rule, the corresponding struct value is None
.")
public SkylarkClassObject getTarget() {
return targetObject;
}
/**
* See {@link RuleContext#getPrerequisites(String, Mode)}.
*/
@SkylarkCallable(name = "targets", structField = true,
doc = "A struct
containing prerequisite targets defined in label or label list "
+ "type attributes. The struct fields correspond to the attribute names. The struct "
+ "values are list
of target
s. If an optional attribute is "
+ "not specified in the rule, an empty list is generated.")
public SkylarkClassObject getTargets() {
return targetsObject;
}
@SkylarkCallable(name = "label", structField = true, doc = "The label of this rule.")
public Label getLabel() {
return ruleContext.getLabel();
}
@SkylarkCallable(name = "configuration", structField = true,
doc = "Returns the default configuration. See the configuration
type for "
+ "more details.")
public BuildConfiguration getConfiguration() {
return ruleContext.getConfiguration();
}
@SkylarkCallable(name = "host_configuration", structField = true,
doc = "Returns the host configuration. See the configuration
type for "
+ "more details.")
public BuildConfiguration getHostConfiguration() {
return ruleContext.getHostConfiguration();
}
@SkylarkCallable(name = "data_configuration", structField = true,
doc = "Returns the data configuration. See the configuration
type for "
+ "more details.")
public BuildConfiguration getDataConfiguration() {
return ruleContext.getConfiguration().getConfiguration(ConfigurationTransition.DATA);
}
@SkylarkCallable(structField = true,
doc = "A struct
containing all the output files."
+ " The struct is generated the following way:
"
+ "
executable=True
the struct has an "
+ "\"executable\" field with the rules default executable file
value."
+ "outputs
dict a field is generated with "
+ "the same name and the corresponding file
value."
+ "file
value or None
, "
+ "if no value is specified in the rule."
+ "list
of file
s value "
+ "(an empty list if no value is specified in the rule).