public class UserDefinedProvider extends com.google.devtools.build.lib.syntax.BaseFunction implements Provider<UserDefinedProviderInfo>, com.google.devtools.build.lib.skylarkinterface.SkylarkValue, com.google.devtools.build.lib.packages.SkylarkExportable
Provider
defined by a user in a build file that creates UserDefinedProviderInfo
instances. This is only intended to be used within the context of user defined rules, and as
such, UserDefinedProviderInfo
instances that are created contain skylark-compatible
values, rather than normal java/guava classes. In the future type restriction may also be
allowed.
NOTE: Until export(Label, String)
is called, many methods (especially ones that get
the user defined name of the class) are not safe to call.
Constructor and Description |
---|
UserDefinedProvider(com.google.devtools.build.lib.events.Location location,
String[] fieldNames)
Create an instance of
UserDefinedProvider |
Modifier and Type | Method and Description |
---|---|
protected Object |
call(Object[] args,
com.google.devtools.build.lib.syntax.FuncallExpression ast,
com.google.devtools.build.lib.syntax.Environment env) |
void |
export(com.google.devtools.build.lib.cmdline.Label extensionLabel,
String exportedName) |
Provider.Key<UserDefinedProviderInfo> |
getKey()
Returns a serializable representation of this
Provider . |
String |
getName() |
boolean |
isExported() |
boolean |
isImmutable() |
void |
repr(com.google.devtools.build.lib.skylarkinterface.SkylarkPrinter printer) |
String |
toString()
Returns a name of this
Provider that should be
used in error messages. |
call, callWithArgArray, canonicalizeArguments, configure, configure, getArgArraySize, getEnforcedArgumentTypes, getFullName, getLocation, getObjectType, getObjectTypeString, getOrCreateChildEnvironment, getParamDoc, getShortSignature, getSignature, hasSelfArgument, isConfigured, printTypeString, processArguments
public UserDefinedProvider(com.google.devtools.build.lib.events.Location location, String[] fieldNames)
UserDefinedProvider
location
- The location where the provider was defined by the userfieldNames
- List of kwargs that will be available when call(Object[],
FuncallExpression, Environment)
is called, and will be available as fields on the
resulting UserDefinedProviderInfo
objectpublic boolean isImmutable()
isImmutable
in interface com.google.devtools.build.lib.skylarkinterface.SkylarkValue
isImmutable
in class com.google.devtools.build.lib.syntax.BaseFunction
public Provider.Key<UserDefinedProviderInfo> getKey()
Provider
Provider
.getKey
in interface Provider<UserDefinedProviderInfo>
public void repr(com.google.devtools.build.lib.skylarkinterface.SkylarkPrinter printer)
repr
in interface com.google.devtools.build.lib.skylarkinterface.SkylarkPrintable
repr
in class com.google.devtools.build.lib.syntax.BaseFunction
public boolean isExported()
isExported
in interface com.google.devtools.build.lib.packages.SkylarkExportable
public String getName()
getName
in class com.google.devtools.build.lib.syntax.BaseFunction
public void export(com.google.devtools.build.lib.cmdline.Label extensionLabel, String exportedName) throws com.google.devtools.build.lib.syntax.EvalException
export
in interface com.google.devtools.build.lib.packages.SkylarkExportable
com.google.devtools.build.lib.syntax.EvalException
public String toString()
Provider
Provider
that should be
used in error messages.toString
in interface Provider<UserDefinedProviderInfo>
toString
in class com.google.devtools.build.lib.syntax.BaseFunction