android build: Split process_resources GN rule and script.

The process_resources() GN template and the associated
process_resources.py script are huge and difficult to understand
because they can be used to perform two slightly related
different things.

In preparation for a future CL that will introduce a new resource
compilation mode, this CL tries to clarify the situation by splitting
them into two sets of GN template + script:

   - prepare_resources() + prepare_resources.py, which are
     used to create .resources.zip archives of raw/uncompiled
     resources for resource related targets, as well as
     generating a corresponding R.txt and .srcjar(R.java)
     file.

     This corresponds to what process_resources() did when
     it was called from android_resources() and junit_binary().

     Note that this always generates non-final resource IDs,
     as well as a dummy onResourcesLoaded() method, necessary
     to compile, but not link, the ResourceRewriter class
     used to implement the system webview feature.

   - compile_resources() + compile_resources.py, which are used
     to compile all resource dependencies of a given binary
     (e.g. android_apk) into an intermediate .ap_ file.

     This corresponds to the behaviour of process_resources()
     when called from android_apk(). This generates final
     resource IDs by default, unless |shared_resources| or
     |shared_resources_whitelist| is used.

     Also, as a simplification, |shared_resources_whitelist|
     now implies |shared_resources|, except that it restrict
     the list of non-final resource IDs.

- Removed generate_constant_ids, since compile_resources()
  will always generate constant ids unless shared resources
  are being used. And prepare_resources() always generates
  non-constant IDs, as before the CL.

+ Add documentation for the prepare_resources() and
  compile_resources() internal GN rules, to make them
  a little less intimidating.

+ Removed |app_as_shared_lib|, since even before this CL all
  resources were generated with package ID 0x7f anyway, or
  fixed a compile_resources() time. Hence |shared_resources|
  did the exact same thing.

+ Improve --help output for prepare_resources.py and
  compile_resources.py by using option groups for inputs
  and outputs.

R=agrieve@chromium.org,yfriedman@chromium.org,estevenson@chromium.org,trevordixon@chromium.org

Bug: 820459
Change-Id: If05ac24a57c4dfa11f9ce43c30ab22e957b2765d
Reviewed-on: https://chromium-review.googlesource.com/957095
Commit-Queue: David Turner <digit@chromium.org>
Reviewed-by: agrieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543957}
7 files changed