Program: 52894
Project: 52894
Buggy source:
@VisibleForTesting static AppleCxxPlatform buildWithExecutableChecker(ProjectFilesystem filesystem,AppleSdk targetSdk,String minVersion,String targetArchitecture,final AppleSdkPaths sdkPaths,BuckConfig buckConfig,XcodeToolFinder xcodeToolFinder,XcodeBuildVersionCache xcodeBuildVersionCache,Optional<AppleToolchain> swiftToolChain){
  AppleCxxPlatform.Builder platformBuilder=AppleCxxPlatform.builder();
  ImmutableList.Builder<Path> toolSearchPathsBuilder=ImmutableList.builder();
  toolSearchPathsBuilder.add(sdkPaths.getSdkPath().resolve(USR_BIN)).add(sdkPaths.getSdkPath().resolve("String_Node_Str").resolve(USR_BIN)).add(sdkPaths.getPlatformPath().resolve("String_Node_Str").resolve(USR_BIN));
  for (  Path toolchainPath : sdkPaths.getToolchainPaths()) {
    toolSearchPathsBuilder.add(toolchainPath.resolve(USR_BIN));
  }
  if (sdkPaths.getDeveloperPath().isPresent()) {
    toolSearchPathsBuilder.add(sdkPaths.getDeveloperPath().get().resolve(USR_BIN));
    toolSearchPathsBuilder.add(sdkPaths.getDeveloperPath().get().resolve("String_Node_Str"));
  }
  ImmutableList.Builder<String> cflagsBuilder=ImmutableList.builder();
  cflagsBuilder.add("String_Node_Str",sdkPaths.getSdkPath().toString());
  cflagsBuilder.add("String_Node_Str",filesystem.getRootPath().toString());
  cflagsBuilder.add("String_Node_Str",targetArchitecture);
  cflagsBuilder.add(targetSdk.getApplePlatform().getMinVersionFlagPrefix() + minVersion);
  if (targetSdk.getApplePlatform().equals(ApplePlatform.WATCHOS)) {
    cflagsBuilder.add("String_Node_Str");
  }
  ImmutableList.Builder<String> ldflagsBuilder=ImmutableList.builder();
  ldflagsBuilder.addAll(Linkers.iXlinker("String_Node_Str",targetSdk.getVersion(),"String_Node_Str"));
  if (targetSdk.getApplePlatform().equals(ApplePlatform.WATCHOS)) {
    ldflagsBuilder.addAll(Linkers.iXlinker("String_Node_Str","String_Node_Str","String_Node_Str"));
  }
  Optional<String> xcodeBuildVersion=Optional.empty();
  Optional<Path> developerPath=sdkPaths.getDeveloperPath();
  if (developerPath.isPresent()) {
    Path xcodeBundlePath=developerPath.get().getParent();
    if (xcodeBundlePath != null) {
      Path xcodeInfoPlistPath=xcodeBundlePath.resolve("String_Node_Str");
      try (InputStream stream=Files.newInputStream(xcodeInfoPlistPath)){
        NSDictionary parsedXcodeInfoPlist=(NSDictionary)PropertyListParser.parse(stream);
        NSObject xcodeVersionObject=parsedXcodeInfoPlist.objectForKey("String_Node_Str");
        if (xcodeVersionObject != null) {
          Optional<String> xcodeVersion=Optional.of(xcodeVersionObject.toString());
          platformBuilder.setXcodeVersion(xcodeVersion);
        }
      }
 catch (      IOException e) {
        LOG.warn("String_Node_Str",xcodeInfoPlistPath);
      }
catch (      PropertyListFormatException|ParseException|ParserConfigurationException|SAXException e) {
        LOG.warn("String_Node_Str",xcodeInfoPlistPath);
      }
    }
    xcodeBuildVersion=xcodeBuildVersionCache.lookup(developerPath.get());
    platformBuilder.setXcodeBuildVersion(xcodeBuildVersion);
    LOG.debug("String_Node_Str" + xcodeBuildVersion.orElse("String_Node_Str"));
  }
  ImmutableList.Builder<String> versions=ImmutableList.builder();
  versions.add(targetSdk.getVersion());
  ImmutableList<String> toolchainVersions=targetSdk.getToolchains().stream().map(AppleToolchain::getVersion).flatMap(Optionals::toStream).collect(MoreCollectors.toImmutableList());
  if (toolchainVersions.isEmpty()) {
    if (!xcodeBuildVersion.isPresent()) {
      throw new HumanReadableException("String_Node_Str");
    }
    versions.add(xcodeBuildVersion.get());
  }
 else {
    versions.addAll(toolchainVersions);
  }
  String version=Joiner.on(':').join(versions.build());
  ImmutableList<Path> toolSearchPaths=toolSearchPathsBuilder.build();
  Tool clangPath=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Tool clangXxPath=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Tool ar=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Tool ranlib=VersionedTool.builder().setPath(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder)).setName("String_Node_Str").setVersion(version).build();
  Tool strip=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Tool nm=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Tool actool=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Tool ibtool=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Tool momc=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Tool xctest=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Tool dsymutil=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Tool lipo=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Tool lldb=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Optional<Path> stubBinaryPath=targetSdk.getApplePlatform().getStubBinaryPath().map(input -> sdkPaths.getSdkPath().resolve(input));
  CxxBuckConfig config=new CxxBuckConfig(buckConfig);
  UserFlavor targetFlavor=UserFlavor.of(Flavor.replaceInvalidCharacters(targetSdk.getName() + "String_Node_Str" + targetArchitecture),String.format("String_Node_Str",targetSdk.getName(),targetArchitecture));
  ImmutableBiMap.Builder<Path,String> sanitizerPaths=ImmutableBiMap.builder();
  sanitizerPaths.put(sdkPaths.getSdkPath(),"String_Node_Str");
  sanitizerPaths.put(sdkPaths.getPlatformPath(),"String_Node_Str");
  if (sdkPaths.getDeveloperPath().isPresent()) {
    sanitizerPaths.put(sdkPaths.getDeveloperPath().get(),"String_Node_Str");
  }
  DebugPathSanitizer compilerDebugPathSanitizer=new PrefixMapDebugPathSanitizer(DebugPathSanitizer.getPaddedDir("String_Node_Str",config.getDebugPathSanitizerLimit(),File.separatorChar),sanitizerPaths.build(),CxxToolProvider.Type.CLANG);
  DebugPathSanitizer assemblerDebugPathSanitizer=new MungingDebugPathSanitizer(config.getDebugPathSanitizerLimit(),File.separatorChar,Paths.get("String_Node_Str"),sanitizerPaths.build());
  ImmutableList<String> cflags=cflagsBuilder.build();
  ImmutableMap.Builder<String,String> macrosBuilder=ImmutableMap.builder();
  macrosBuilder.put("String_Node_Str",sdkPaths.getSdkPath().toString());
  macrosBuilder.put("String_Node_Str",sdkPaths.getPlatformPath().toString());
  macrosBuilder.put("String_Node_Str",targetArchitecture);
  if (sdkPaths.getDeveloperPath().isPresent()) {
    macrosBuilder.put("String_Node_Str",sdkPaths.getDeveloperPath().get().toString());
  }
  ImmutableMap<String,String> macros=macrosBuilder.build();
  Optional<String> buildVersion=Optional.empty();
  Path platformVersionPlistPath=sdkPaths.getPlatformPath().resolve("String_Node_Str");
  try (InputStream versionPlist=Files.newInputStream(platformVersionPlistPath)){
    NSDictionary versionInfo=(NSDictionary)PropertyListParser.parse(versionPlist);
    if (versionInfo != null) {
      NSObject productBuildVersion=versionInfo.objectForKey("String_Node_Str");
      if (productBuildVersion != null) {
        buildVersion=Optional.of(productBuildVersion.toString());
      }
 else {
        LOG.warn("String_Node_Str",platformVersionPlistPath);
      }
    }
 else {
      LOG.warn("String_Node_Str",platformVersionPlistPath);
    }
  }
 catch (  NoSuchFileException e) {
    LOG.warn("String_Node_Str",platformVersionPlistPath);
  }
catch (  PropertyListFormatException|SAXException|ParserConfigurationException|ParseException|IOException e) {
    LOG.warn(e,"String_Node_Str",platformVersionPlistPath);
  }
  PreprocessorProvider aspp=new PreprocessorProvider(new ConstantToolProvider(clangPath),CxxToolProvider.Type.CLANG);
  CompilerProvider as=new CompilerProvider(new ConstantToolProvider(clangPath),CxxToolProvider.Type.CLANG);
  PreprocessorProvider cpp=new PreprocessorProvider(new ConstantToolProvider(clangPath),CxxToolProvider.Type.CLANG);
  CompilerProvider cc=new CompilerProvider(new ConstantToolProvider(clangPath),CxxToolProvider.Type.CLANG);
  PreprocessorProvider cxxpp=new PreprocessorProvider(new ConstantToolProvider(clangXxPath),CxxToolProvider.Type.CLANG);
  CompilerProvider cxx=new CompilerProvider(new ConstantToolProvider(clangXxPath),CxxToolProvider.Type.CLANG);
  ImmutableList.Builder<String> whitelistBuilder=ImmutableList.builder();
  whitelistBuilder.add("String_Node_Str" + Pattern.quote(sdkPaths.getSdkPath().toString()) + "String_Node_Str");
  whitelistBuilder.add("String_Node_Str" + Pattern.quote(sdkPaths.getPlatformPath().toString() + "String_Node_Str") + "String_Node_Str");
  for (  Path toolchainPath : sdkPaths.getToolchainPaths()) {
    LOG.debug("String_Node_Str",toolchainPath);
    try {
      whitelistBuilder.add("String_Node_Str" + Pattern.quote(toolchainPath.toRealPath().toString()) + "String_Node_Str");
    }
 catch (    IOException e) {
      LOG.warn(e,"String_Node_Str",toolchainPath);
    }
  }
  HeaderVerification headerVerification=config.getHeaderVerification().withPlatformWhitelist(whitelistBuilder.build());
  LOG.debug("String_Node_Str",headerVerification.getPlatformWhitelist());
  CxxPlatform cxxPlatform=CxxPlatforms.build(targetFlavor,Platform.MACOS,config,as,aspp,cc,cxx,cpp,cxxpp,new DefaultLinkerProvider(LinkerProvider.Type.DARWIN,new ConstantToolProvider(clangXxPath)),ImmutableList.<String>builder().addAll(cflags).addAll(ldflagsBuilder.build()).build(),strip,new BsdArchiver(ar),ranlib,new PosixNmSymbolNameTool(nm),cflagsBuilder.build(),ImmutableList.of(),cflags,ImmutableList.of(),"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",compilerDebugPathSanitizer,assemblerDebugPathSanitizer,macros,Optional.empty(),headerVerification);
  ApplePlatform applePlatform=targetSdk.getApplePlatform();
  ImmutableList.Builder<Path> swiftOverrideSearchPathBuilder=ImmutableList.builder();
  AppleSdkPaths.Builder swiftSdkPathsBuilder=AppleSdkPaths.builder().from(sdkPaths);
  if (swiftToolChain.isPresent()) {
    swiftOverrideSearchPathBuilder.add(swiftToolChain.get().getPath().resolve(USR_BIN));
    swiftSdkPathsBuilder.setToolchainPaths(ImmutableList.of(swiftToolChain.get().getPath()));
  }
  Optional<SwiftPlatform> swiftPlatform=getSwiftPlatform(applePlatform.getName(),targetArchitecture + "String_Node_Str" + applePlatform.getSwiftName().orElse(applePlatform.getName())+ minVersion,version,swiftSdkPathsBuilder.build(),swiftOverrideSearchPathBuilder.addAll(toolSearchPaths).build(),xcodeToolFinder);
  AppleConfig appleConfig=buckConfig.getView(AppleConfig.class);
  platformBuilder.setCxxPlatform(cxxPlatform).setSwiftPlatform(swiftPlatform).setAppleSdk(targetSdk).setAppleSdkPaths(sdkPaths).setMinVersion(minVersion).setBuildVersion(buildVersion).setActool(actool).setIbtool(ibtool).setMomc(momc).setCopySceneKitAssets(getOptionalTool("String_Node_Str",toolSearchPaths,xcodeToolFinder,version)).setXctest(xctest).setDsymutil(dsymutil).setLipo(lipo).setStubBinary(stubBinaryPath).setLldb(lldb).setCodesignAllocate(getOptionalTool("String_Node_Str",toolSearchPaths,xcodeToolFinder,version)).setCodesignProvider(appleConfig.getCodesignProvider());
  return platformBuilder.build();
}

Fixed version (ground truth):
@VisibleForTesting static AppleCxxPlatform buildWithExecutableChecker(ProjectFilesystem filesystem,AppleSdk targetSdk,String minVersion,String targetArchitecture,final AppleSdkPaths sdkPaths,BuckConfig buckConfig,XcodeToolFinder xcodeToolFinder,XcodeBuildVersionCache xcodeBuildVersionCache,Optional<AppleToolchain> swiftToolChain){
  AppleCxxPlatform.Builder platformBuilder=AppleCxxPlatform.builder();
  ImmutableList.Builder<Path> toolSearchPathsBuilder=ImmutableList.builder();
  toolSearchPathsBuilder.add(sdkPaths.getSdkPath().resolve(USR_BIN)).add(sdkPaths.getSdkPath().resolve("String_Node_Str").resolve(USR_BIN)).add(sdkPaths.getPlatformPath().resolve("String_Node_Str").resolve(USR_BIN));
  for (  Path toolchainPath : sdkPaths.getToolchainPaths()) {
    toolSearchPathsBuilder.add(toolchainPath.resolve(USR_BIN));
  }
  if (sdkPaths.getDeveloperPath().isPresent()) {
    toolSearchPathsBuilder.add(sdkPaths.getDeveloperPath().get().resolve(USR_BIN));
    toolSearchPathsBuilder.add(sdkPaths.getDeveloperPath().get().resolve("String_Node_Str"));
  }
  ImmutableList.Builder<String> cflagsBuilder=ImmutableList.builder();
  cflagsBuilder.add("String_Node_Str",sdkPaths.getSdkPath().toString());
  cflagsBuilder.add("String_Node_Str",filesystem.getRootPath().toString());
  cflagsBuilder.add("String_Node_Str",targetArchitecture);
  cflagsBuilder.add(targetSdk.getApplePlatform().getMinVersionFlagPrefix() + minVersion);
  if (targetSdk.getApplePlatform().equals(ApplePlatform.WATCHOS)) {
    cflagsBuilder.add("String_Node_Str");
  }
  ImmutableList.Builder<String> ldflagsBuilder=ImmutableList.builder();
  ldflagsBuilder.addAll(Linkers.iXlinker("String_Node_Str",targetSdk.getVersion(),"String_Node_Str"));
  if (targetSdk.getApplePlatform().equals(ApplePlatform.WATCHOS)) {
    ldflagsBuilder.addAll(Linkers.iXlinker("String_Node_Str","String_Node_Str","String_Node_Str"));
  }
  Optional<String> xcodeBuildVersion=Optional.empty();
  Optional<Path> developerPath=sdkPaths.getDeveloperPath();
  if (developerPath.isPresent()) {
    Path xcodeBundlePath=developerPath.get().getParent();
    if (xcodeBundlePath != null) {
      Path xcodeInfoPlistPath=xcodeBundlePath.resolve("String_Node_Str");
      try (InputStream stream=Files.newInputStream(xcodeInfoPlistPath)){
        NSDictionary parsedXcodeInfoPlist=(NSDictionary)PropertyListParser.parse(stream);
        NSObject xcodeVersionObject=parsedXcodeInfoPlist.objectForKey("String_Node_Str");
        if (xcodeVersionObject != null) {
          Optional<String> xcodeVersion=Optional.of(xcodeVersionObject.toString());
          platformBuilder.setXcodeVersion(xcodeVersion);
        }
      }
 catch (      IOException e) {
        LOG.warn("String_Node_Str",xcodeInfoPlistPath);
      }
catch (      PropertyListFormatException|ParseException|ParserConfigurationException|SAXException e) {
        LOG.warn("String_Node_Str",xcodeInfoPlistPath);
      }
    }
    xcodeBuildVersion=xcodeBuildVersionCache.lookup(developerPath.get());
    platformBuilder.setXcodeBuildVersion(xcodeBuildVersion);
    LOG.debug("String_Node_Str" + xcodeBuildVersion.orElse("String_Node_Str"));
  }
  ImmutableList.Builder<String> versions=ImmutableList.builder();
  versions.add(targetSdk.getVersion());
  ImmutableList<String> toolchainVersions=targetSdk.getToolchains().stream().map(AppleToolchain::getVersion).flatMap(Optionals::toStream).collect(MoreCollectors.toImmutableList());
  if (toolchainVersions.isEmpty()) {
    if (!xcodeBuildVersion.isPresent()) {
      throw new HumanReadableException("String_Node_Str");
    }
    versions.add(xcodeBuildVersion.get());
  }
 else {
    versions.addAll(toolchainVersions);
  }
  String version=Joiner.on(':').join(versions.build());
  ImmutableList<Path> toolSearchPaths=toolSearchPathsBuilder.build();
  Tool clangPath=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Tool clangXxPath=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Tool ar=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Tool ranlib=VersionedTool.builder().setPath(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder)).setName("String_Node_Str").setVersion(version).build();
  Tool strip=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Tool nm=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Tool actool=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Tool ibtool=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Tool momc=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Tool xctest=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Tool dsymutil=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Tool lipo=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Tool lldb=VersionedTool.of(getToolPath("String_Node_Str",toolSearchPaths,xcodeToolFinder),"String_Node_Str",version);
  Optional<Path> stubBinaryPath=targetSdk.getApplePlatform().getStubBinaryPath().map(input -> sdkPaths.getSdkPath().resolve(input));
  CxxBuckConfig config=new CxxBuckConfig(buckConfig);
  UserFlavor targetFlavor=UserFlavor.of(Flavor.replaceInvalidCharacters(targetSdk.getName() + "String_Node_Str" + targetArchitecture),String.format("String_Node_Str",targetSdk.getName(),targetArchitecture));
  ImmutableBiMap.Builder<Path,String> sanitizerPaths=ImmutableBiMap.builder();
  sanitizerPaths.put(sdkPaths.getSdkPath(),"String_Node_Str");
  sanitizerPaths.put(sdkPaths.getPlatformPath(),"String_Node_Str");
  if (sdkPaths.getDeveloperPath().isPresent()) {
    sanitizerPaths.put(sdkPaths.getDeveloperPath().get(),"String_Node_Str");
  }
  DebugPathSanitizer compilerDebugPathSanitizer=new PrefixMapDebugPathSanitizer(DebugPathSanitizer.getPaddedDir("String_Node_Str",config.getDebugPathSanitizerLimit(),File.separatorChar),sanitizerPaths.build());
  DebugPathSanitizer assemblerDebugPathSanitizer=new MungingDebugPathSanitizer(config.getDebugPathSanitizerLimit(),File.separatorChar,Paths.get("String_Node_Str"),sanitizerPaths.build());
  ImmutableList<String> cflags=cflagsBuilder.build();
  ImmutableMap.Builder<String,String> macrosBuilder=ImmutableMap.builder();
  macrosBuilder.put("String_Node_Str",sdkPaths.getSdkPath().toString());
  macrosBuilder.put("String_Node_Str",sdkPaths.getPlatformPath().toString());
  macrosBuilder.put("String_Node_Str",targetArchitecture);
  if (sdkPaths.getDeveloperPath().isPresent()) {
    macrosBuilder.put("String_Node_Str",sdkPaths.getDeveloperPath().get().toString());
  }
  ImmutableMap<String,String> macros=macrosBuilder.build();
  Optional<String> buildVersion=Optional.empty();
  Path platformVersionPlistPath=sdkPaths.getPlatformPath().resolve("String_Node_Str");
  try (InputStream versionPlist=Files.newInputStream(platformVersionPlistPath)){
    NSDictionary versionInfo=(NSDictionary)PropertyListParser.parse(versionPlist);
    if (versionInfo != null) {
      NSObject productBuildVersion=versionInfo.objectForKey("String_Node_Str");
      if (productBuildVersion != null) {
        buildVersion=Optional.of(productBuildVersion.toString());
      }
 else {
        LOG.warn("String_Node_Str",platformVersionPlistPath);
      }
    }
 else {
      LOG.warn("String_Node_Str",platformVersionPlistPath);
    }
  }
 catch (  NoSuchFileException e) {
    LOG.warn("String_Node_Str",platformVersionPlistPath);
  }
catch (  PropertyListFormatException|SAXException|ParserConfigurationException|ParseException|IOException e) {
    LOG.warn(e,"String_Node_Str",platformVersionPlistPath);
  }
  PreprocessorProvider aspp=new PreprocessorProvider(new ConstantToolProvider(clangPath),CxxToolProvider.Type.CLANG);
  CompilerProvider as=new CompilerProvider(new ConstantToolProvider(clangPath),CxxToolProvider.Type.CLANG);
  PreprocessorProvider cpp=new PreprocessorProvider(new ConstantToolProvider(clangPath),CxxToolProvider.Type.CLANG);
  CompilerProvider cc=new CompilerProvider(new ConstantToolProvider(clangPath),CxxToolProvider.Type.CLANG);
  PreprocessorProvider cxxpp=new PreprocessorProvider(new ConstantToolProvider(clangXxPath),CxxToolProvider.Type.CLANG);
  CompilerProvider cxx=new CompilerProvider(new ConstantToolProvider(clangXxPath),CxxToolProvider.Type.CLANG);
  ImmutableList.Builder<String> whitelistBuilder=ImmutableList.builder();
  whitelistBuilder.add("String_Node_Str" + Pattern.quote(sdkPaths.getSdkPath().toString()) + "String_Node_Str");
  whitelistBuilder.add("String_Node_Str" + Pattern.quote(sdkPaths.getPlatformPath().toString() + "String_Node_Str") + "String_Node_Str");
  for (  Path toolchainPath : sdkPaths.getToolchainPaths()) {
    LOG.debug("String_Node_Str",toolchainPath);
    try {
      whitelistBuilder.add("String_Node_Str" + Pattern.quote(toolchainPath.toRealPath().toString()) + "String_Node_Str");
    }
 catch (    IOException e) {
      LOG.warn(e,"String_Node_Str",toolchainPath);
    }
  }
  HeaderVerification headerVerification=config.getHeaderVerification().withPlatformWhitelist(whitelistBuilder.build());
  LOG.debug("String_Node_Str",headerVerification.getPlatformWhitelist());
  CxxPlatform cxxPlatform=CxxPlatforms.build(targetFlavor,Platform.MACOS,config,as,aspp,cc,cxx,cpp,cxxpp,new DefaultLinkerProvider(LinkerProvider.Type.DARWIN,new ConstantToolProvider(clangXxPath)),ImmutableList.<String>builder().addAll(cflags).addAll(ldflagsBuilder.build()).build(),strip,new BsdArchiver(ar),ranlib,new PosixNmSymbolNameTool(nm),cflagsBuilder.build(),ImmutableList.of(),cflags,ImmutableList.of(),"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",compilerDebugPathSanitizer,assemblerDebugPathSanitizer,macros,Optional.empty(),headerVerification);
  ApplePlatform applePlatform=targetSdk.getApplePlatform();
  ImmutableList.Builder<Path> swiftOverrideSearchPathBuilder=ImmutableList.builder();
  AppleSdkPaths.Builder swiftSdkPathsBuilder=AppleSdkPaths.builder().from(sdkPaths);
  if (swiftToolChain.isPresent()) {
    swiftOverrideSearchPathBuilder.add(swiftToolChain.get().getPath().resolve(USR_BIN));
    swiftSdkPathsBuilder.setToolchainPaths(ImmutableList.of(swiftToolChain.get().getPath()));
  }
  Optional<SwiftPlatform> swiftPlatform=getSwiftPlatform(applePlatform.getName(),targetArchitecture + "String_Node_Str" + applePlatform.getSwiftName().orElse(applePlatform.getName())+ minVersion,version,swiftSdkPathsBuilder.build(),swiftOverrideSearchPathBuilder.addAll(toolSearchPaths).build(),xcodeToolFinder);
  AppleConfig appleConfig=buckConfig.getView(AppleConfig.class);
  platformBuilder.setCxxPlatform(cxxPlatform).setSwiftPlatform(swiftPlatform).setAppleSdk(targetSdk).setAppleSdkPaths(sdkPaths).setMinVersion(minVersion).setBuildVersion(buildVersion).setActool(actool).setIbtool(ibtool).setMomc(momc).setCopySceneKitAssets(getOptionalTool("String_Node_Str",toolSearchPaths,xcodeToolFinder,version)).setXctest(xctest).setDsymutil(dsymutil).setLipo(lipo).setStubBinary(stubBinaryPath).setLldb(lldb).setCodesignAllocate(getOptionalTool("String_Node_Str",toolSearchPaths,xcodeToolFinder,version)).setCodesignProvider(appleConfig.getCodesignProvider());
  return platformBuilder.build();
}