Program: 111027
Project: 111027
Buggy source:
public static RuleConfiguredTargetBuilder createAndroidBinary(RuleContext ruleContext,NestedSetBuilder<Artifact> filesBuilder,Artifact deployJar,JavaCommon javaCommon,AndroidCommon androidCommon,JavaSemantics javaSemantics,AndroidSemantics androidSemantics,AndroidTools tools,NativeLibs nativeLibs,ApplicationManifest applicationManifest,ResourceApk resourceApk,ResourceApk incrementalResourceApk,ResourceApk splitResourceApk,JavaTargetAttributes resourceClasses,ImmutableList<Artifact> apksUnderTest,Artifact proguardMapping){
  ProguardOutput proguardOutput=applyProguard(ruleContext,androidCommon,deployJar,filesBuilder,resourceApk,ruleContext.getPrerequisiteArtifacts(PROGUARD_SPECS,Mode.TARGET).list(),proguardMapping,tools);
  Artifact jarToDex=proguardOutput.outputJar;
  Artifact debugKey=ruleContext.getHostPrerequisiteArtifact("String_Node_Str");
  DexingOutput dexingOutput=shouldDexWithJack(ruleContext) ? dexWithJack(ruleContext,androidCommon) : dex(ruleContext,androidSemantics,tools,getMultidexMode(ruleContext),ruleContext.getTokenizedStringListAttr("String_Node_Str"),deployJar,jarToDex,androidCommon,resourceClasses);
  Artifact unsignedApk=ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_BINARY_UNSIGNED_APK);
  Artifact signedApk=ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_BINARY_SIGNED_APK);
  ApkActionBuilder apkBuilder=new ApkActionBuilder(ruleContext,tools).classesDex(dexingOutput.classesDexZip).resourceApk(resourceApk.getArtifact()).javaResourceZip(dexingOutput.javaResourceJar).nativeLibs(nativeLibs);
  ruleContext.registerAction(apkBuilder.message("String_Node_Str").build(unsignedApk));
  ruleContext.registerAction(apkBuilder.message("String_Node_Str").signingKey(debugKey).build(signedApk));
  Artifact zipAlignedApk=zipalignApk(ruleContext,tools,signedApk,ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_BINARY_APK));
  filesBuilder.add(deployJar);
  filesBuilder.add(unsignedApk);
  filesBuilder.add(zipAlignedApk);
  NestedSet<Artifact> filesToBuild=filesBuilder.build();
  NestedSet<Artifact> coverageMetadata=(androidCommon.getInstrumentedJar() != null) ? NestedSetBuilder.create(Order.STABLE_ORDER,androidCommon.getInstrumentedJar()) : NestedSetBuilder.<Artifact>emptySet(Order.STABLE_ORDER);
  RuleConfiguredTargetBuilder builder=new RuleConfiguredTargetBuilder(ruleContext);
  Artifact incrementalApk=ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_BINARY_INCREMENTAL_APK);
  Artifact fullDeployMarker=ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.FULL_DEPLOY_MARKER);
  Artifact incrementalDeployMarker=ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.INCREMENTAL_DEPLOY_MARKER);
  Artifact splitDeployMarker=ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.SPLIT_DEPLOY_MARKER);
  Artifact incrementalDexManifest=ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.DEX_MANIFEST);
  ruleContext.registerAction(new SpawnAction.Builder().setMnemonic("String_Node_Str").setProgressMessage("String_Node_Str" + ruleContext.getLabel()).setExecutable(ruleContext.getExecutablePrerequisite("String_Node_Str",Mode.HOST)).addOutputArgument(incrementalDexManifest).addInputArguments(dexingOutput.shardDexZips).useParameterFile(ParameterFileType.UNQUOTED).build(ruleContext));
  Artifact stubData=ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.STUB_APPLICATION_DATA);
  Artifact stubDex=getStubDex(ruleContext,javaSemantics,androidSemantics,tools);
  ruleContext.registerAction(new ApkActionBuilder(ruleContext,tools).classesDex(stubDex).resourceApk(incrementalResourceApk.getArtifact()).javaResourceZip(dexingOutput.javaResourceJar).nativeLibs(nativeLibs).signingKey(debugKey).javaResourceFile(stubData).message("String_Node_Str").build(incrementalApk));
  Artifact argsArtifact=ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.MOBILE_INSTALL_ARGS);
  ruleContext.registerAction(new WriteAdbArgsAction(ruleContext.getActionOwner(),argsArtifact));
  createInstallAction(ruleContext,tools,false,fullDeployMarker,argsArtifact,incrementalDexManifest,incrementalResourceApk.getArtifact(),incrementalApk,stubData);
  createInstallAction(ruleContext,tools,true,incrementalDeployMarker,argsArtifact,incrementalDexManifest,incrementalResourceApk.getArtifact(),incrementalApk,stubData);
  NestedSetBuilder<Artifact> splitApkSetBuilder=NestedSetBuilder.stableOrder();
  for (int i=0; i < dexingOutput.shardDexZips.size(); i++) {
    String splitName="String_Node_Str" + (i + 1);
    Artifact splitApkResources=createSplitApkResources(ruleContext,tools,applicationManifest,splitName,true);
    Artifact splitApk=getDxArtifact(ruleContext,splitName + "String_Node_Str");
    ruleContext.registerAction(new ApkActionBuilder(ruleContext,tools).classesDex(dexingOutput.shardDexZips.get(i)).resourceApk(splitApkResources).signingKey(debugKey).message("String_Node_Str" + (i + 1)).build(splitApk));
    splitApkSetBuilder.add(splitApk);
  }
  Artifact nativeSplitApkResources=createSplitApkResources(ruleContext,tools,applicationManifest,"String_Node_Str",false);
  Artifact nativeSplitApk=getDxArtifact(ruleContext,"String_Node_Str");
  ruleContext.registerAction(new ApkActionBuilder(ruleContext,tools).resourceApk(nativeSplitApkResources).signingKey(debugKey).message("String_Node_Str").nativeLibs(nativeLibs).build(nativeSplitApk));
  splitApkSetBuilder.add(nativeSplitApk);
  Artifact javaSplitApkResources=createSplitApkResources(ruleContext,tools,applicationManifest,"String_Node_Str",false);
  Artifact javaSplitApk=getDxArtifact(ruleContext,"String_Node_Str");
  ruleContext.registerAction(new ApkActionBuilder(ruleContext,tools).resourceApk(javaSplitApkResources).javaResourceZip(dexingOutput.javaResourceJar).signingKey(debugKey).message("String_Node_Str").build(javaSplitApk));
  splitApkSetBuilder.add(javaSplitApk);
  Artifact resourceSplitApk=getDxArtifact(ruleContext,"String_Node_Str");
  ruleContext.registerAction(new ApkActionBuilder(ruleContext,tools).resourceApk(splitResourceApk.getArtifact()).signingKey(debugKey).message("String_Node_Str").build(resourceSplitApk));
  splitApkSetBuilder.add(resourceSplitApk);
  Artifact splitMainApkResources=getDxArtifact(ruleContext,"String_Node_Str");
  ruleContext.registerAction(new SpawnAction.Builder().setMnemonic("String_Node_Str").setProgressMessage("String_Node_Str").setExecutable(ruleContext.getExecutablePrerequisite("String_Node_Str",Mode.HOST)).addArgument("String_Node_Str").addInputArgument(resourceApk.getArtifact()).addArgument("String_Node_Str").addOutputArgument(splitMainApkResources).build(ruleContext));
  NestedSet<Artifact> splitApks=splitApkSetBuilder.build();
  Artifact splitMainApk=getDxArtifact(ruleContext,"String_Node_Str");
  ruleContext.registerAction(new ApkActionBuilder(ruleContext,tools).resourceApk(splitMainApkResources).classesDex(stubDex).signingKey(debugKey).message("String_Node_Str").build(splitMainApk));
  splitApkSetBuilder.add(splitMainApk);
  NestedSet<Artifact> allSplitApks=splitApkSetBuilder.build();
  createSplitInstallAction(ruleContext,tools,splitDeployMarker,argsArtifact,splitMainApk,splitApks,stubData);
  NestedSet<Artifact> splitOutputGroup=NestedSetBuilder.<Artifact>stableOrder().addTransitive(allSplitApks).add(splitDeployMarker).build();
  androidCommon.addTransitiveInfoProviders(builder,tools);
  androidSemantics.addTransitiveInfoProviders(builder,ruleContext,javaCommon,androidCommon,jarToDex,resourceApk,zipAlignedApk,apksUnderTest);
  if (proguardOutput.mapping != null) {
    builder.add(ProguardMappingProvider.class,new ProguardMappingProvider(proguardOutput.mapping));
  }
  return builder.setFilesToBuild(filesToBuild).add(RunfilesProvider.class,RunfilesProvider.simple(new Runfiles.Builder().addRunfiles(ruleContext,RunfilesProvider.DEFAULT_RUNFILES).addTransitiveArtifacts(filesToBuild).build())).add(ApkProvider.class,new ApkProvider(NestedSetBuilder.create(Order.STABLE_ORDER,zipAlignedApk),coverageMetadata)).add(AndroidPreDexJarProvider.class,new AndroidPreDexJarProvider(jarToDex)).addOutputGroup("String_Node_Str",fullDeployMarker).addOutputGroup("String_Node_Str",incrementalDeployMarker).addOutputGroup("String_Node_Str",splitOutputGroup);
}

Fixed version (ground truth):
public static RuleConfiguredTargetBuilder createAndroidBinary(RuleContext ruleContext,NestedSetBuilder<Artifact> filesBuilder,Artifact deployJar,JavaCommon javaCommon,AndroidCommon androidCommon,JavaSemantics javaSemantics,AndroidSemantics androidSemantics,AndroidTools tools,NativeLibs nativeLibs,ApplicationManifest applicationManifest,ResourceApk resourceApk,ResourceApk incrementalResourceApk,ResourceApk splitResourceApk,JavaTargetAttributes resourceClasses,ImmutableList<Artifact> apksUnderTest,Artifact proguardMapping){
  ProguardOutput proguardOutput=applyProguard(ruleContext,androidCommon,deployJar,filesBuilder,resourceApk,ruleContext.getPrerequisiteArtifacts(PROGUARD_SPECS,Mode.TARGET).list(),proguardMapping,tools);
  Artifact jarToDex=proguardOutput.outputJar;
  Artifact debugKey=ruleContext.getHostPrerequisiteArtifact("String_Node_Str");
  DexingOutput dexingOutput=shouldDexWithJack(ruleContext) ? dexWithJack(ruleContext,androidCommon) : dex(ruleContext,androidSemantics,tools,getMultidexMode(ruleContext),ruleContext.getTokenizedStringListAttr("String_Node_Str"),deployJar,jarToDex,androidCommon,resourceClasses);
  Artifact unsignedApk=ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_BINARY_UNSIGNED_APK);
  Artifact signedApk=ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_BINARY_SIGNED_APK);
  ApkActionBuilder apkBuilder=new ApkActionBuilder(ruleContext,tools).classesDex(dexingOutput.classesDexZip).resourceApk(resourceApk.getArtifact()).javaResourceZip(dexingOutput.javaResourceJar).nativeLibs(nativeLibs);
  ruleContext.registerAction(apkBuilder.message("String_Node_Str").build(unsignedApk));
  ruleContext.registerAction(apkBuilder.message("String_Node_Str").signingKey(debugKey).build(signedApk));
  Artifact zipAlignedApk=zipalignApk(ruleContext,tools,signedApk,ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_BINARY_APK));
  filesBuilder.add(deployJar);
  filesBuilder.add(unsignedApk);
  filesBuilder.add(zipAlignedApk);
  NestedSet<Artifact> filesToBuild=filesBuilder.build();
  NestedSet<Artifact> coverageMetadata=(androidCommon.getInstrumentedJar() != null) ? NestedSetBuilder.create(Order.STABLE_ORDER,androidCommon.getInstrumentedJar()) : NestedSetBuilder.<Artifact>emptySet(Order.STABLE_ORDER);
  RuleConfiguredTargetBuilder builder=new RuleConfiguredTargetBuilder(ruleContext);
  Artifact incrementalApk=ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_BINARY_INCREMENTAL_APK);
  Artifact fullDeployMarker=ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.FULL_DEPLOY_MARKER);
  Artifact incrementalDeployMarker=ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.INCREMENTAL_DEPLOY_MARKER);
  Artifact splitDeployMarker=ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.SPLIT_DEPLOY_MARKER);
  Artifact incrementalDexManifest=ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.DEX_MANIFEST);
  ruleContext.registerAction(new SpawnAction.Builder().setMnemonic("String_Node_Str").setProgressMessage("String_Node_Str" + ruleContext.getLabel()).setExecutable(ruleContext.getExecutablePrerequisite("String_Node_Str",Mode.HOST)).addOutputArgument(incrementalDexManifest).addInputArguments(dexingOutput.shardDexZips).useParameterFile(ParameterFileType.UNQUOTED).build(ruleContext));
  Artifact stubData=ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.STUB_APPLICATION_DATA);
  ruleContext.registerAction(new ApkActionBuilder(ruleContext,tools).classesDex(getStubDex(ruleContext,javaSemantics,androidSemantics,tools,false)).resourceApk(incrementalResourceApk.getArtifact()).javaResourceZip(dexingOutput.javaResourceJar).nativeLibs(nativeLibs).signingKey(debugKey).javaResourceFile(stubData).message("String_Node_Str").build(incrementalApk));
  Artifact argsArtifact=ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.MOBILE_INSTALL_ARGS);
  ruleContext.registerAction(new WriteAdbArgsAction(ruleContext.getActionOwner(),argsArtifact));
  createInstallAction(ruleContext,tools,false,fullDeployMarker,argsArtifact,incrementalDexManifest,incrementalResourceApk.getArtifact(),incrementalApk,stubData);
  createInstallAction(ruleContext,tools,true,incrementalDeployMarker,argsArtifact,incrementalDexManifest,incrementalResourceApk.getArtifact(),incrementalApk,stubData);
  NestedSetBuilder<Artifact> splitApkSetBuilder=NestedSetBuilder.stableOrder();
  for (int i=0; i < dexingOutput.shardDexZips.size(); i++) {
    String splitName="String_Node_Str" + (i + 1);
    Artifact splitApkResources=createSplitApkResources(ruleContext,tools,applicationManifest,splitName,true);
    Artifact splitApk=getDxArtifact(ruleContext,splitName + "String_Node_Str");
    ruleContext.registerAction(new ApkActionBuilder(ruleContext,tools).classesDex(dexingOutput.shardDexZips.get(i)).resourceApk(splitApkResources).signingKey(debugKey).message("String_Node_Str" + (i + 1)).build(splitApk));
    splitApkSetBuilder.add(splitApk);
  }
  Artifact nativeSplitApkResources=createSplitApkResources(ruleContext,tools,applicationManifest,"String_Node_Str",false);
  Artifact nativeSplitApk=getDxArtifact(ruleContext,"String_Node_Str");
  ruleContext.registerAction(new ApkActionBuilder(ruleContext,tools).resourceApk(nativeSplitApkResources).signingKey(debugKey).message("String_Node_Str").nativeLibs(nativeLibs).build(nativeSplitApk));
  splitApkSetBuilder.add(nativeSplitApk);
  Artifact javaSplitApkResources=createSplitApkResources(ruleContext,tools,applicationManifest,"String_Node_Str",false);
  Artifact javaSplitApk=getDxArtifact(ruleContext,"String_Node_Str");
  ruleContext.registerAction(new ApkActionBuilder(ruleContext,tools).resourceApk(javaSplitApkResources).javaResourceZip(dexingOutput.javaResourceJar).signingKey(debugKey).message("String_Node_Str").build(javaSplitApk));
  splitApkSetBuilder.add(javaSplitApk);
  Artifact resourceSplitApk=getDxArtifact(ruleContext,"String_Node_Str");
  ruleContext.registerAction(new ApkActionBuilder(ruleContext,tools).resourceApk(splitResourceApk.getArtifact()).signingKey(debugKey).message("String_Node_Str").build(resourceSplitApk));
  splitApkSetBuilder.add(resourceSplitApk);
  Artifact splitMainApkResources=getDxArtifact(ruleContext,"String_Node_Str");
  ruleContext.registerAction(new SpawnAction.Builder().setMnemonic("String_Node_Str").setProgressMessage("String_Node_Str").setExecutable(ruleContext.getExecutablePrerequisite("String_Node_Str",Mode.HOST)).addArgument("String_Node_Str").addInputArgument(resourceApk.getArtifact()).addArgument("String_Node_Str").addOutputArgument(splitMainApkResources).build(ruleContext));
  NestedSet<Artifact> splitApks=splitApkSetBuilder.build();
  Artifact splitMainApk=getDxArtifact(ruleContext,"String_Node_Str");
  ruleContext.registerAction(new ApkActionBuilder(ruleContext,tools).resourceApk(splitMainApkResources).classesDex(getStubDex(ruleContext,javaSemantics,androidSemantics,tools,true)).signingKey(debugKey).message("String_Node_Str").build(splitMainApk));
  splitApkSetBuilder.add(splitMainApk);
  NestedSet<Artifact> allSplitApks=splitApkSetBuilder.build();
  createSplitInstallAction(ruleContext,tools,splitDeployMarker,argsArtifact,splitMainApk,splitApks,stubData);
  NestedSet<Artifact> splitOutputGroup=NestedSetBuilder.<Artifact>stableOrder().addTransitive(allSplitApks).add(splitDeployMarker).build();
  androidCommon.addTransitiveInfoProviders(builder,tools);
  androidSemantics.addTransitiveInfoProviders(builder,ruleContext,javaCommon,androidCommon,jarToDex,resourceApk,zipAlignedApk,apksUnderTest);
  if (proguardOutput.mapping != null) {
    builder.add(ProguardMappingProvider.class,new ProguardMappingProvider(proguardOutput.mapping));
  }
  return builder.setFilesToBuild(filesToBuild).add(RunfilesProvider.class,RunfilesProvider.simple(new Runfiles.Builder().addRunfiles(ruleContext,RunfilesProvider.DEFAULT_RUNFILES).addTransitiveArtifacts(filesToBuild).build())).add(ApkProvider.class,new ApkProvider(NestedSetBuilder.create(Order.STABLE_ORDER,zipAlignedApk),coverageMetadata)).add(AndroidPreDexJarProvider.class,new AndroidPreDexJarProvider(jarToDex)).addOutputGroup("String_Node_Str",fullDeployMarker).addOutputGroup("String_Node_Str",incrementalDeployMarker).addOutputGroup("String_Node_Str",splitOutputGroup);
}