Class UserDefinedProvider

  • All Implemented Interfaces:
    Provider<UserDefinedProviderInfo>, com.google.devtools.build.lib.packages.SkylarkExportable, com.google.devtools.build.lib.skylarkinterface.SkylarkPrintable, com.google.devtools.build.lib.skylarkinterface.SkylarkValue, com.google.devtools.build.lib.syntax.StarlarkFunction

    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
    A 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.

    • Field Summary

      • Fields inherited from class com.google.devtools.build.lib.syntax.BaseFunction

        enforcedArgumentTypes, location, objectType, paramDoc, signature
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method 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.
      • Methods inherited from class com.google.devtools.build.lib.syntax.BaseFunction

        call, callWithArgArray, canonicalizeArguments, configure, configure, getArgArraySize, getEnforcedArgumentTypes, getFullName, getLocation, getObjectType, getObjectTypeString, getOrCreateChildEnvironment, getParamDoc, getShortSignature, getSignature, hasSelfArgument, isConfigured, printTypeString, processArguments
      • Methods inherited from interface com.google.devtools.build.lib.skylarkinterface.SkylarkPrintable

        debugPrint, str
      • Methods inherited from interface com.google.devtools.build.lib.skylarkinterface.SkylarkValue

        isHashable
    • Method Detail

      • isImmutable

        public boolean isImmutable()
        Specified by:
        isImmutable in interface com.google.devtools.build.lib.skylarkinterface.SkylarkValue
        Overrides:
        isImmutable in class com.google.devtools.build.lib.syntax.BaseFunction
      • repr

        public void repr​(com.google.devtools.build.lib.skylarkinterface.SkylarkPrinter printer)
        Specified by:
        repr in interface com.google.devtools.build.lib.skylarkinterface.SkylarkPrintable
        Overrides:
        repr in class com.google.devtools.build.lib.syntax.BaseFunction
      • isExported

        public boolean isExported()
        Specified by:
        isExported in interface com.google.devtools.build.lib.packages.SkylarkExportable
      • getName

        public String getName()
        Overrides:
        getName in class com.google.devtools.build.lib.syntax.BaseFunction
      • export

        public void export​(com.google.devtools.build.lib.cmdline.Label extensionLabel,
                           String exportedName)
                    throws com.google.devtools.build.lib.syntax.EvalException
        Specified by:
        export in interface com.google.devtools.build.lib.packages.SkylarkExportable
        Throws:
        com.google.devtools.build.lib.syntax.EvalException
      • toString

        public String toString()
        Description copied from interface: Provider
        Returns a name of this Provider that should be used in error messages.
        Specified by:
        toString in interface Provider<UserDefinedProviderInfo>
        Overrides:
        toString in class com.google.devtools.build.lib.syntax.BaseFunction
      • call

        protected Object call​(Object[] args,
                              @Nullable
                              com.google.devtools.build.lib.syntax.FuncallExpression ast,
                              com.google.devtools.build.lib.syntax.Environment env)
        Overrides:
        call in class com.google.devtools.build.lib.syntax.BaseFunction