Program: 53186
Project: 53186
Buggy source:
@Test @SuppressWarnings("String_Node_Str") public void createCxxLibraryBuildRules(){
  BuildRuleResolver resolver=new BuildRuleResolver();
  SourcePathResolver pathResolver=new SourcePathResolver(resolver);
  CxxPlatform cxxPlatform=CxxLibraryBuilder.createDefaultPlatform();
  String sourceName="String_Node_Str";
  String genHeaderName="String_Node_Str";
  BuildTarget genHeaderTarget=BuildTargetFactory.newInstance("String_Node_Str");
  GenruleBuilder genHeaderBuilder=GenruleBuilder.newGenruleBuilder(genHeaderTarget).setOut(genHeaderName);
  genHeaderBuilder.build(resolver);
  String genSourceName="String_Node_Str";
  BuildTarget genSourceTarget=BuildTargetFactory.newInstance("String_Node_Str");
  GenruleBuilder genSourceBuilder=GenruleBuilder.newGenruleBuilder(genSourceTarget).setOut(genSourceName);
  genSourceBuilder.build(resolver);
  final BuildRule header=new FakeBuildRule("String_Node_Str",pathResolver);
  final BuildRule headerSymlinkTree=new FakeBuildRule("String_Node_Str",pathResolver);
  final Path headerSymlinkTreeRoot=Paths.get("String_Node_Str");
  final BuildRule staticLibraryDep=new FakeBuildRule("String_Node_Str",pathResolver);
  final Path staticLibraryOutput=Paths.get("String_Node_Str");
  final BuildRule sharedLibraryDep=new FakeBuildRule("String_Node_Str",pathResolver);
  final Path sharedLibraryOutput=Paths.get("String_Node_Str");
  final String sharedLibrarySoname="String_Node_Str";
  BuildTarget depTarget=BuildTargetFactory.newInstance("String_Node_Str");
  BuildRuleParams depParams=BuildRuleParamsFactory.createTrivialBuildRuleParams(depTarget);
  AbstractCxxLibrary dep=new AbstractCxxLibrary(depParams,pathResolver){
    @Override public CxxPreprocessorInput getCxxPreprocessorInput(    CxxPlatform cxxPlatform,    HeaderVisibility headerVisibility){
      return CxxPreprocessorInput.builder().addRules(header.getBuildTarget(),headerSymlinkTree.getBuildTarget()).addIncludeRoots(headerSymlinkTreeRoot).build();
    }
    @Override public ImmutableMap<BuildTarget,CxxPreprocessorInput> getTransitiveCxxPreprocessorInput(    CxxPlatform cxxPlatform,    HeaderVisibility headerVisibility){
      return ImmutableMap.of(getBuildTarget(),getCxxPreprocessorInput(cxxPlatform,headerVisibility));
    }
    @Override public NativeLinkableInput getNativeLinkableInput(    CxxPlatform cxxPlatform,    Linker.LinkableDepType type){
      return type == Linker.LinkableDepType.STATIC ? NativeLinkableInput.of(ImmutableList.<SourcePath>of(new BuildTargetSourcePath(staticLibraryDep.getBuildTarget())),ImmutableList.of(staticLibraryOutput.toString()),ImmutableSet.<Path>of()) : NativeLinkableInput.of(ImmutableList.<SourcePath>of(new BuildTargetSourcePath(sharedLibraryDep.getBuildTarget())),ImmutableList.of(sharedLibraryOutput.toString()),ImmutableSet.<Path>of());
    }
    @Override public Optional<Linker.LinkableDepType> getPreferredLinkage(    CxxPlatform cxxPlatform){
      return Optional.absent();
    }
    @Override public PythonPackageComponents getPythonPackageComponents(    CxxPlatform cxxPlatform){
      return PythonPackageComponents.of(ImmutableMap.<Path,SourcePath>of(),ImmutableMap.<Path,SourcePath>of(),ImmutableMap.<Path,SourcePath>of(Paths.get(sharedLibrarySoname),new PathSourcePath(getProjectFilesystem(),sharedLibraryOutput)),ImmutableSet.<SourcePath>of(),Optional.<Boolean>absent());
    }
    @Override public Iterable<AndroidPackageable> getRequiredPackageables(){
      return ImmutableList.of();
    }
    @Override public void addToCollector(    AndroidPackageableCollector collector){
    }
    @Override public ImmutableMap<String,SourcePath> getSharedLibraries(    CxxPlatform cxxPlatform){
      return ImmutableMap.of();
    }
    @Override public boolean isTestedBy(    BuildTarget buildTarget){
      return false;
    }
  }
;
  resolver.addAllToIndex(ImmutableList.of(header,headerSymlinkTree,staticLibraryDep,sharedLibraryDep,dep));
  BuildTarget target=BuildTargetFactory.newInstance("String_Node_Str");
  CxxSourceRuleFactory cxxSourceRuleFactory=CxxSourceRuleFactoryHelper.of(target,cxxPlatform);
  CxxLibraryBuilder cxxLibraryBuilder=(CxxLibraryBuilder)new CxxLibraryBuilder(target).setExportedHeaders(ImmutableMap.<String,SourcePath>of(genHeaderName,new BuildTargetSourcePath(genHeaderTarget))).setSrcs(ImmutableMap.of(sourceName,SourceWithFlags.of(new TestSourcePath(sourceName)),genSourceName,SourceWithFlags.of(new BuildTargetSourcePath(genSourceTarget)))).setFrameworkSearchPaths(ImmutableSet.of(Paths.get("String_Node_Str"),Paths.get("String_Node_Str"))).setDeps(ImmutableSortedSet.of(dep.getBuildTarget()));
  CxxLibrary rule=(CxxLibrary)cxxLibraryBuilder.build(resolver,new FakeProjectFilesystem(),TargetGraphFactory.newInstance(cxxLibraryBuilder.build(),genSourceBuilder.build(),genHeaderBuilder.build(),GenruleBuilder.newGenruleBuilder(depTarget).build()));
  Path headerRoot=CxxDescriptionEnhancer.getHeaderSymlinkTreePath(target,cxxPlatform.getFlavor(),HeaderVisibility.PUBLIC);
  assertEquals(CxxPreprocessorInput.builder().addRules(CxxDescriptionEnhancer.createHeaderSymlinkTreeTarget(target,cxxPlatform.getFlavor(),HeaderVisibility.PUBLIC)).setIncludes(CxxHeaders.builder().putNameToPathMap(Paths.get(genHeaderName),new BuildTargetSourcePath(genHeaderTarget)).putFullNameToPathMap(headerRoot.resolve(genHeaderName),new BuildTargetSourcePath(genHeaderTarget)).build()).addIncludeRoots(CxxDescriptionEnhancer.getHeaderSymlinkTreePath(target,cxxPlatform.getFlavor(),HeaderVisibility.PUBLIC)).addFrameworkRoots(Paths.get("String_Node_Str"),Paths.get("String_Node_Str")).build(),rule.getCxxPreprocessorInput(cxxPlatform,HeaderVisibility.PUBLIC));
  rule.getNativeLinkableInput(cxxPlatform,Linker.LinkableDepType.STATIC);
  BuildRule staticRule=resolver.getRule(CxxDescriptionEnhancer.createStaticLibraryBuildTarget(target,cxxPlatform.getFlavor(),CxxSourceRuleFactory.PicType.PDC));
  assertNotNull(staticRule);
  assertEquals(ImmutableSet.of(cxxSourceRuleFactory.createCompileBuildTarget("String_Node_Str",CxxSourceRuleFactory.PicType.PDC),cxxSourceRuleFactory.createCompileBuildTarget(genSourceName,CxxSourceRuleFactory.PicType.PDC)),FluentIterable.from(staticRule.getDeps()).transform(HasBuildTarget.TO_TARGET).toSet());
  BuildRule staticPreprocessRule1=resolver.getRule(cxxSourceRuleFactory.createPreprocessBuildTarget("String_Node_Str",CxxSource.Type.CXX,CxxSourceRuleFactory.PicType.PDC));
  assertNotNull(staticPreprocessRule1);
  assertEquals(ImmutableSet.of(genHeaderTarget,headerSymlinkTree.getBuildTarget(),header.getBuildTarget(),CxxDescriptionEnhancer.createHeaderSymlinkTreeTarget(target,cxxPlatform.getFlavor(),HeaderVisibility.PRIVATE),CxxDescriptionEnhancer.createHeaderSymlinkTreeTarget(target,cxxPlatform.getFlavor(),HeaderVisibility.PUBLIC)),FluentIterable.from(staticPreprocessRule1.getDeps()).transform(HasBuildTarget.TO_TARGET).toSet());
  BuildRule staticCompileRule1=resolver.getRule(cxxSourceRuleFactory.createCompileBuildTarget("String_Node_Str",CxxSourceRuleFactory.PicType.PDC));
  assertNotNull(staticCompileRule1);
  assertEquals(ImmutableSet.of(staticPreprocessRule1.getBuildTarget()),FluentIterable.from(staticCompileRule1.getDeps()).transform(HasBuildTarget.TO_TARGET).toSet());
  BuildRule staticPreprocessRule2=resolver.getRule(cxxSourceRuleFactory.createPreprocessBuildTarget(genSourceName,CxxSource.Type.CXX,CxxSourceRuleFactory.PicType.PDC));
  assertNotNull(staticPreprocessRule2);
  assertEquals(ImmutableSet.of(genHeaderTarget,genSourceTarget,headerSymlinkTree.getBuildTarget(),header.getBuildTarget(),CxxDescriptionEnhancer.createHeaderSymlinkTreeTarget(target,cxxPlatform.getFlavor(),HeaderVisibility.PRIVATE),CxxDescriptionEnhancer.createHeaderSymlinkTreeTarget(target,cxxPlatform.getFlavor(),HeaderVisibility.PUBLIC)),FluentIterable.from(staticPreprocessRule2.getDeps()).transform(HasBuildTarget.TO_TARGET).toSet());
  BuildRule staticCompileRule2=resolver.getRule(cxxSourceRuleFactory.createCompileBuildTarget(genSourceName,CxxSourceRuleFactory.PicType.PDC));
  assertNotNull(staticCompileRule2);
  assertEquals(ImmutableSet.of(staticPreprocessRule2.getBuildTarget()),FluentIterable.from(staticCompileRule2.getDeps()).transform(HasBuildTarget.TO_TARGET).toSet());
  rule.getNativeLinkableInput(cxxPlatform,Linker.LinkableDepType.SHARED);
  BuildRule sharedRule=resolver.getRule(CxxDescriptionEnhancer.createSharedLibraryBuildTarget(target,cxxPlatform.getFlavor()));
  assertNotNull(sharedRule);
  assertEquals(ImmutableSet.of(sharedLibraryDep.getBuildTarget(),cxxSourceRuleFactory.createCompileBuildTarget("String_Node_Str",CxxSourceRuleFactory.PicType.PIC),cxxSourceRuleFactory.createCompileBuildTarget(genSourceName,CxxSourceRuleFactory.PicType.PIC)),FluentIterable.from(sharedRule.getDeps()).transform(HasBuildTarget.TO_TARGET).toSet());
  BuildRule sharedPreprocessRule1=resolver.getRule(cxxSourceRuleFactory.createPreprocessBuildTarget("String_Node_Str",CxxSource.Type.CXX,CxxSourceRuleFactory.PicType.PIC));
  assertNotNull(sharedPreprocessRule1);
  assertEquals(ImmutableSet.of(genHeaderTarget,headerSymlinkTree.getBuildTarget(),header.getBuildTarget(),CxxDescriptionEnhancer.createHeaderSymlinkTreeTarget(target,cxxPlatform.getFlavor(),HeaderVisibility.PRIVATE),CxxDescriptionEnhancer.createHeaderSymlinkTreeTarget(target,cxxPlatform.getFlavor(),HeaderVisibility.PUBLIC)),FluentIterable.from(sharedPreprocessRule1.getDeps()).transform(HasBuildTarget.TO_TARGET).toSet());
  BuildRule sharedCompileRule1=resolver.getRule(cxxSourceRuleFactory.createCompileBuildTarget("String_Node_Str",CxxSourceRuleFactory.PicType.PIC));
  assertNotNull(sharedCompileRule1);
  assertEquals(ImmutableSet.of(sharedPreprocessRule1.getBuildTarget()),FluentIterable.from(sharedCompileRule1.getDeps()).transform(HasBuildTarget.TO_TARGET).toSet());
  BuildRule sharedPreprocessRule2=resolver.getRule(cxxSourceRuleFactory.createPreprocessBuildTarget(genSourceName,CxxSource.Type.CXX,CxxSourceRuleFactory.PicType.PIC));
  assertNotNull(sharedPreprocessRule2);
  assertEquals(ImmutableSet.of(genHeaderTarget,genSourceTarget,headerSymlinkTree.getBuildTarget(),header.getBuildTarget(),CxxDescriptionEnhancer.createHeaderSymlinkTreeTarget(target,cxxPlatform.getFlavor(),HeaderVisibility.PRIVATE),CxxDescriptionEnhancer.createHeaderSymlinkTreeTarget(target,cxxPlatform.getFlavor(),HeaderVisibility.PUBLIC)),FluentIterable.from(sharedPreprocessRule2.getDeps()).transform(HasBuildTarget.TO_TARGET).toSet());
  BuildRule sharedCompileRule2=resolver.getRule(cxxSourceRuleFactory.createCompileBuildTarget(genSourceName,CxxSourceRuleFactory.PicType.PIC));
  assertNotNull(sharedCompileRule2);
  assertEquals(ImmutableSet.of(sharedPreprocessRule2.getBuildTarget()),FluentIterable.from(sharedCompileRule2.getDeps()).transform(HasBuildTarget.TO_TARGET).toSet());
  PythonPackageComponents expectedPythonPackageComponents=PythonPackageComponents.of(ImmutableMap.<Path,SourcePath>of(),ImmutableMap.<Path,SourcePath>of(),ImmutableMap.<Path,SourcePath>of(Paths.get(CxxDescriptionEnhancer.getDefaultSharedLibrarySoname(target,cxxPlatform)),new BuildTargetSourcePath(sharedRule.getBuildTarget())),ImmutableSet.<SourcePath>of(),Optional.<Boolean>absent());
  assertEquals(expectedPythonPackageComponents,rule.getPythonPackageComponents(cxxPlatform));
}

Fixed version (ground truth):
@Test @SuppressWarnings("String_Node_Str") public void createCxxLibraryBuildRules(){
  BuildRuleResolver resolver=new BuildRuleResolver();
  SourcePathResolver pathResolver=new SourcePathResolver(resolver);
  CxxPlatform cxxPlatform=CxxLibraryBuilder.createDefaultPlatform();
  String sourceName="String_Node_Str";
  String genHeaderName="String_Node_Str";
  BuildTarget genHeaderTarget=BuildTargetFactory.newInstance("String_Node_Str");
  GenruleBuilder genHeaderBuilder=GenruleBuilder.newGenruleBuilder(genHeaderTarget).setOut(genHeaderName);
  genHeaderBuilder.build(resolver);
  String genSourceName="String_Node_Str";
  BuildTarget genSourceTarget=BuildTargetFactory.newInstance("String_Node_Str");
  GenruleBuilder genSourceBuilder=GenruleBuilder.newGenruleBuilder(genSourceTarget).setOut(genSourceName);
  genSourceBuilder.build(resolver);
  final BuildRule header=new FakeBuildRule("String_Node_Str",pathResolver);
  final BuildRule headerSymlinkTree=new FakeBuildRule("String_Node_Str",pathResolver);
  final Path headerSymlinkTreeRoot=Paths.get("String_Node_Str");
  final BuildRule staticLibraryDep=new FakeBuildRule("String_Node_Str",pathResolver);
  final Path staticLibraryOutput=Paths.get("String_Node_Str");
  final BuildRule sharedLibraryDep=new FakeBuildRule("String_Node_Str",pathResolver);
  final Path sharedLibraryOutput=Paths.get("String_Node_Str");
  final String sharedLibrarySoname="String_Node_Str";
  BuildTarget depTarget=BuildTargetFactory.newInstance("String_Node_Str");
  BuildRuleParams depParams=BuildRuleParamsFactory.createTrivialBuildRuleParams(depTarget);
  AbstractCxxLibrary dep=new AbstractCxxLibrary(depParams,pathResolver){
    @Override public CxxPreprocessorInput getCxxPreprocessorInput(    CxxPlatform cxxPlatform,    HeaderVisibility headerVisibility){
      return CxxPreprocessorInput.builder().addRules(header.getBuildTarget(),headerSymlinkTree.getBuildTarget()).addIncludeRoots(headerSymlinkTreeRoot).build();
    }
    @Override public ImmutableMap<BuildTarget,CxxPreprocessorInput> getTransitiveCxxPreprocessorInput(    CxxPlatform cxxPlatform,    HeaderVisibility headerVisibility){
      return ImmutableMap.of(getBuildTarget(),getCxxPreprocessorInput(cxxPlatform,headerVisibility));
    }
    @Override public NativeLinkableInput getNativeLinkableInput(    CxxPlatform cxxPlatform,    Linker.LinkableDepType type){
      return type == Linker.LinkableDepType.STATIC ? NativeLinkableInput.of(ImmutableList.<SourcePath>of(new BuildTargetSourcePath(staticLibraryDep.getBuildTarget())),ImmutableList.of(staticLibraryOutput.toString()),ImmutableSet.<Path>of()) : NativeLinkableInput.of(ImmutableList.<SourcePath>of(new BuildTargetSourcePath(sharedLibraryDep.getBuildTarget())),ImmutableList.of(sharedLibraryOutput.toString()),ImmutableSet.<Path>of());
    }
    @Override public NativeLinkable.Linkage getPreferredLinkage(    CxxPlatform cxxPlatform){
      return Linkage.ANY;
    }
    @Override public PythonPackageComponents getPythonPackageComponents(    CxxPlatform cxxPlatform){
      return PythonPackageComponents.of(ImmutableMap.<Path,SourcePath>of(),ImmutableMap.<Path,SourcePath>of(),ImmutableMap.<Path,SourcePath>of(Paths.get(sharedLibrarySoname),new PathSourcePath(getProjectFilesystem(),sharedLibraryOutput)),ImmutableSet.<SourcePath>of(),Optional.<Boolean>absent());
    }
    @Override public Iterable<AndroidPackageable> getRequiredPackageables(){
      return ImmutableList.of();
    }
    @Override public void addToCollector(    AndroidPackageableCollector collector){
    }
    @Override public ImmutableMap<String,SourcePath> getSharedLibraries(    CxxPlatform cxxPlatform){
      return ImmutableMap.of();
    }
    @Override public boolean isTestedBy(    BuildTarget buildTarget){
      return false;
    }
  }
;
  resolver.addAllToIndex(ImmutableList.of(header,headerSymlinkTree,staticLibraryDep,sharedLibraryDep,dep));
  BuildTarget target=BuildTargetFactory.newInstance("String_Node_Str");
  CxxSourceRuleFactory cxxSourceRuleFactory=CxxSourceRuleFactoryHelper.of(target,cxxPlatform);
  CxxLibraryBuilder cxxLibraryBuilder=(CxxLibraryBuilder)new CxxLibraryBuilder(target).setExportedHeaders(ImmutableMap.<String,SourcePath>of(genHeaderName,new BuildTargetSourcePath(genHeaderTarget))).setSrcs(ImmutableMap.of(sourceName,SourceWithFlags.of(new TestSourcePath(sourceName)),genSourceName,SourceWithFlags.of(new BuildTargetSourcePath(genSourceTarget)))).setFrameworkSearchPaths(ImmutableSet.of(Paths.get("String_Node_Str"),Paths.get("String_Node_Str"))).setDeps(ImmutableSortedSet.of(dep.getBuildTarget()));
  CxxLibrary rule=(CxxLibrary)cxxLibraryBuilder.build(resolver,new FakeProjectFilesystem(),TargetGraphFactory.newInstance(cxxLibraryBuilder.build(),genSourceBuilder.build(),genHeaderBuilder.build(),GenruleBuilder.newGenruleBuilder(depTarget).build()));
  Path headerRoot=CxxDescriptionEnhancer.getHeaderSymlinkTreePath(target,cxxPlatform.getFlavor(),HeaderVisibility.PUBLIC);
  assertEquals(CxxPreprocessorInput.builder().addRules(CxxDescriptionEnhancer.createHeaderSymlinkTreeTarget(target,cxxPlatform.getFlavor(),HeaderVisibility.PUBLIC)).setIncludes(CxxHeaders.builder().putNameToPathMap(Paths.get(genHeaderName),new BuildTargetSourcePath(genHeaderTarget)).putFullNameToPathMap(headerRoot.resolve(genHeaderName),new BuildTargetSourcePath(genHeaderTarget)).build()).addIncludeRoots(CxxDescriptionEnhancer.getHeaderSymlinkTreePath(target,cxxPlatform.getFlavor(),HeaderVisibility.PUBLIC)).addFrameworkRoots(Paths.get("String_Node_Str"),Paths.get("String_Node_Str")).build(),rule.getCxxPreprocessorInput(cxxPlatform,HeaderVisibility.PUBLIC));
  rule.getNativeLinkableInput(cxxPlatform,Linker.LinkableDepType.STATIC);
  BuildRule staticRule=resolver.getRule(CxxDescriptionEnhancer.createStaticLibraryBuildTarget(target,cxxPlatform.getFlavor(),CxxSourceRuleFactory.PicType.PDC));
  assertNotNull(staticRule);
  assertEquals(ImmutableSet.of(cxxSourceRuleFactory.createCompileBuildTarget("String_Node_Str",CxxSourceRuleFactory.PicType.PDC),cxxSourceRuleFactory.createCompileBuildTarget(genSourceName,CxxSourceRuleFactory.PicType.PDC)),FluentIterable.from(staticRule.getDeps()).transform(HasBuildTarget.TO_TARGET).toSet());
  BuildRule staticPreprocessRule1=resolver.getRule(cxxSourceRuleFactory.createPreprocessBuildTarget("String_Node_Str",CxxSource.Type.CXX,CxxSourceRuleFactory.PicType.PDC));
  assertNotNull(staticPreprocessRule1);
  assertEquals(ImmutableSet.of(genHeaderTarget,headerSymlinkTree.getBuildTarget(),header.getBuildTarget(),CxxDescriptionEnhancer.createHeaderSymlinkTreeTarget(target,cxxPlatform.getFlavor(),HeaderVisibility.PRIVATE),CxxDescriptionEnhancer.createHeaderSymlinkTreeTarget(target,cxxPlatform.getFlavor(),HeaderVisibility.PUBLIC)),FluentIterable.from(staticPreprocessRule1.getDeps()).transform(HasBuildTarget.TO_TARGET).toSet());
  BuildRule staticCompileRule1=resolver.getRule(cxxSourceRuleFactory.createCompileBuildTarget("String_Node_Str",CxxSourceRuleFactory.PicType.PDC));
  assertNotNull(staticCompileRule1);
  assertEquals(ImmutableSet.of(staticPreprocessRule1.getBuildTarget()),FluentIterable.from(staticCompileRule1.getDeps()).transform(HasBuildTarget.TO_TARGET).toSet());
  BuildRule staticPreprocessRule2=resolver.getRule(cxxSourceRuleFactory.createPreprocessBuildTarget(genSourceName,CxxSource.Type.CXX,CxxSourceRuleFactory.PicType.PDC));
  assertNotNull(staticPreprocessRule2);
  assertEquals(ImmutableSet.of(genHeaderTarget,genSourceTarget,headerSymlinkTree.getBuildTarget(),header.getBuildTarget(),CxxDescriptionEnhancer.createHeaderSymlinkTreeTarget(target,cxxPlatform.getFlavor(),HeaderVisibility.PRIVATE),CxxDescriptionEnhancer.createHeaderSymlinkTreeTarget(target,cxxPlatform.getFlavor(),HeaderVisibility.PUBLIC)),FluentIterable.from(staticPreprocessRule2.getDeps()).transform(HasBuildTarget.TO_TARGET).toSet());
  BuildRule staticCompileRule2=resolver.getRule(cxxSourceRuleFactory.createCompileBuildTarget(genSourceName,CxxSourceRuleFactory.PicType.PDC));
  assertNotNull(staticCompileRule2);
  assertEquals(ImmutableSet.of(staticPreprocessRule2.getBuildTarget()),FluentIterable.from(staticCompileRule2.getDeps()).transform(HasBuildTarget.TO_TARGET).toSet());
  rule.getNativeLinkableInput(cxxPlatform,Linker.LinkableDepType.SHARED);
  BuildRule sharedRule=resolver.getRule(CxxDescriptionEnhancer.createSharedLibraryBuildTarget(target,cxxPlatform.getFlavor()));
  assertNotNull(sharedRule);
  assertEquals(ImmutableSet.of(sharedLibraryDep.getBuildTarget(),cxxSourceRuleFactory.createCompileBuildTarget("String_Node_Str",CxxSourceRuleFactory.PicType.PIC),cxxSourceRuleFactory.createCompileBuildTarget(genSourceName,CxxSourceRuleFactory.PicType.PIC)),FluentIterable.from(sharedRule.getDeps()).transform(HasBuildTarget.TO_TARGET).toSet());
  BuildRule sharedPreprocessRule1=resolver.getRule(cxxSourceRuleFactory.createPreprocessBuildTarget("String_Node_Str",CxxSource.Type.CXX,CxxSourceRuleFactory.PicType.PIC));
  assertNotNull(sharedPreprocessRule1);
  assertEquals(ImmutableSet.of(genHeaderTarget,headerSymlinkTree.getBuildTarget(),header.getBuildTarget(),CxxDescriptionEnhancer.createHeaderSymlinkTreeTarget(target,cxxPlatform.getFlavor(),HeaderVisibility.PRIVATE),CxxDescriptionEnhancer.createHeaderSymlinkTreeTarget(target,cxxPlatform.getFlavor(),HeaderVisibility.PUBLIC)),FluentIterable.from(sharedPreprocessRule1.getDeps()).transform(HasBuildTarget.TO_TARGET).toSet());
  BuildRule sharedCompileRule1=resolver.getRule(cxxSourceRuleFactory.createCompileBuildTarget("String_Node_Str",CxxSourceRuleFactory.PicType.PIC));
  assertNotNull(sharedCompileRule1);
  assertEquals(ImmutableSet.of(sharedPreprocessRule1.getBuildTarget()),FluentIterable.from(sharedCompileRule1.getDeps()).transform(HasBuildTarget.TO_TARGET).toSet());
  BuildRule sharedPreprocessRule2=resolver.getRule(cxxSourceRuleFactory.createPreprocessBuildTarget(genSourceName,CxxSource.Type.CXX,CxxSourceRuleFactory.PicType.PIC));
  assertNotNull(sharedPreprocessRule2);
  assertEquals(ImmutableSet.of(genHeaderTarget,genSourceTarget,headerSymlinkTree.getBuildTarget(),header.getBuildTarget(),CxxDescriptionEnhancer.createHeaderSymlinkTreeTarget(target,cxxPlatform.getFlavor(),HeaderVisibility.PRIVATE),CxxDescriptionEnhancer.createHeaderSymlinkTreeTarget(target,cxxPlatform.getFlavor(),HeaderVisibility.PUBLIC)),FluentIterable.from(sharedPreprocessRule2.getDeps()).transform(HasBuildTarget.TO_TARGET).toSet());
  BuildRule sharedCompileRule2=resolver.getRule(cxxSourceRuleFactory.createCompileBuildTarget(genSourceName,CxxSourceRuleFactory.PicType.PIC));
  assertNotNull(sharedCompileRule2);
  assertEquals(ImmutableSet.of(sharedPreprocessRule2.getBuildTarget()),FluentIterable.from(sharedCompileRule2.getDeps()).transform(HasBuildTarget.TO_TARGET).toSet());
  PythonPackageComponents expectedPythonPackageComponents=PythonPackageComponents.of(ImmutableMap.<Path,SourcePath>of(),ImmutableMap.<Path,SourcePath>of(),ImmutableMap.<Path,SourcePath>of(Paths.get(CxxDescriptionEnhancer.getDefaultSharedLibrarySoname(target,cxxPlatform)),new BuildTargetSourcePath(sharedRule.getBuildTarget())),ImmutableSet.<SourcePath>of(),Optional.<Boolean>absent());
  assertEquals(expectedPythonPackageComponents,rule.getPythonPackageComponents(cxxPlatform));
}