Remove KnownBuildRuleTypes memoization.

Summary:
KnownBuildRuleTypes#createInstance will always return the same
instance, regardless of whether the parameters being passed in
are the same as those with which the instance was configured
or not. This removes the incorrect memoization.

Test Plan: CI
Add a mechanism for generating stub jars.

Summary:
This puts in place a piece of infrastructure for generating ABI-stable jars
from class files. These jar files contain just enough bytecode to allow java
to be compiled against them, but it's extremely inadvisable to attempt to use
them.

The stub-jar generated has the following features per class:

  * Fields are ordered in alphabetical order.
  * Methods are ordered in alphabetical order.
  * Private methods and fields are ignored.
  * No method has a method body.
  * Bridge and synthetic methods inserted by the compiler are ignored.

In addition, the jar is generated without timestamps, so it should be possible
to run this over functionally equivalent inputs and generate the exact same
output.

Test Plan: buck test --all
Change execFileLoader to be final.

Summary: ^

Test Plan: CI
Refactor autopopulating description arg fields from createBuildRuleWithDefaults

Summary:
The most verbose parts of creating build rules in tests is populating
Description Arg. This diff refactors the auto-populating code from
createBuildWithDefaults, so that an Arg with defaults can be constructed, and
then overridden. This makes tests more resilient to changes in the Arg, and is
simpler than the old method of passing a modification
function into `createBuildRuleWithDefaults`.

I've applied this to a bunch of apple library descriptions in the tests.

Test Plan: unit tests still pass
Fix AppleBundle#getBuildSteps() so it returns a non-null value.

Summary: `getBuildSteps()` should never return `null.

Test Plan: Sandcastle
Add an alias for PrintHeaderMap so `buck run hmaptool` works.

Summary:
This is much easier than running:

```
buck build //src/com/facebook/buck/apple/clang:hmaptool
java -jar ./buck-out/gen/src/com/facebook/buck/apple/clang/hmaptool.jar
```

Also changed the tool so that if the user fails to specify any .hmap files,
the output is written to stderr and the exit code is nonzero.

Test Plan:
Ran `buck run hmaptool <path-to-hmap>` and verified it printed the
contents of the `.hmap`.
Change RuleJsonPredicateSpec to TargetNodePredicateSpec.

Summary:
This changes the TargetNodeSpec implementation to use a predicate on
TargetNode instead of on the raw map. This is to be able to isolate
access to the raw map to Parser.

Test Plan: CI
Remove uses of RuleJsonPredicate outside Parser.

Summary:
Parser should be the only class dealing with the raw deserialised
JSON maps, all the other parts of the code should deal with higher
level abstractions. This changes all places that use
RuleJsonPredicate to use Predicate<TargetNode<?>> instead. That
does not give access to a higher level abstraction at the moment,
but a subsequent diff will change TargetNode to have a reference
to the Description's DTO.

Test Plan: CI
Add dex file metadata

Summary: We'd like to be able to estimate the disk space used for initial odex creation before actually attempting the creation; this way, we can short-circuit the whole process when we know it'll fail anyway, saving users time and letting us more predictably provide remediation guidance. We don't want to decompress our dex xz and jar files just to measure their decompressed size; this diff lets buck provide this information directly.

Test Plan: Build apk; look for dex.jar.meta files
Remove the deprecated ProjectFilesystem File constructor. It is only used in tests.

Summary: Small clean up removing the constructor to `ProjectFilesystem` that uses a `File`.

Test Plan: buck test --all
Remove redundant null checks from android/aapt/.

Summary: Remove redundant null checks from android/aapt/.

Test Plan: buck test --all
Move ConstructorArg population to before TargetNode construction from during ActionGraph transformation.

Summary:
ConstructorArg are currently populated when the TargetGraph gets transformed into an ActionGraph.
This makes it really hard to use the TargetGraph for anything because TargetNode only have raw Map<String, ?>
representations of the rules. This moves the population to right before the TargetGraph construction instead.

Test Plan: CI
Add an optional prefix_header argument to apple_library() and apple_binary().

Summary:
This diff does not make use of the `prefix_header` argument yet: it just makes it
available via `AbstractAppleNativeTargetBuildRule`. Ultimately, it should be used
for building.

In a `.pbxproj`, it is possible to specify a `.pch` file for use with the `-include`
param via `GCC_PREFIX_HEADER = <path-to-file>`. Internally, we often do this via the
macro in `Configurations/Xcode/Projects/Project.xcconfig`:

    GCC_PREFIX_HEADER = $(TARGET_NAME)/$(TARGET_NAME)-Prefix.pch

My migration plan is to take our `ios_library()` and `ios_binary()` macros
and do something like:

```
def ios_library(
    name,
    pch_file = 'PLACEHOLDER_VALUE',
    ...
    ):
  if pch_file == 'PLACEHOLDER_VALUE':
    pch_files = glob(['**/*.pch'])
    pch_file = find_pch_file_closest_to_root_if_one_exists(pch_files)

  apple_library(
    name = name,
    prefix_header = pch_file,
    ...
```

This way, if a `pch_file` is specified for `ios_library()`, it will be used
as the `prefix_header` for the `apple_library()`.
Similarly, if `pch_file` is explicitly specified to be `None`, then the
`prefix_header` for the `apple_library()` will be `None`.
If `pch_file` is unspecified, then we use a heuristic to try to find the
appropriate value for `pch_file` in the interim while we go through
the painful process of updating all of our existing `ios_library()` rules.
Once we have updated all of our rules, we can remove the heuristic.

Test Plan: Sandcastle builds.
Make the FakeProjectFilesystem use the same exceptions as the real one.

Summary:
Make the FakeProjectFilesystem use the same exceptions on methods as the real
one. This makes a future refactoring clearer by removing signature changes
from it.

Test Plan: buck test --all
Change the log level from SEVERE to WARNING for resource-not-found error.

Summary: This makes it so that the super console is not blocked.

Test Plan: buck build katana
Delete BuildableParams and DefaultBuildableParams.

Summary: Clean up some leftovers from the Buildable/BuildRule merge I guess.

Test Plan: CI
Remove an unused field.

Summary: This field isn't being used an was added a long time ago.

Test Plan: CI
Revert changes to ProjectGenerator.

Test Plan: Sandcastle.
refactor generateBinaryTarget to take optional bundle rule

Summary:
generateBinaryTarget used to take 2 parameters, `rule` and `appleBuildRule`,
where the former is either the latter or an AppleBundle. This diff changes
`rule` to `Optional<AppleBundle> bundle` to better reflect its actual purpose.

Test Plan: unit tests
Revert 'Revert "Handle system call errors in nailgun client."'

Summary:
This reverts commit 9f2866c60d78d6e9295b530afe982f85e06a7286.

We are hoping this fixes some of the nailgun client hanging issues.

revertrevert

Test Plan: revert-hammer