Fix how packaging rules consider their cache.

Summary:
Two bugs here.
First, java_binary didn't have a RuleKey since it didn't have an output.
Second, packaging rules should add their transitive deps to their RuleKey.

Test Plan: Tested repo in t2414455
Make it possible to override values in .buckconfig with .buckconfig.local.

Summary:
The idea is that .buckconfig should be a version-controlled file that is
shared by project members whereas .buckconfig.local should not be
version-controlled, and will contain user-specific overrides.

Test Plan:
Sandcastle builds.
Try defining [cache] locally as defined in
http://facebook.github.io/buck/concept/buckconfig.html
Introduce Buck daemon.

Summary:
Use Nailgun (http://www.martiansoftware.com/nailgun/index.html) to run Buck as
a server, allowing build files to be cached between runs.

See the new documentation (docs/command/buckd.soy) about how to take advantage
of this feature.

Test Plan:

1) time buck build buck
2) bin/buckd
3) time buck build buck
4) time buck build buck
5) check that the duration reported in the last build is significantly lower than
   the other 2 builds.
Remove `@Nullable` instances that should be `Optional`.

Summary:
Did a first pass clean up of things that are nullable and really should be optional.

Test Plan: unit tests
Fix the heuristic for finding the build tools directory for the ADT.

Test Plan: Comprehensive unit tests.
Switch IJ project level to java 7

Summary:
Time to migrate to java 7.
First step: allow us to use java 7 features in our IDE.

Test Plan: Ctl-F9
Fix a bug where a resourceFilter was being passed as a proguard config.

Summary:
This was introduced in https://phabricator.fb.com/D814987.
Presumably a copy/paste error.

Test Plan:
Built an app in fbandroid that was previously failing.
Sandcastle builds.
Enhancements to java_test().

Summary:
Update java_test() so it takes source and target options.
Fix java_test() so that vm_args is an array by default.

Test Plan: Sandcastle builds.
Use Java 7 when building the Buck project.

Test Plan: Sandcastle builds.
Introduced a new utility method: MoreFutures.isSuccess().

Test Plan: Sandcastle builds.
Remove the uncachedBuildRules field from AndroidTransitiveDependencies.

Summary:
The way we were creating this field does not make sense with respect to
our upcoming changes about what it means for a rule to be "cached."
It also required Optional.<BuildContext>absent() to be passed in many
cases, which does not make for a reliable API, as that means that the
uncachedBuildRules field in AndroidTransitiveDependencies was unreliable.

Test Plan: Sandcastle builds.
Return a ListeningExecutorService instead of an Executor in BuildContext.

Test Plan: Sandcastle builds.
Change EMMA's code coverage report so the first column is alphabetized.

Summary:
Although this change is very small, navigating Emma's source code to figure
out what to change was quite a challenge.

Test Plan: Ran `buck test --all` and verified that the leftmost column is alphabetized.
Make sure that all code under src/ is included in the code coverage report.

Summary:
While inspecting our code coverage report, I realized that we were not
reporting on all of our packages. Added source_under_test to java_test
rules where appropriate.

Some packages (com.facebook.buck.json and com.facebook.buck.python) did
not have any coverage, so I created some simple unit tests to make sure
they were included in the coverage report so we would be alerted to the
lack of coverage.

Test Plan:
Ran `buck clean && buck test --all --code-coverage`.
Inspected the generated emma/coverage/index.html file and verified that
all packages under `src/com/facebook/buck` were listed.
Pass the project root as a parameter to Main.runMainWithExitCode().

Summary:
This fixes things so that the root of the project is taken as a parameter
when running Buck programmatically. This will make it possible to run
Buck in different project directories for integration tests.

Recently, all of the classes that extend AbstractCommandRunner were updated
to take an ArtifactCache as a parameter. This diff replaces that with a
more extensible CommandRunnerParams type because updating all of the call
sites can be tedious, so now we can introduce new parameters to
AbstractCommandRunner in one place. Currently, CommandRunnerParams has two
fields: ArtifactCache and ProjectFilesystem.

Test Plan:
Sandcastle builds.
Verify that `git grep 'new File(".")`` returns only one result under src/.
Add a new heuristic to `buck project`.

Summary:
We recently changed `buck project` so that it only considers the first-order
deps of a build rule when determining its dependent IntelliJ modules.
This is problematic for Java packages that contain a combination of
library and test code where the set of deps of the library code is not a
subset of the deps for the test code. This diff adds a heuristic for that
case and includes the union of the deps of the library and test code in that case.

Test Plan:
Ran `buck project` and then built Messenger in IntelliJ.
Sandcastle builds.

I described a test case in the comments in the code,
but I did not create a unit test for it yet.
I am planning to finish the new integration test harness first,
and will then create a test using that. Currently, we do not
run any test code that exercises intellij.py, which is bad.
[buck] Add --run support for activity-alias

Summary:
Add support for parsing the ##activity-alias## tag in the
manifest reader for purposes of finding launchable activities.

Also, replace Facebook-specific name in test with ##com.example##.

Test Plan:
* unit test
Check that we have Java 7 installed before building

Summary: As above

Test Plan: Modified the class being checked to one that doesn't exist and saw error. Reverted and checked with Java 7.
Reset compressed size when combining JAR/ZIP archives

zlib does not always deflate a resource to the same compressed size as
the original input.  The input resource may have been compressed using
a different version of libz, or different compression settings.

Before adding each entry to the ZIP, clone the entry and reinitialize
the compressed field to -1 as is done by the more commonly used
ZipEntry(String) constructor.

This fixes a rare case where including a JAR in a java_binary() may
throw an error such as:

  invalid entry compressed size (expected 4271 but got 4275 bytes)
Supply temporary directory to java_test()

Similar to genrule() give the test running JVM a temporary directory
below buck-out that is uniquely named for this test target. Send
the path in by both the TMP environment variable and java.io.tmpdir
system property.

Fixes https://github.com/facebook/buck/issues/13