Fix bad BUILD file and failed test for AaptGen tests

This is independent of any other of my reviews currently up.

This test was broken, had been for a little while. A change broke
the test but it had an inconsistent BUILD file so that
test was never getting called by the CI.

I have a somwhat large refactor of the entire Aapt pipeline
coming up with the AaptBuild task, which I am writing tests
for now. But I wanted to get this in soon, because the this test
will fail if the user calls something like
'./pants goal test tests::', etc.

Testing Done:
Verified that all android tests are being called by CI.
CI passes.
Travis passes.

Reviewed at https://rbcommons.com/s/twitter/r/858/
Simplify MultipleRootedProducts._get_products_for_root by using setdefault

Testing Done:
./pants goal test tests/python/pants_test:all

Reviewed at https://rbcommons.com/s/twitter/r/851/
docs: Remove more references to /BUILD:target notation

Found with git grep 'BUILD:'. Other uses still exist, but they seem to be in
example output.

Reviewed at https://rbcommons.com/s/twitter/r/855/
Add DxCompile task to android backend

This task gathers the class files of a target and compiles them into a classes.dex.
Dex file is a Dalvik exeecutable file. Once the classes have been dexed, then the app
is ready to be packaged into an .apk.

The classes.dex that is created is output to
pants.d/dex/dex/target.id/classes.dex. The target.id is
simply the package name. This is done b/c every Android target that
is dexed will output a file named "classes.dex". Putting them in
dirs that are named after the target.id means that they will
not clobber each other unless the package names correspond
(which would cause other problems as well).

CLI options allow configuring of VM options and build-tools versions.

This is just the task itself, I will write the test class tomorrow. I wanted to give people
a chance to comment while I worked on them, in case large changes are needed.
If you prefer to wait for the test class, that should be up tomorrow.

Testing Done:
CI.sh passes at 67089e7
Full integration tests pass on local machine.

Travis now passes [0].

[0] https://travis-ci.org/pantsbuild/pants/jobs/31952336

Reviewed at https://rbcommons.com/s/twitter/r/840/
Add a try/raise block to catch exceptions from calling os module on None

If someone defines an Android target without specifying a 'manifest'
field in the BUILD file, they only got a cryptic error. The exception was
never called because the error came earlier, when calling os.path on a None
object. This ensures that the user sees the error message we mean them to.

I have added testing for Android targets to my TODO list.

This patch is small and shouldn't be dependent on any other open reviews.

Testing Done:
CI passes.
Did some fuzz testing manually.
Travis passes. [0]

[0] https://travis-ci.org/pantsbuild/pants/builds/32069220

Reviewed at https://rbcommons.com/s/twitter/r/860/
Remove unused invalidate_for method and unused extra_data variable.

As discussed in https://rbcommons.com/s/twitter/r/808/ we are removing the unused extra_data variable and invalidate_for.

Testing Done:
Added an integration test to ensure java compile with 6 and then 7 produces two different artifacts.

Reviewed at https://rbcommons.com/s/twitter/r/849/
Prepare for 0.0.23 release.

Testing Done:
None

Bugs closed: 469

Reviewed at https://rbcommons.com/s/twitter/r/862/
Add AaptBuild task

AaptBuild constructs the apk out of the dex file and
the targets resource dir. Refactored the Aapt pipeline,
there is now an AaptTask base class. When calling
"bundle" on Android code you should now get an
unsigned .apk as output.

This also adds an AndroidIntegrationTest base class to
simplify Android integration testing.

I moved the 'package_path' method out of codegen and into
the AaptTask because all the aapt methods needed it. If
someone thinks it is truly useful to other codegen methods
I am open to moving it higher.

Testing Done:
CI.sh passes
Travis is failing elsewhere, so no Travis info.
Unsigned apks are indeed generated :)

Reviewed at https://rbcommons.com/s/twitter/r/859/
don't hide docs for exclusives= target param in an unpublished docstring.

A blurb about how to use exclusives was hiding in the CheckExclusives goal doc. Many BUILD dictionary entries mentioned this, but weren't high-tech enough to "hyperlink" that doc.

So... move the "user-facing" exclusives doc out of tasks/check_exclusives.py into docs/build_files.rst.

in many backend/.../targets/*.py files, link to the new location.

Testing Done:
generated doc set, eyeballed

to make sure my automated comment-fixup doesn't destroy the world's syntax, kicked off https://travis-ci.org/pantsbuild/pants/builds/32287735

Bugs closed: 451

Reviewed at https://rbcommons.com/s/twitter/r/865/
Split AddressMapper out of BuildFileParser

Split caching and address mapping out of BuildFileParser and into its own class, BuildFileAddressMapper.

Move all of the BuildGraph population methods out of BuildFileParser and into BuildGraph, which delegates to its own BuildFileAddressMapper for TargetProxy (now TargetAddressable) resolution.

Generalize the notion of a TargetProxy to an Addressable.  It is now the responsibility of the BuildGraph (which has an AddressMapper) to resolve a TargetAddressable, convert it into a Target, and then traverse the transitive dependencies as necessary.

Move BuildFile caching into the BuildFile class.

Testing Done:
CI is green

Reviewed at https://rbcommons.com/s/twitter/r/584/
scm: add merge-base and origin url properties to git

catch exceptions and always remove remote in `mkremote`

Testing Done:
build passes: https://travis-ci.org/cheecheeo/pants/builds/31666560

This is necessary for a feature that will include the merge-base and repository url in pants-built artifacts.

Reviewed at https://rbcommons.com/s/twitter/r/834/
Simplify phase.py.

- Gets rid of clever but complicated deduping logic. Replaces it with
  dumb but simple deduping logic via a factory.

- Gets rid of a few methods that were either entirely unused or only used
  once (in which case replaced them with alternative code).

- Phases now store task names and types directly. The TaskRegistrar instance
  isn't retained after registration.

- A Phase now directly knows its depenendcies on other phases, instead of
  delegating to the union of dependencies of its TaskRegistrars.
  This makes a lot of code much simpler.

- Phase no longers uses the old 'goal' terminology.

- Move logic such as option parser setup from TaskRegistrar into Phase.

This simplifies Phase itself and a lot of code that uses it, and
paves the way for renaming Phase to Goal.

Testing Done:
CI passed: https://travis-ci.org/pantsbuild/pants/builds/32051833.

Unit and integration tests pass locally too.

Ran some manual builds, including "./pants goal goals --goals-graph".

Reviewed at https://rbcommons.com/s/twitter/r/856/
Moved some example code out from /src and /tests into /examples/src and examples/test

We discussed a new layout for example and testproject code on the list:

https://groups.google.com/forum/#!topic/pants-devel/cLsY7ksLoyM

This patch covers moving the java examples.  If we like this, I'll continue on with non-java targets and
testprojects into a new /testprojects/ top level directory.

Testing Done:
Updated tests, ran tests. CI is baking.

Bugs closed: 472

Reviewed at https://rbcommons.com/s/twitter/r/868/
git: commit date of refs

Testing Done:
ci.sh succeeds

Reviewed at https://rbcommons.com/s/twitter/r/871/
Fixup missed parameter rename.

https://rbcommons.com/s/twitter/r/871/ comitted @ 50bdab06 failed CI here: https://travis-ci.org/pantsbuild/pants/jobs/32402628
This fixes that.

Testing Done:
$ PANTS_DEV=1 ./pants goal test tests/python/pants_test/scm/::
...
23:16:08 00:00   [test]
23:16:08 00:00     [pytest]
23:16:08 00:00       [run]
                     ============== test session starts ===============
                     platform linux2 -- Python 2.6.9 -- py-1.4.23 -- pytest-2.6.1
                     plugins: cov, timeout
                     collected 4 items

                     tests/python/pants_test/scm/test_git.py ....

                     ============ 4 passed in 0.60 seconds ============

23:16:28 00:20     [junit]
23:16:28 00:20     [specs]
               SUCCESS

Bugs closed: 476

Reviewed at https://rbcommons.com/s/twitter/r/875/
Fix the builddict and add a basic ci test.

This wires up a run of build-support/bin/publish_docs.sh as part
of the ci suite to at least confirm it runs without raising.

Testing Done:
Now works:
==
./build-support/bin/publish_docs.sh

Travis CI went green here: https://travis-ci.org/pantsbuild/pants/builds/32401953

Bugs closed: 475

Reviewed at https://rbcommons.com/s/twitter/r/873/
Fixup flag parser prep for phases - actually add option groups.

Testing Done:
Now real help:
==
$ PANTS_DEV=1 ./pants goal resolve -h
*** Running pants in dev mode from /home/jsirois/dev/3rdparty/jsirois-pants/src/python/pants/bin/pants_exe.py ***

resolve: Resolve dependencies and produce dependency reports.

resolve options:
  --ng-daemons, --no-ng-daemons
                          [True] Use nailgun daemons to execute java tasks.

gen:thrift options:
  --gen-thrift-version=THRIFT_VERSION
                          Thrift compiler version.
  --gen-thrift-lang=THRIFT_GEN_LANGS
                          Force generation of thrift code for these languages.

...
ivy options:
  --ivy-override=IVY_RESOLVE_OVERRIDES
                          Specifies a jar dependency override in the form:
                          [org]#[name]=(revision|url)
                          For example, to specify 2 overrides:
                          --ivy-override=com.foo#bar=0.1.2 \
                          --ivy-override=com.baz#spam=file:///tmp/spam.jar
  --ivy-report, --no-ivy-report
                          [False] Generate an ivy resolve html report
  --ivy-open, --no-ivy-open
                          [False] Attempt to open the generated ivy resolve
                          report in a browser (implies --ivy-report).
  --ivy-outdir=IVY_RESOLVE_OUTDIR
                          Emit ivy report outputs in to this directory.
  --ivy-args=IVY_ARGS     Pass these extra args to ivy.
  --ivy-mutable-pattern=IVY_MUTABLE_PATTERN
                          If specified, all artifact revisions matching this
                          pattern will be treated as mutable unless a matching
                          artifact explicitly marks mutable as False.

Bugs closed: 479

Reviewed at https://rbcommons.com/s/twitter/r/877/
Support uninstalling a task from a phase.

Reviewed at https://rbcommons.com/s/twitter/r/879/
Fix a bug in the signature of __new__.

Also, Python special-cases __new__ so you don't need to specify
@classmethod.

Reviewed at https://rbcommons.com/s/twitter/r/880/
add test to tickle brittle reflection-y part of Goals Reference generation

adding 'goal builddict' to ci.sh was great. this here test hopes to be a lightweight way to test a reflection-y part of the code.

Testing Done:
ran test. it passed.

temporarily tweaked Phase.setup->phase.setup in src/.../builddict.py; test failed.

Reviewed at https://rbcommons.com/s/twitter/r/876/