Add support for tracing main dex classes in R8

In addition to the given main dex list, allow to handle tracing rules
for calculating the list of classes required to be kept in the main dex
regarding legacy MultiDex constraints. Main dex list and constraints
tracing are not excliusive, when both are provided their class lists are
just merged. Runtime annotations with enum values are taken into account
precisely (if classpath is complete) and Annotations without enum are
not forced into the main dex so as classes annotated by them.

In this first step support is only added to R8.
In R8, When tree shaking and legacy main dex tracing are enabled together,
the assumption is made that tree shaking is keeping every classes with
code involved in secondary dex files installation. This allows to let tree
shaking reuse the tracing made for the main dex list instead of restarting
from scratch.

This change also introduces CompilationResult as an internal result allowing
easier inspection by tests. CompilationResult is not returned by public
R8/D8 methods.

Sources of new multidex tests are modified versions of some Jack tests.

Bug: 37772111
Change-Id: I7b741ace5a990a66cd4b991197de409c795e7d95
161 files changed
tree: fccd747374738a0899f01def3e9345551f7ec9a0
  1. buildSrc/
  2. scripts/
  3. src/
  4. tests/
  5. third_party/
  6. tools/
  7. .gitignore
  8. AUTHORS
  9. build.gradle
  10. codereview.settings
  11. CONTRIBUTING.md
  12. copyAdditionalJctfCommonFiles.gradle
  13. LICENSE
  14. README.md
README.md

The R8 repo contains two tools.

  1. D8 is a dexer that converts java byte code to dex code.

  2. R8 is a java program shrinking and minification tool.