private static void buildAppleCxxPlatforms( Supplier<Optional<Path>> appleDeveloperDirectorySupplier, ImmutableList<Path> extraToolchainPaths, ImmutableList<Path> extraPlatformPaths, BuckConfig buckConfig, AppleConfig appleConfig, ImmutableMap.Builder<Flavor, AppleCxxPlatform> platformFlavorsToAppleSdkPathsBuilder) throws IOException { Optional<Path> appleDeveloperDirectory = appleDeveloperDirectorySupplier.get(); if (appleDeveloperDirectory.isPresent() && !Files.isDirectory(appleDeveloperDirectory.get())) { LOG.error( "Developer directory is set to %s, but is not a directory", appleDeveloperDirectory.get()); return; } ImmutableMap<String, AppleToolchain> toolchains = AppleToolchainDiscovery.discoverAppleToolchains( appleDeveloperDirectory, extraToolchainPaths); ImmutableMap<AppleSdk, AppleSdkPaths> sdkPaths = AppleSdkDiscovery.discoverAppleSdkPaths( appleDeveloperDirectory, extraPlatformPaths, toolchains); for (Map.Entry<AppleSdk, AppleSdkPaths> entry : sdkPaths.entrySet()) { AppleSdk sdk = entry.getKey(); AppleSdkPaths appleSdkPaths = entry.getValue(); String targetSdkVersion = appleConfig.getTargetSdkVersion(sdk.getApplePlatform()).or(sdk.getVersion()); LOG.debug("SDK %s using default version %s", sdk, targetSdkVersion); for (String architecture : sdk.getArchitectures()) { AppleCxxPlatform appleCxxPlatform = AppleCxxPlatforms.build(sdk, targetSdkVersion, architecture, appleSdkPaths, buckConfig); platformFlavorsToAppleSdkPathsBuilder.put( appleCxxPlatform.getCxxPlatform().getFlavor(), appleCxxPlatform); } } }