@Override
  public <T> BuildRule transform(
      TargetGraph targetGraph, BuildRuleResolver ruleResolver, TargetNode<T> targetNode)
      throws NoSuchBuildTargetException {
    BuildRuleFactoryParams ruleFactoryParams = targetNode.getRuleFactoryParams();
    Description<T> description = targetNode.getDescription();

    T arg = targetNode.getConstructorArg();

    // The params used for the Buildable only contain the declared parameters. However, the deps of
    // the rule include not only those, but also any that were picked up through the deps declared
    // via a SourcePath.
    BuildRuleParams params =
        new BuildRuleParams(
            targetNode.getBuildTarget(),
            Suppliers.ofInstance(ruleResolver.requireAllRules(targetNode.getDeclaredDeps())),
            Suppliers.ofInstance(ruleResolver.requireAllRules(targetNode.getExtraDeps())),
            ruleFactoryParams.getProjectFilesystem(),
            targetNode.getCellNames());
    return description.createBuildRule(targetGraph, params, ruleResolver, arg);
  }