Allow the classloader used by annotation processors to be garbage collected early.

Summary:
There are reports of large, complex builds using lots of annotation processors
running out of PermGen space on Java 7. The incidence of this increased markedly
after the introduction of the classloader used for loading annotation processors.
I suspect that _something_ is holding a reference to the Step which, in turn, is
holding one to the classloader, which could get pretty big.

As an interim measure, we'll null out the classloader after compilation is
finished. My experiments suggests that this remedies the problem. For now....

Test Plan:
Run a large build that exhausts PermGen without this patch
Watch it fail
Apply diff and run the build
Gasp in amazement as it passes
Fix minor bug in missing symbol finder

Summary:
The missing java symbol support, which hunts down rules that resolve
missing symbol errors in java, parses BUCK up the dir tree in an effort
to find the owners of sources.  It determines that a file is a BUCK file
by checking that it's basename is BUCK.  However, it's possible that
the user has a directory by this name, and this is even more likely
on case-insensitive filesystems where a directory called "buck" would
be mistaken for a BUCK file and parsed, resulting in an ugly parse
error.

This diff changes the code to check that the given path is a file
to avoid this.

Test Plan:
Removed some needed deps in test code and ran ##buck test --all##.
Easy bonus refactor diff -- add new enumerations

Summary: New enumeration values we'll need for the final changes to
ProjectGenerator.
Add AppleExtension rule

Summary:
This adds the "apple extension" rule. These are bundles that get
`.appex` extensions instead of `.app` extensions and get embedded in
other bundles.

In the future this can get refactored into a generic "bundle" rule that
takes the app extension as a parameter, but because I move at a snail's
pace in the Buck codebase, in the interest of unblocking iOS 8 Share
Extension work, and a little bit of YAGNI I'm committing this as-is
(@coneko's original design).
Copy phase refactor: Introduce ProjectGenerator.addCopyFilesBuildPhase()

Summary:
ProjectGenerator.addCopyFrameworksBuildPhase() is the only step in the
current project generator that adds a PBXCopyFilesBuildPhase to the
project.

However, we'll need to add a PBXCopyFilesBuildPhase to copy application
extensions into the bundle's PlugIns directory. This diff extracts out
the logic to add a PBXCopyFilesBuildPhase to the project into a new
routine, addCopyFilesBuildPhase(), so we can use it in later diffs to
support extensions.
Use the AppleExtension rules in ProjectGenerator

Summary:
This diff connects AppleExtension rules into ProjectGenerator. This diff
deviates from @coneko's original design by getting rid of the
distinction between `generateNativeTarget()` and
`generateBinaryTarget()`. Instead:

1. It extends `generateBinaryTarget()` to add a PBXCopyFiles phase for
   any AppleExtension dependencies.
2. It generates .appex binary targets for any AppleExtension rules.

This approach is simpler but it doesn't protect against semantically
odd/wrong configurations... if you declare one apple_extension rule as
depending on another apple_extension rule, this will happily try to
embed one extension into the other. @coneko's design would skip the
embedding step. It's probably even better to have some way to flag these
errors in a meaningful way because the author of the BUCK file probably
didn't intend it.
Change target lists to target sets.

Summary:
This changes many instances of Iterable<BuildTarget> and
ImmutableList<BuildTarget> to be ImmutableSet<BuildTarget>.
Add --with-tests support to workspace generation.

Summary:
Fixes workspace and scheme generation to support build configurations
where non-test targets, the tests that refer to them, their dependencies
and the project targets that contain all of those targets aren't
necessarily defined in a set of BUCK files which is a subset of the BUCK
files containing the non-test targets.

Fixes generated schemes containing all targets contained in the same
projects as necessary targets regardless of whether they themselves were
necessary.

Fixes test dependencies being built for running, profiling and archiving
as well as for testing.

Test Plan: CI, run new tests, try to generate a workspace
This Engineer Removed 1 Method From ProjectFilesystem. You'll Never Believe What Happened Next.

Summary: Remove a deprecated method from ProjectFilesystem. Watch as
mayhem ensues across the codebase, resulting in replacement of `File`
with `Path` in several places.

Test Plan: buck test --all
Add workspace data and scheme to the watchman ignore globs.

Summary:
This adds workspace data files and scheme files to the
watchman ignore globs, so that watchman doesn't trigger when we
generate workspaces for the whole repo.
Fix Python scripts to work with 2.6

Summary:
I backported subprocess.check_output from 2.7, fixed several
instances of "{}".format(), and moved one script from argparse to
optparse.

I didn't touch anything in scripts/ or some of the things in
src/com/facebook/buck/.

Test Plan: Ran several different invocations of buck and nothing broke.
Don't filter out XcodeNative rules from the generated scheme.

Summary:
When fixing up scheme generation in D1494778 I used
isXcodeTargetBuildRuleType to filter out rules that couldn't be
represented as Xcode targets. Unfortunately that does not take
XcodeNative into account, as an XcodeTarget cannot be generated for
those, even though they can be referenced in schemes.

This adds that extra check.

Test Plan: CI, generate a workspace for a target that has XcodeNative
dependencies and build it.
Fix ant tests.

Summary:
When running tests, Buck sets the "user.dir" property to a value of
`Path.toRealPath()` but ant does not. Nor does IJ. On Linux, this
shouldn't be a problem, but on OS X this causes the
`RepositoryFactoryTest` to fail in ant but pass when run with Buck.

Hilarious.

Test Plan:
ant test
buck test --all
Add getBuildTargetParser() to Repository.

Summary:
The BuildTargetParser is a per-repository concept, so it's much more
natural to put a factory function on the `Repository` itself. This gets one
caller now, and more in upcoming diffs.

Test Plan: Existing repository tests are exercising this.
Remove generated files signing.

Summary:
We don't need generated projects to be signed anymore, and really
we shouldn't be checking generated sources into source control in the first
place. Header maps were set up to be signed but weren't being signed, so I
removed the code that did that as well.
Ensure resources used during compilation of java code are released.

Summary:
Turns out that we were opening a `ZipFile` but never calling `close()`
on it when compiling java code in memory from a source zip. This was
causing references to the `ZipEntry` instances to be kept in perm gen
space, ultimately causing it to be exhausted and making Buck fall over,
complaining wildly about that.

Test Plan:
for i in 1 2 3 4 5 6 7 8 9 10; do rm -rf buck-out; buck build buck; done
Attach jvisualvm, look at permgen space. See that's it's not totally
crazy after forcing a gc.
Look at a heapdump and look for ZipEntry instances. There should be none.
Replace argparse with optparse in a few more places

Summary: As per title.

Test Plan: ant py-test, ant test, arc unit
Fix for asset catalogs on OS X

Summary: Handle the case where the --device argument to compile_asset_catalogs.py is not set.

Test Plan: None.
Load the AbiWriter from the current classloader.

Summary:
We're still seeing memory leaks from the java compilation. Most of the culprits point to
the AbiWriter not being properly garbabge collected. We know that the AbiWriter only uses
classes from the JRE, so it's fine for us to load it from the current classloader without
worrying it might accidentally pollute the classpath of classes being compiled.

With this fix in place, compilation of a large java codebase keeps PermGen usage to
around 30-40MB, and usage appears to return to normal levels at the end of a build.

Test Plan:
buck test --all --code-coverage
Check that coverage looks good
Build a large codebase and watch PermGen usage in jvisualvm
Bump guava to version 17 again.

Summary: Update the version of guava to the latest released version.

Test Plan:
* buck test --all
* build several projects