Introduce optional flavor projection to BuildTarget.

Summary:
For now, this will be reserved for synthetic build rules that
are inserted via graph-enhancement.

Test Plan: Sandcastle builds.
Encapsulate posting to BuckEventBus in ExecutionContext...

Summary:
...where it makes sense. There's still a bunch of direct calls to
`BuckEventBus.post`, but only where `ExecutionContext` is not available.
Perhaps, I can send out a similar diff for `BuildContext`.

Test Plan: ant test
Add a class that can generate a subset of buck.py and populate constructor args reflectively.

Summary:
As part of the work to add a plugin mechanism, we need a way of allowing new extensions to declare
what arguments and dependencies they have without needing to modify buck.py. The
 BuildableArgInspector provides that.

Test Plan: buck test --all
Add <?> to silence raw type warning in Eclipse.

Test Plan: Sandcastle builds.
Introduce AccumulateClassNames rule to produce the list of .class files in a Java artifact.

Summary: This is needed for the upcoming pre-dexing diff.

Test Plan: Sandcastle builds.
Replace some casts from BuildRule to Buildable with rule.getBuildable().

Summary:
I think that we needed these casts at one time, but now they are no
longer appropriate. Especially since more of our implementations of
`BuildRule` do not actually implement `Buildable`.

Test Plan: Sandcastle builds.
Introduce ConditionalStep.

Summary: This is needed for the upcoming predex work.

Test Plan: Sandcastle builds.
Add a BUCK_COLOR env var, fixing SuperConsole in buckd.

Summary:
buckd can't tell whether the caller is talking to a tty or not, so we need to
tell it in order to enable SuperConsole output. Add BUCK_COLOR, which
(extending the existing color config) takes values of true/always, false/never,
or auto. Copy the VerbosityParser hack to get this option early in startup.
Modify the buck starter script to pass this value to the nailgun server.

Thoughts on renaming the "color" config to "fancy" or something?

Test Plan: buckd output is now Super by default. Confirm that "never" overrides the default.
buck.py more permissive symlinking.

Summary:
f0dedaec09331f73b3970658344cf8f3cb37a83b introduced a symlink aware walk aimed
at preventing recursively symlink loops; however, it was too restrictive in
that it pruned all symlinks that it has visited before, not only those that
would result in recursive symlinks. This breaks legitimate uses of symlinking
to siblings and cousin directories.

This diff adds a second test before pruning the symlink: not only must the
target directory be one already visited, but it must also be a direct ancestor
of the current directory.

Test Plan:
Trigger the traversal code by using recursive `glob` and `buck test --all` on
directories with the following configurations:

Test that siblings are okay (`b` and `c` are both traversed):

  a/
    b/
    c -> b

Test that ancestors are still rejected (`c` is not traversed):

  a/
    b/
      c/ -> ../b
Include the RuleKey on both BuildRuleEvent.Started and BuildRuleEvent.Finished.

Summary: This should make it considerably easier to debug caching issues.

Test Plan:
Sandcastle builds.
Inspect build.trace after doing a build and verify that RuleKeys are present.
python_library should not flatten libraries.

Summary:
Multi-file python libraries are often contained in a directory and
imported by that directory's name. Flattening the hierarchy will render that
module unimportable (or worse, possibly import only part of it). By copying the
unflattened subtree, we preserve the semantics of Python's module system while
retaining the isolation property.
Introduce DexJavaLibraryIfItContainsClassFiles Buildable.

Summary:
`DexJavaLibraryIfItContainsClassFiles` is a `Buildable` that takes the output of a `JavaLibraryRule` and
and dexes it, assuming the output of the `JavaLibraryRule` contains `.class` files.
It relies on an `AccumulateClassNames` to determine whether there are `.class` files to dex.

Once `DexJavaLibraryIfItContainsClassFiles` has the path to the classes file,
it uses a `FileExistsAndIsNotEmptyStep` combined with a `ConditionalStep` to
make sure that the list of `.class` files is non-empty before running the `DxStep`
because `dx` will fail if it is run on input that does not contain any `.class` files.

Test Plan: Sandcastle builds.
Introduce the use of graph enhancement to enable pre-dexing.

Test Plan:
Sandcastle builds.
Provide disable_pre_dex option for android_binary().

Summary:
This gives us an escape hatch to disable pre-dexing on an individual
android_binary() rule. The plan is to improve pre-dexing so that it
is clearly a win so we can ultimately remove this option.
Use java_binary output rather than libs for $(exe).

Summary:
Currently when using $(exe) to reference a java binary in a genrule,
we build the java binary jar and then ignore it.  Instead, we pass a
classpath that loads executable code from the java binary's transitive
dependencies.
Custom file format for string files.

Summary:
We were using JSON as the file format for strings dumped as assets. The
resulting `APK` for fb4a is around 400-500 KB bigger in size, which is not
acceptable. This introduces a custom format (explained in javadocs).

In order to further trim the file size, we store resource ids instead of
resource names. In order to achieve this, the strings file generation step is
now delayed, running it after the final `R.java` file is created by `aapt`.
Instead of parsing `R.java`, I also make `aapt` generate `R.txt` which is very
easy to parse.
Factor out a helper in SplitZipStep.

Summary:
I'm going to be adding some complexity to
createRequiredInPrimaryZipPredicate, so pull part of it out as a helper
function to make some room.

Test Plan: Unit.
Clarify a variable name in SplitZipStep.

Summary:
I'm going to be adding some complexity to this variable, so give it a
more specific name.

Test Plan: Unit.
Make SplitZipStep use proguard mapping on builds with obfuscation.

Summary:
Previously, we had some hacks in place to make zip splitting work
properly on builds with obfuscated class names, but they weren't
scalable.  Now the split-zip step pulls in the proguard class name
mapping and uses that to apply primary dex policies more accurately.
Pull out common constant in `DxStepTest`.