Class SkylarkDescriptionArg
- java.lang.Object
-
- com.facebook.buck.core.starlark.rule.SkylarkDescriptionArg
-
- All Implemented Interfaces:
BuildRuleArg
,ConstructorArg
,DataTransferObject
,SkylarkDescriptionArgBuilder
public class SkylarkDescriptionArg extends Object implements SkylarkDescriptionArgBuilder, BuildRuleArg
Description arg for user defined rules. Instead of using reflection and immutables, this class uses a backing store of attribute names -> coerced values, and makes the user's implementation function available
-
-
Field Summary
-
Fields inherited from interface com.facebook.buck.core.description.arg.BuildRuleArg
DEFAULT_TARGET_PLATFORM_PARAM_NAME
-
-
Constructor Summary
Constructors Constructor Description SkylarkDescriptionArg(SkylarkUserDefinedRule rule)
Create an instance ofSkylarkDescriptionArg
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
build()
'Build' theSkylarkDescriptionArg
.com.google.common.collect.ImmutableMap<String,ParamInfo<?>>
getAllParamInfo()
com.google.common.collect.ImmutableList<UnconfiguredBuildTarget>
getCompatibleWith()
A list ofconfig_setting
a target is compatible with.com.google.common.collect.ImmutableSortedSet<String>
getContacts()
Optional<UnconfiguredBuildTarget>
getDefaultTargetPlatform()
The name of build target default "new" platform: it is used when a platform is not specified either globally or in a target which used this target as a dependency.com.google.devtools.build.lib.syntax.BaseFunction
getImplementation()
com.google.common.collect.ImmutableSortedSet<String>
getLabels()
com.google.common.collect.ImmutableSet<SourcePath>
getLicenses()
String
getName()
Each rule has a nameObject
getPostCoercionValue(String attr)
Get an attribute's value after it was set inSkylarkDescriptionArgBuilder.setPostCoercionValue(String, Object)
SkylarkUserDefinedRule
getRule()
Get theSkylarkDescriptionArg
that has information about parameters and the user's implementation functionvoid
setPostCoercionValue(String attr, Object value)
Set the value for a specific attribute after it has been successfully coerced/type checked.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.facebook.buck.core.description.arg.BuildRuleArg
labelsContainsAnyOf
-
-
-
-
Constructor Detail
-
SkylarkDescriptionArg
public SkylarkDescriptionArg(SkylarkUserDefinedRule rule)
Create an instance ofSkylarkDescriptionArg
- Parameters:
rule
- the rule that should be used to determine acceptable attributes for a target, and to provide access to the user's implementation function
-
-
Method Detail
-
setPostCoercionValue
public void setPostCoercionValue(String attr, Object value)
Description copied from interface:SkylarkDescriptionArgBuilder
Set the value for a specific attribute after it has been successfully coerced/type checked. This attribute must be defined in the originally providedSkylarkUserDefinedRule
- Specified by:
setPostCoercionValue
in interfaceSkylarkDescriptionArgBuilder
- Parameters:
attr
- The attribute to set the value forvalue
- The value to set. Must not be null.
-
getPostCoercionValue
public Object getPostCoercionValue(String attr)
Description copied from interface:SkylarkDescriptionArgBuilder
Get an attribute's value after it was set inSkylarkDescriptionArgBuilder.setPostCoercionValue(String, Object)
It is an error to get an attribute that has not been set.
- Specified by:
getPostCoercionValue
in interfaceSkylarkDescriptionArgBuilder
- Parameters:
attr
- The attribute to get the value for- Returns:
- The value
-
build
public void build()
'Build' theSkylarkDescriptionArg
. After this has been called,setPostCoercionValue(String, Object)
may not be called.
-
getRule
public SkylarkUserDefinedRule getRule()
Get theSkylarkDescriptionArg
that has information about parameters and the user's implementation function
-
getName
public String getName()
Description copied from interface:ConstructorArg
Each rule has a name- Specified by:
getName
in interfaceConstructorArg
-
getDefaultTargetPlatform
public Optional<UnconfiguredBuildTarget> getDefaultTargetPlatform()
Description copied from interface:BuildRuleArg
The name of build target default "new" platform: it is used when a platform is not specified either globally or in a target which used this target as a dependency.The value is a build target, but we specify it as string, because this function is not actually called, but the attr is fetched by name from the raw (unconfigured) target node.
- Specified by:
getDefaultTargetPlatform
in interfaceBuildRuleArg
-
getAllParamInfo
public com.google.common.collect.ImmutableMap<String,ParamInfo<?>> getAllParamInfo()
-
getImplementation
public com.google.devtools.build.lib.syntax.BaseFunction getImplementation()
-
getLicenses
public com.google.common.collect.ImmutableSet<SourcePath> getLicenses()
- Specified by:
getLicenses
in interfaceBuildRuleArg
-
getLabels
public com.google.common.collect.ImmutableSortedSet<String> getLabels()
- Specified by:
getLabels
in interfaceBuildRuleArg
-
getContacts
public com.google.common.collect.ImmutableSortedSet<String> getContacts()
- Returns:
- contacts for this rule, or an empty set of `contacts` was not set
-
getCompatibleWith
public com.google.common.collect.ImmutableList<UnconfiguredBuildTarget> getCompatibleWith()
Description copied from interface:BuildRuleArg
A list ofconfig_setting
a target is compatible with.- Specified by:
getCompatibleWith
in interfaceBuildRuleArg
-
-