Add a rule for downloading files.

Summary:
The URIs for the remote file can either be http, https, or "mvn", which is a
essentially the Buildr maven URL syntax with an optional host added, prefixed
with "mvn:".

By default, Buck disallows builds from downloading artifacts at build time. The
next step in this process will be to create a "fetch" command which will walk
the Target Graph and download all the files that it detects as being necessary.

Test Plan: buck test --all
Enable 'buck project --profile' to profile buck.py performance

Summary:
We've gotten some complaints that buck.py performance is
unacceptable. This adds a new option to `buck project`, `--profile`,
which enables Python profiling.

If this option is specified, we turn on Python's cProfile profiler and
write to the debug logs the top 25 function calls by cumulative time.

When I enable this, I see that glob() is a top user of CPU time,
so tackling that first will give us lots of improvements.

Test Plan: `buck project --profile`, confirmed output in logs
Import java.nio.files.Files into ProjectFileSystem. No logical changes.

Summary: Because it's madness to fully qualify imports if it's not necessary.

Test Plan: ant lint
Amend build to avoid invoking gcc on Windows.

Summary:
Most Windows installations don't have gcc installed, and those that do
tend to only run it in some UNIX emulation layer which only serves to
confuse and confound developers. Since nailgun isn't required to build,
skip the step that builds it if we're on Windows.

Test Plan: Run "ant" on a Windows machine.
Make javacc run on Windows.

Summary:
The way we were invoking javacc was a little quirky. Replace with a simple
genrule that works on both UNIX-like OSs and Windows. There's an assumption
that people building on Windows will have "jar" on their PATH, which they
should if they're building using java, but you never know.

Test Plan: python bin\buck build src/com/facebook/buck/apple/xcode/xcconfig
Fix obvious problem with paths in zip and jar files on Windows.

Summary:
The "obvious problem" being that jars and zips created on Windows
contain paths that "look\like\this", whereas they really should
"look/like/this".

Test Plan:
buck build buck
Inspect the contents of a jar
Building java libraries works as expected on Windows.

Summary:
This means that a simple java_library invocation passes when
executed.

Test Plan: python bin\buck build src/com/facebook/buck/util:constants
Always use the SimpleConsole and UNIX path separator on Windows.

Summary:
Fixes two problems:

1) Out build files use the UNIX path separator, but if we run on
   Windows, paths are separated using "\". For now, hard code Buck
   to inisit on the UNIX style paths.

2) Always use the simple console on Windows, because the command
   prompt ain't up to it.

Test Plan: python bin\buck build buck
Include a decent og:description for every page.

Summary:
When we share our pages on Facebook, we get a pretty poor summary
of the link.  This lets each page set what it should be and picks
something sane for all of our pages.

Test Plan: Load every single page on our website and check.
Add @Nullable annotations in RawParser

Summary: Add @Nullable annotations in RawParser

Test Plan: buck test --all
Remove unused batch file.

Summary: Buck is launched using the python scripts. Remove the unsused buck.cmd file.

Test Plan: Rejoice!
Alias --num-threads to -j, just like Make.

Summary:
Save my fingers needing to learn another shortcut for specifying how many
threads to use in a build.

Test Plan:
buck build -j 2 //some/enormous:target
Marvel at the length of the build
Make ParamInfo stateless.

Summary:
Generating ParamInfo is an exercise in reflective goodness/madness in Java.
For each and every BuildRule in the Action Graph, we walk every field of
the ConstructorArg and create a ParamInfo, which is then called to coerce
the value from the JSON map to the arg. Needless to say, this is grossly
inefficient, and is the main reason why we keep the raw Map of values around
in the BuildRuleFactoryParams (that is, we sacrifice space for speed, since
there's no way to tell whether or not we'll need the coerced TargetNode
values or not).

We can speed up parsing by reducing the amount of reflection done, and this
seems like low-hanging fruit. Rather than doing all the changes in one fell
swoop, I'm going to break things up. This change simply allows ParamInfo
instances to be reused with any instance of a ConstructorArg, rather than
just the ones from a particular build file.

Test Plan: buck test --all
Remove more state from the TypeCoercerFactory.

Summary:
In my quest to remove state from the ParamInfo, I need the TypeCoercerFactory
to be stateless. Turns out that the BuildTargetParser is state that's
required by the BuildTargetTypeCoercer. Although I'm not particularly keen on
adding Yet Another Parameter to the `coerce` method, this should now be
neatly broken up into "state required during this run" from "state required
by all runs".

Test Plan: buck test --all
Don't search for XcodeProjectConfig and XcodeNative by base path.

Summary:
WorkspaceAndProjectGenerator iterates over the rules it has to
include by base path, expecting to find an XcodeProjectConfig related
to them with the same base path. This forces XcodeProjectConfig rules
to be defined in the same BUCK files as at least one of the rules the
main target depends on. Since ProjectCommand already ensures the
project partial graph only contains XcodeProjectConfig rules that
relate to the targets being built, regardless of which BUCK file
they're defined in, WorkspaceAndProjectGenerator can iterate over all
of them.

Test Plan: sandcastle, new unit tests, arc build on D1552679
Remove unused method.

Summary: Parser#targetsInProjectFromRoots in not used anywhere. Remove it.

Test Plan: sandcastle
HttpArtifactCache: add checksum support

Summary:
This diff adds checksum to the HttpArtifactCache, by using the MD5
checksum of the artifact in the "Content-MD5" HTTP header.  On store,
this HTTP header is populated by the client with the checksum formed
from reading the artifact.  On fetch, the header is extracted and
used to compare against the MD5 found after reading the file.

Test Plan:
- included tests
- ran locally with a modified cache server
Make ArchiveStep produce deterministic archives

Summary:
By default, the 'ar' command will generate archives which contain
meta-data for each included file such as the modification timestamp,
the user ID, and the group ID.  This makes the archive creation
process generally non-reproducible and causes a lot of caching pain.

Recent versions of GNU 'ar' include a 'D' flag which make archives
deterministic by writing 0's for the above fields.  Unfortunately,
BSD 'ar' (found on OS X) doesn't support this flag so this diff adds
a ##Archives.makeArchiveDeterministic## method to efficiently scrub
the relevant metadata fields and avoid any copying/reading of the
actual file data, which would potentially be slow.  After executing
'ar', ##ArchvieStep## now mmap's the output archive and scrubs it
using the above method.

Test Plan: Added unittest
Add a CxxBinary build rule to be returned by CxxBinaryDescription

Summary:
Don't return the CxxLink rule which generates the actual binary
from the ##createBuildRule## method.  Instead, prepare and return
a placeholder rule, CxxBinary, which uses the target nodes name.
This helps in two situations:
1) CxxBinary extends BinaryBuildRule whereas CxxLink does not, so the former can be used as executables for genrules.  We could of made CxxLink also do this, but it's not always an executable (in the case of shared libs), and BinaryBuildRule is a target graph concept.
2) In some cases, users add dependencies from some rules onto other binary rules, typically if the binary is executed by some test or library code at test time.  These target graph deps should *not* become build time dependencies on the CxxLink step, otherwise we'd have to wait for the dependency binary to link before we could link the dependent binary. By using CxxBinary, we can keep the original target graph dependency tree while preventing it from affecting link parallelism.

Test Plan:
- included tests
- performed some builds in fbcode
Cache results of generating ParamInfo instances for a ConstructorArg.

Summary:
Although this means that we run the reflective generation of the ParamInfo
once per build per ConstructorArg class, this still allows us to save time
in the parsing phase of a build. From simple measurement of a large code
base with plenty of targets, "buck test --all" was approximately 130%
faster.

To be fair, that number seems crazy, so I expect cold caches somewhere in the
OS hindered the slower build times. Still, you know. Faster.

Test Plan: buck test --all