Change ActionGraphs to TargetGraphs.

Summary:
This changes ActionGraphs in ProjectCommand to wrap TargetGraph
instances instead of ActionGraph instances. This is to facilitate
making project generation work on TargetGraph instead of ActionGraph.

Test Plan: CI
Change getAllTargetsOfType to work on TargetNode instead of BuildRule.

Summary:
getAllTargetsOfType currently takes BuildRule instances, but
could work exactly the same with TargetNode instances. Since
we now have access to the TargetGraph in ProjectCommand where
getAllTargetsOfType is called, we can avoid getting the
ActionGraph.

Test Plan: CI
Expand the error message for not being able to find a dependency.

Summary:
During the construction of the target graph if any exception is thrown
during the resolution of a node's dependencies a HumanReadableException
is thrown with the target and the dependency. This stops the information
about the original exception from reaching the user, making it very hard
to know whether the target was misspelt or didn't have the correct
visibility. This appends the underlying cause to the message.

Test Plan:
CI,
Remove the visibility of a target, observe the error message is now helpful:

  BUILD FAILED: Couldn't get dependency '//src/com/facebook/buck/cxx:rules' of target '//test/com/facebook/buck/apple:apple':
  //test/com/facebook/buck/apple:apple depends on //src/com/facebook/buck/cxx:rules, which is not visible
Detect and correct duplicate hardcoded GIDs

Summary: If a codebase contains multiple xcode targets with the same GID in the same project, one of the targets used to be silently dropped. This diff makes sure that such duplicities are detected and an exception is thrown.

Test Plan:
 * Running `buck project --workspace-and-projects` should throw an exception only if multiple targets in the same project have the same ID.
 * Running `buck project --combined-project` should throw an exception if any two targets in the codebase have the same ID.
New utility method MoreFiles.searchPathsForFile

Summary:
Andrew and I need this to search multiple NDK / SDK paths
for build utilities. We want $PATH-like behavior where the first
path which contains the utility will be used.

This adds this utility under MoreFiles.searchPathsForFile(). I
included unit tests.

Test Plan: Unit tests included.
Easy: Fix ant build when immutables used in same library they're defined in

Summary:
I hit a bug using a code-generated immutable in the same
library it was defined in. This was because we weren't compiling the
code-generated immutables before using them.

I decided to follow what we do for javacc and compile them with javac
before the rest of the ecj run. This fixed the issue with the ant build.

Test Plan:
Changed //src/com/facebook/buck/apple:rules to java_immutables_library()
and added an immutable type which I used in another class in that package. Before,
`ant default` failed. Now, it works.
Checkstyle: Relax line length check for Javadoc comment lines containing command

Summary:
Javadoc commands like {@code ...} cannot be word-wrapped
across lines.  Unfortunately, sometimes these need to be very long,
like this example from `AppleSdkPaths`:

  /**
   * Absolute path to tools and files which depend on a particular SDK on a particular platform.
   *
   * Example:
   *
   * {@code /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk}
   */

Checkstyle currently raises a lint error for lines like this, even
though there is no alternative to using a long line.

So, this diff adds a checkstyle exception to Javadoc comment lines
containing a {@foo} command.

Test Plan:
Applied above example to repo. Ran `ant checkstyle`,
confirmed lint error for line length. Applied fix, ran `ant
checkstyle`, lint error was gone.

Manually made a very long comment line in local repo which didn't
contain a Javadoc command, confirmed `ant checkstyle` still raised
a lint error.
New immutable value type AppleSdkPaths

Summary:
This introduces an immutable value type `AppleSdkPaths `
which includes a code-generated `ImmutableAppleSdkPaths with
a builder `ImmutableAppleSdkPaths.Builder`.

I'll use this to build the upcoming `AppleCxxPlatform`.

Test Plan: Used in subsequent diff.
Remove unnecessary warning suppression.

Summary: These aren't needed anymore as the build doesn't fail without them.

Test Plan: CI
New utility class AppleSdkDiscovery

Summary:
To build the `AppleCxxPlatform`, we need to discover the
location of the components of the Apple SDK.

This introduces a new utility class `AppleSdkDiscovery` which takes
the path to the Xcode installation (which I will get from @mbolin's
D1630292) and discovers the Mac OS X, iPhone OS, and iPhone Simulator
SDKs inside.

It also reads the `SDKSettings.plist` file inside each SDK so we can
refer to them by the same name as shown by `xcodebuild -showsdks`:

  % xcodebuild -showsdks
  OS X SDKs:
     OS X 10.9                            -sdk macosx10.9

  iOS SDKs:
      iOS 8.0                             -sdk iphoneos8.0

  iOS Simulator SDKs:
      Simulator - iOS 8.0                 -sdk iphonesimulator8.0

Test Plan: Unit test included.
Remove unused methods in Parser.

Summary:
Since we're now constructing the target graph much earlier
in the parsing process we don't need to work with raw rules
as much, and we removed all calls to the filtering methods
that did so in Parser.

Test Plan: CI
Revert the hack in AndroidBinary.getAbiKeyForDeps().

Summary:
This was introduced when we migrated BuildRules to Buildables and there was no
way for a buildable to access its rule key.

Test Plan: buck test --all
Add builders for Apple descriptions.

Summary:
This adds builders for Apple descriptions to help writing
tests that need BuildRule or TargetNode instances provided
by those descrptions.

Test Plan: CI
Introduce an enum to represent the different exopackage modes.

Summary:
Convert the exopackage boolean argument to the appropriate enum.
There are some places which use `exopackageModes.isEmpty()` to decide if
exopackage is enabled, and others which call `ExopackageMode.enabledForSecondaryDexes()`.
I've used the former only where it doesn't depend on the exopackage mode.

Test Plan: buck test --all
CopyNativeLibaries: a new build rule to copy native libraries to an intermediate dir.

Summary:
The copying step needs to move out of `AndroidBinary` so that in a later diff,
the new build rule can hash the native libraries and provide that hash to
`ComputeExopackageDepsAbi`.

Test Plan: buck test --all
Refactor ExopackageInfo into its own class.

Summary:
This will make it easier to introduce a corresponding optional `NativeLibsInfo`
inner class.

Test Plan: buck test --all
Remove XcodeNative rule type.

Summary:
XcodeNative is very hard to keep supporting considering our future
combined project generation and native building plans. This removes
it.

Test Plan: CI
Make AndroidGraphEnhancer.EnhancementResult use the Immutables library.

Test Plan: buck test --all
Move launcher scripts to programs directory

Summary:
Currently our lanucher scripts sit in the bin directory and occupy
the name "buck", which prevents us from deploying a BUCK build file
to that directory to build buck as a PEX.  This diff moves these
launcher scripts to a programs directory and renames them to all use
a ".py" extension, then sets up symlinks from the original bin names
to these new locations.

Test Plan: buck test --all
Build buck as a standalone PEX file

Summary:
This diff restructures the python launcher scripts to support two
modes of operation: 1) running from a checked out, built buck repo
and 2) running from a prebuilt, standalone PEX file.  To support
these modes, the python launcher scripts have been split into
the ##buck_repo.py## module to support the former workflow, and
the ##buck_package.py## module to support the latter.

Now, all external components, including the main JAR containing
the core of buck, are described as ##Resource## objects in the
launcher scripts, and several BUCK files have been added to pull
these all into the top-level PEX files as resources.  When running
in PEX mode, the ##buck_package.py## module will automatically
extract the requested reosurces to the temp dir so they can be
used via buck code.

Test Plan: ##/var/tmp/buck.pex build buck##