// TODO(bazel-team): this whole defaulting - overriding executable, runfiles and files_to_build
 // is getting out of hand. Clean this whole mess up.
 private static ConfiguredTarget createTarget(RuleContext ruleContext, Object target)
     throws EvalException {
   Artifact executable = getExecutable(ruleContext, target);
   RuleConfiguredTargetBuilder builder = new RuleConfiguredTargetBuilder(ruleContext);
   // Set the default files to build.
   NestedSetBuilder<Artifact> filesToBuild =
       NestedSetBuilder.<Artifact>stableOrder().addAll(ruleContext.getOutputArtifacts());
   if (executable != null) {
     filesToBuild.add(executable);
   }
   builder.setFilesToBuild(filesToBuild.build());
   return addStructFields(ruleContext, builder, target, executable);
 }
 // TODO(bazel-team): this whole defaulting - overriding executable, runfiles and files_to_build
 // is getting out of hand. Clean this whole mess up.
 private static ConfiguredTarget createTarget(
     RuleContext ruleContext,
     Object target,
     Map<String, Class<? extends TransitiveInfoProvider>> registeredProviderTypes)
     throws EvalException {
   Artifact executable = getExecutable(ruleContext, target);
   RuleConfiguredTargetBuilder builder = new RuleConfiguredTargetBuilder(ruleContext);
   // Set the default files to build.
   NestedSetBuilder<Artifact> filesToBuild =
       NestedSetBuilder.<Artifact>stableOrder().addAll(ruleContext.getOutputArtifacts());
   if (executable != null) {
     filesToBuild.add(executable);
   }
   builder.setFilesToBuild(filesToBuild.build());
   return addStructFieldsAndBuild(
       ruleContext, builder, target, executable, registeredProviderTypes);
 }