Include output path in rule key for Archive build rule.

Summary:
This should have always been there, but wasn't caught by tests
since the tests were comparing RuleKeyPair objects which didn't
have a equals method implementation.
Include output path in rule key for CxxLink build rule.

Summary:
This should have always been there, but wasn't caught by tests
since the tests were comparing RuleKeyPair objects which didn't
have a equals method implementation.
Compare full RuleKeyPair objects in CxxCompileTest.

Test Plan: CxxCompileTest
Add equals and hashCode for RuleKeyPair.

Summary:
This proves useful for testing, as a convenience for checking
RuleKeyPair objects are the same or different.

Test Plan: included tests
Change Project to use a set of ProjectConfig rules and an ActionGraph instead of PartialGraph.

Summary:
Project accepts a PartialGraph as a constructor argument, then finds the ProjectConfig
rules using those targets. Change it to accept an ActionGraph and a set of ProjectConfig rules
instead.

Test Plan: CI
Change SeparatedProjectsGenerator to use an ActionGraph instead of a PartialGraph.

Summary:
SeparatedProjectsGenerator never uses the targets of the PartialGraph it's
passed, but only the ActionGraph, this changes SeparatedProjectsGenerator's constructor
to reflect that.

Test Plan: sandcastle
Change ProjectCommand to return ActionGraph instead of PartialGraph from private helper methods.

Summary:
All the methods in ProjectCommand that ultimately call createPartialGraphs don't really
need to use PartialGraph, as they only use ActionGraph. The createPartialGraphs method returns
PartialGraph because it calls out to PartialGraph's static methods to create the ActionGraph
ProjectCommand needs. This changes ProjectCommand so that references to PartialGraph are isolated
in the createPartialGraphs method.

Test Plan: sandcastle
Move PartialGraph#createPartialGraphs method to ProjectCommand.

Summary:
ProjectCommand is the only caller of PartialGraph#createPartialGraphs
that actually needs it. The other callers only call through it to other methods
in PartialGraph by passing parameters to that it does nothing. This moves that
method into ProjectCommand and changes the other callers to call
createPartialGraph directly.

Test Plan: sandcastle
perf_test fixes

Summary:
1) Don't mute errors from subcommands in perf_test.py
2) Now that buckd is a python script, don't invoke with bash -x

Test Plan: arc-diff
Buck launcher script: check if buck is built first thing in the scripts.

Test Plan:
With and without buckd running:

$ cd ~/devtools/buck && ant clean && cd - && buckd
RuleKey: add a `setInput` overload for `SourcePath` objects.

Summary:
This diff adds an overload of ##setInput## for ##SourcePath## objects
that "does the right thing": for ##BuildRuleSourcePath## objects it
hashes the rule key; for ##PathSourcePath## objects it hashes the
contents of the resolved file.

There have been a few rules types where it's important to hash some
input name along with the contents of the input (e.g. C/C++ preprocess
and thrift rules, where the we want to match the location where the
input gets included from along with the contents, in order to correctly
rebuild in the case of renames), so this provides a way to do this
without worrying about what is behind the ##SourcePath##.

Test Plan: included tests
Remove redundant logic to handle 'buck clean' special case.

Summary: `BuckRepo.launch_buck()` already handles this (and `NO_BUCKD` env var).

Test Plan: buck clean, verify buckd is killed.
Add some logs to the FilterResourcesStep.

Summary:
This should be helpful in debugging why Buck is sometimes not scaling down
images on CI servers.

Test Plan: buck test --all
Remove onlyUseThisWhenTestingToFindAllTransitiveDependencies.

Summary:
onlyUseThisWhenTestingToFindAllTransitiveDependencies is
the last method dealing with ActionGraph in Parser, and is used
for tests only. This rewrites the tests to be integration tests
so that the method isn't needed anymore.

Test Plan: CI
Change NativeLinkableInput to use SourcePaths.

Summary:
Before it housed two separate bookkeeping structures for output paths
and the targets that built them.

Test Plan: buck test --all
Fix Xcode project generation always generating all projects and workspaces.

Summary:
The code introduced in D1494778 for searching the roots of the project
generation's target graph when the roots are not specified looks for all
workspace and project rules regardless of whether project or workspace generation
is being run. This fixes that to only search for the correct type of rule.

Test Plan: CI
Tracing: delete dangling symlinks before creating new ones.

Summary:
6ab95780 fixed the tracing.py script to work for windows, but also
switched to recreating symlink by first using ##os.path.exists()## to
check if an old version of the symlink needs to be cleaned up before
creating the new one.  However, ##os.path.exists()## uses the ##stat##
syscall under the covers which follows symlinks, and returns ##False##
if the symlink is dangling.

This diff switches to use ##os.path.lexists()##, which uses ##lstat##,
to avoid following the symbolic link, so that we'll still cleanup
dangling symlinks.

Test Plan: arc diff
Regression test for https://github.com/facebook/buck/issues/187.

Summary:
Introduce `MultipleBuildConfigIntegrationTest` to verify the issue
with multiple `android_build_config()` rules explained in #187.
This will be used as a regression test (go TDD!).

This is annotated with `@Ignore` so that it does not break the build.

Test Plan:
Removed the `@Ignore` and ran the test from Eclipse where it failed with the following error:

```
java.lang.AssertionError:
Expected: a string containing "com/example/config2/BuildConfig.smali"
     but: was "/private/var/folders/w1/_2mc6m050qn232npsf9z3hfsh58_jh/T/junit147277075926323298/buck-out/gen/java/com/buildconfigs/extract-classes-dex__tmp/com/example/config1/BuildConfig.smali
/private/var/folders/w1/_2mc6m050qn232npsf9z3hfsh58_jh/T/junit147277075926323298/buck-out/gen/java/com/buildconfigs/extract-classes-dex__tmp/com/example/ConfigConsumer.smali
/private/var/folders/w1/_2mc6m050qn232npsf9z3hfsh58_jh/T/junit147277075926323298/buck-out/gen/java/com/buildconfigs/extract-classes-dex__tmp/com/sample/R$drawable.smali
/private/var/folders/w1/_2mc6m050qn232npsf9z3hfsh58_jh/T/junit147277075926323298/buck-out/gen/java/com/buildconfigs/extract-classes-dex__tmp/com/sample/R$string.smali
/private/var/folders/w1/_2mc6m050qn232npsf9z3hfsh58_jh/T/junit147277075926323298/buck-out/gen/java/com/buildconfigs/extract-classes-dex__tmp/com/sample/R.smali
"
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
	at org.junit.Assert.assertThat(Assert.java:865)
	at org.junit.Assert.assertThat(Assert.java:832)
	at com.facebook.buck.android.MultipleBuildConfigIntegrationTest.testAndroidBinarySupportsMultipleBuildConfigs(MultipleBuildConfigIntegrationTest.java:49)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
```
Use better names for enhanced JavaLibrary rules for BuildConfig.class files to add to an APK.

Summary:
When doing graph enhancement in `AndroidBinaryGraphEnhancer` for build configs,
instead of adding a `JavaLibrary` to `AndroidPackageableCollection.classpathEntriesToDex`
via `AndroidPackageableCollector.addClasspathEntry()`, we now create a `JavaLibrary` and
a `DexProducedFromJavaLibrary` explicitly so we can control the names of these enhanced
rules and ensure they are sane. The `DexProducedFromJavaLibrary` is added iff pre-dexing
is enabled.

An important thing to note is that now `AndroidPackageableCollection.classpathEntriesToDex`
does not have all of the classpath entries that the `AndroidBinary` needs to dex.
Instead, `EnhancementResult.getClasspathEntriesToDex()` has the complete collection.

This also fixes https://github.com/facebook/buck/issues/187.

Test Plan:
`MultipleBuildConfigIntegrationTest`
Sandcastle builds.
Refactor reusable logic from JarDirectoryStep into JarDirectoryStepHelper.

Summary: This is needed for an upcoming diff to fix a bug in android_prebuilt_aar().

Test Plan: Sandcastle