Remove code duplication in platform detection
Remove code duplication in platform detection

Summary:
The code in `ApplePlatforms` is an exact duplication of `CxxPlatforms.getCxxPlatform`. Eliminate the duplication to ensure future robustness.

`CxxPlatforms.java`:

  /** Returns the configured cxx platform for a particular target. */
  public static UnresolvedCxxPlatform getCxxPlatform(
      CxxPlatformsProvider cxxPlatformsProvider,
      BuildTarget target,
      Optional<Flavor> defaultCxxPlatformFlavor) {

    FlavorDomain<UnresolvedCxxPlatform> cxxPlatforms =
        cxxPlatformsProvider.getUnresolvedCxxPlatforms();

    // First check if the build target is setting a particular target.
    Optional<UnresolvedCxxPlatform> targetPlatform = cxxPlatforms.getValue(target.getFlavors());
    if (targetPlatform.isPresent()) {
      return targetPlatform.get();
    }

    // Next, check for a constructor arg level default platform.
    if (defaultCxxPlatformFlavor.isPresent()) {
      return cxxPlatforms.getValue(defaultCxxPlatformFlavor.get());
    }

    // Otherwise, fallback to the description-level default platform.
    return cxxPlatforms.getValue(
        cxxPlatformsProvider.getDefaultUnresolvedCxxPlatform().getFlavor());
  }

Reviewed By: blackm00n

shipit-source-id: b7a5f858f2ad6cb62c67d591f2c8b8f6580d19d4

JoelMarcey/buck,JoelMarcey/buck,JoelMarcey/buck,JoelMarcey/buck,JoelMarcey/buck,JoelMarcey/buck,JoelMarcey/buck,JoelMarcey/buck,JoelMarcey/buck,JoelMarcey/buck,JoelMarcey/buck,JoelMarcey/buck,JoelMarcey/buck