Make `buck-clean` delete buck-out/bin and buck-out/gen.

Test Plan: Sandcastle builds.
Extract BuckEvent interface.

Test Plan: Unit tests
Improve BUCK file parse error behaviour.

Summary:
Modify ProjectBuildFileParser to throw a checked exception instead of
the more generic and overloaded IOException.  Previously, all errors
from buck.py interaction were treated as an IOException and thrown
all the way to the main method.

Test Plan:
Created a syntax error in a BUCK file, observed that the output of
buck build originally was undesirable (double stack traces, the latter
of which was an I/O exception with little relevance to the actual
issue).  buck targets output is still not great (it prints a BUILD
FAILED message complaining about a missing target even though its not
the target which contained the BUCK file syntax error).  buck.py's
output is passed through to stderr and does show the parse error
plainly in either case.
Lazily construct buildFiles.

Summary:
Maybe this should be abstracted into a Cache class that takes a Supplier
and caches the last returned value until you invalidate it.

Only one call to constructBuildFileTree, and it's fast-ish.

The time also moved from watchFileSystem to parseBuildFilesForTargets,
which means that it will show up in the Chrome trace, which is good.

Test Plan: Needs tests.
Add BuildFileParseException to Parser test throw clauses.

Summary:
Some of the Parser tests were broken as they didn't declare
that they threw BuildFileParseException, this diff fixes them.

Test Plan: ant && ant test
Fetch from all remotes when trying to get the required revision.

Summary:
If the required revision is not in the local repository, Buck tries to
get it by running `git fetch`.  However this only works if the revision
is on the default remote, i.e. the one originally cloned from.  If the
required revision is on another remote, i.e. a forked version, it will
not be fetched.  Adding the `--all` option to `git fetch` fixes this.

Test Plan:
1. Clone buck from github.
2. Add another remote with `git remote add`.
3. In the test project set .buckversion to point to a revision that is
   only on the other remote.
4. Build the test project with `buck build`.

Change-Id: Iffd0fdff006b9bde8345d2f3623829372c1e1a83
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
Signed-off-by: Simon Stewart <simons@fb.com>

PR created from: https://github.com/facebook/buck/pull/32
Connect to Cassandra in a background thread and block all cache fetches on completion.
This effectively parellelizes connecting to Casandra with parsing and saves ~3s on startup time
Track time spent in each step.
Avoid reading the entire file into memory when hashing its contents.

Summary:
Prefer `ByteStreams.hash()` so that the file contents (in bytes) can
be hashed while being read from an InputStream rather than creating
a (potentially large) byte[] array and then hashing the array.

Test Plan: Sandcastle builds.
Enforce serialization of command execution.

Summary:
Currently buckd allows multiple commands to be executed concurrently, which can lead to buckd
being left in an invalid state. This change enforces that only one command can be run at a time
to avoid those problems.
Add missing @Override annotation.

Test Plan:
Eliminated warning in Eclipse.
Unfortunately our linter does not appear to catch these.
Repurpose getShortName to no longer take a context and simply return the name of the command running.

Test Plan: Unit tests
Improved test for whether we're connected to a tty.

Summary:
This makes it possible to expand our reach of color-supported terminals,
including mine which is rxvt-unicode :)

Test Plan:
No color:
  nohup buck build buck
  buck build buck > foo
  echo foo > buck build buck

Color:
  buck build buck
Use step.getShortName for getCategory, remove shortName from stepEvent.

Test Plan: Unit tests
Remove a bunch of dead code in ShellStep to fix javadoc warnings.

Summary:
I noticed that `ant javadoc` was complaining that we had some
unresolved `{@link}` tags, which led me to discover that we had a
bit of dead code in `ShellStep` leftover.

Test Plan:
Ran `ant clean javadoc` and verified that the Javadoc was generated
without any warnings.
Enable strict-error checking internally at Facebook.
Symlink with java7 api instead of shelling out.

Test Plan:
Measured with chrome tracing and verified calls to mkdir_&&_symlink are about 50% faster
Update docs for new keystore() rule.

Test Plan:
http://localhost:9811

`git grep keystore_properties` no longer matches anything
Introduce SourcePaths.filterInputsToCompareToOutput().

Summary:
This fixes an issue where non-existent files could
inadvertently be included in RuleKey computation,
which could result in a non-idempotent RuleKey.

Test Plan: Sandcastle builds.
Make srcs default to [] in genrule.

Summary:
It is now possible to do sufficiently interesting
things with `deps` and `$(location)` such that `srcs`
should not be required.

Test Plan: Sandcastle builds.