Class ModernBuildRule<T extends Buildable>

    • Method Detail

      • getBuildable

        public final T getBuildable()
      • getOutputPathResolver

        public OutputPathResolver getOutputPathResolver()
        This field could be used unsafely, most ModernBuildRule should never need this directly and it should only be used within the getBuildSteps() call.
      • updateBuildRuleResolver

        public void updateBuildRuleResolver​(BuildRuleResolver ruleResolver)
        Description copied from interface: BuildRule
        Updates the BuildRuleResolver and associated objects for this build rule.

        Build rules sometimes hold field references to build rule resolvers. If this build rule is to be cached, it must update its BuildRuleResolver when a new action graph is constructed to avoid leaking the entire action graph it was originally associated with.

        Specified by:
        updateBuildRuleResolver in interface BuildRule
        Overrides:
        updateBuildRuleResolver in class AbstractBuildRule
      • getSourcePath

        protected final BuildTargetSourcePath getSourcePath​(OutputPath outputPath)
        This should only be exposed to implementations of the ModernBuildRule, not of the Buildable.
      • getBuildDeps

        public final com.google.common.collect.ImmutableSortedSet<BuildRule> getBuildDeps()
        Specified by:
        getBuildDeps in interface BuildRule
        Returns:
        the set of rules that must be built before this rule. Normally, this matches the value of the deps argument for this build rule in the build file in which it was defined.

        However, there are special cases where other arguments pull in implicit dependencies (e.g., the keystore argument in android_binary). In these cases, the implicit dependencies are also included in the set returned by this method. The value of the original deps argument, as defined in the build file, must be accessed via a custom getter provided by the build rule.

      • stepsForBuildable

        public static <T extends Buildable> com.google.common.collect.ImmutableList<Step> stepsForBuildable​(BuildContext context,
                                                                                                            T buildable,
                                                                                                            ProjectFilesystem filesystem,
                                                                                                            BuildTarget buildTarget,
                                                                                                            Iterable<Path> outputs)
        Returns the build steps for the Buildable. Unlike getBuildSteps(), this does not record outputs (callers should call recordOutputs() themselves).
      • getSetupStepsForBuildable

        public static void getSetupStepsForBuildable​(BuildContext context,
                                                     ProjectFilesystem filesystem,
                                                     Iterable<Path> outputs,
                                                     com.google.common.collect.ImmutableList.Builder<Step> stepBuilder,
                                                     OutputPathResolver outputPathResolver)
        Gets the steps for preparing the output directories of the build rule.
      • recordOutputs

        public void recordOutputs​(BuildableContext buildableContext)
        Records the outputs of this buildrule. An output will only be recorded once (i.e. no duplicates and if a directory is recorded, none of its contents will be).
      • recordOutputs

        public static <T extends AddsToRuleKey> void recordOutputs​(BuildableContext buildableContext,
                                                                   OutputPathResolver outputPathResolver,
                                                                   ClassInfo<T> classInfo,
                                                                   T buildable)
        Records the outputs of this buildrule. An output will only be recorded once (i.e. no duplicates and if a directory is recorded, none of its contents will be).
      • recordOutputs

        public static <T extends AddsToRuleKey> void recordOutputs​(BuildableContext buildableContext,
                                                                   OutputPathResolver outputPathResolver,
                                                                   T buildable)
        Records the outputs of this buildrule. An output will only be recorded once (i.e. no duplicates and if a directory is recorded, none of its contents will be).