Program: 110788
Project: 110788
Buggy source:
/** 
 * Packages up the manifest with resources, and generates the R.java.
 * @throws InterruptedException
 * @deprecated in favor of {@link ApplicationManifest#packWithDataAndResources}.
 */
@Deprecated public ResourceApk packWithResources(Artifact resourceApk,RuleContext ruleContext,ResourceDependencies resourceDeps,boolean createSource,Artifact proguardCfg,@Nullable Artifact mainDexProguardCfg) throws InterruptedException {
  TransitiveInfoCollection resourcesPrerequisite=ruleContext.getPrerequisite("String_Node_Str",Mode.TARGET);
  ResourceContainer resourceContainer=Iterables.getOnlyElement(resourcesPrerequisite.getProvider(AndroidResourcesProvider.class).getDirectAndroidResources());
  List<ResourceContainer> resourceContainers=ImmutableList.<ResourceContainer>builder().addAll(resourceDeps.getResources()).build();
  if (Iterables.size(resourceDeps.getResources()) > 1) {
    if (resourceContainer.getConstantsInlined() && !resourceContainer.getArtifacts(ResourceType.RESOURCES).isEmpty()) {
      ruleContext.ruleError("String_Node_Str" + "String_Node_Str" + AndroidCommon.getAndroidResources(ruleContext).getLabel() + "String_Node_Str");
      return null;
    }
  }
  AndroidAaptActionHelper aaptActionHelper=new AndroidAaptActionHelper(ruleContext,getManifest(),Lists.newArrayList(resourceContainers));
  String resourceConfigurationFilters=ResourceConfigurationFilter.extractFilters(ruleContext);
  List<String> uncompressedExtensions=ruleContext.getTokenizedStringListAttr("String_Node_Str");
  ImmutableList.Builder<String> additionalAaptOpts=ImmutableList.<String>builder();
  for (  String extension : uncompressedExtensions) {
    additionalAaptOpts.add("String_Node_Str").add(extension);
  }
  if (!resourceConfigurationFilters.isEmpty()) {
    additionalAaptOpts.add("String_Node_Str").add(resourceConfigurationFilters);
  }
  Artifact javaSourcesJar=null;
  if (createSource) {
    javaSourcesJar=ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_JAVA_SOURCE_JAR);
    aaptActionHelper.createGenerateResourceSymbolsAction(javaSourcesJar,null,resourceContainer.getJavaPackage(),true);
  }
  List<String> densities=ruleContext.getTokenizedStringListAttr("String_Node_Str");
  aaptActionHelper.createGenerateApkAction(resourceApk,resourceContainer.getRenameManifestPackage(),additionalAaptOpts.build(),densities);
  ResourceContainer updatedResources=resourceContainer.toBuilder().setLabel(ruleContext.getLabel()).setApk(resourceApk).setManifest(getManifest()).setJavaSourceJar(javaSourcesJar).setJavaClassJar(null).setSymbols(null).build();
  aaptActionHelper.createGenerateProguardAction(proguardCfg,mainDexProguardCfg);
  return new ResourceApk(resourceApk,updatedResources.getJavaSourceJar(),updatedResources.getJavaClassJar(),resourceDeps,updatedResources,manifest,proguardCfg,mainDexProguardCfg,true);
}

Fixed version (ground truth):
/** 
 * Packages up the manifest with resources, and generates the R.java.
 * @throws InterruptedException
 * @deprecated in favor of {@link ApplicationManifest#packWithDataAndResources}.
 */
@Deprecated public ResourceApk packWithResources(Artifact resourceApk,RuleContext ruleContext,ResourceDependencies resourceDeps,boolean createSource,Artifact proguardCfg,@Nullable Artifact mainDexProguardCfg) throws InterruptedException {
  TransitiveInfoCollection resourcesPrerequisite=ruleContext.getPrerequisite("String_Node_Str",Mode.TARGET);
  ResourceContainer resourceContainer=Iterables.getOnlyElement(resourcesPrerequisite.getProvider(AndroidResourcesProvider.class).getDirectAndroidResources());
  List<ResourceContainer> resourceContainers=ImmutableList.<ResourceContainer>builder().addAll(resourceDeps.getResources()).build();
  if (Iterables.size(resourceDeps.getResources()) > 1) {
    if (resourceContainer.getConstantsInlined() && !resourceContainer.getArtifacts(ResourceType.RESOURCES).isEmpty()) {
      ruleContext.ruleError("String_Node_Str" + "String_Node_Str" + AndroidCommon.getAndroidResources(ruleContext).getLabel() + "String_Node_Str");
      return null;
    }
  }
  AndroidAaptActionHelper aaptActionHelper=new AndroidAaptActionHelper(ruleContext,getManifest(),Lists.newArrayList(resourceContainers));
  ResourceFilter resourceFilter=ResourceFilter.fromRuleContext(ruleContext);
  List<String> uncompressedExtensions=ruleContext.getTokenizedStringListAttr("String_Node_Str");
  ImmutableList.Builder<String> additionalAaptOpts=ImmutableList.<String>builder();
  for (  String extension : uncompressedExtensions) {
    additionalAaptOpts.add("String_Node_Str").add(extension);
  }
  if (resourceFilter.hasConfigurationFilters() && !resourceFilter.isPrefiltering()) {
    additionalAaptOpts.add("String_Node_Str").add(resourceFilter.getConfigurationFilterString());
  }
  Artifact javaSourcesJar=null;
  if (createSource) {
    javaSourcesJar=ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_JAVA_SOURCE_JAR);
    aaptActionHelper.createGenerateResourceSymbolsAction(javaSourcesJar,null,resourceContainer.getJavaPackage(),true);
  }
  aaptActionHelper.createGenerateApkAction(resourceApk,resourceContainer.getRenameManifestPackage(),additionalAaptOpts.build(),resourceFilter.getDensities());
  ResourceContainer updatedResources=resourceContainer.toBuilder().setLabel(ruleContext.getLabel()).setApk(resourceApk).setManifest(getManifest()).setJavaSourceJar(javaSourcesJar).setJavaClassJar(null).setSymbols(null).build();
  aaptActionHelper.createGenerateProguardAction(proguardCfg,mainDexProguardCfg);
  return new ResourceApk(resourceApk,updatedResources.getJavaSourceJar(),updatedResources.getJavaClassJar(),resourceDeps,updatedResources,manifest,proguardCfg,mainDexProguardCfg,true);
}