Android: Use d8's desugar dependencies

Based on Søren's sample code in http://b/176818423.

D8's java API allows us to determine the exact set of dependencies that
a class in the current target depends on to desugar correctly (generally
its superclass(es) and interface(s) it implements). The class would only
need to be re-desugared with D8 if one of these dependencies changes.

This CL makes use of this information in a less granular way. If any jar
containing one of these dependencies is changed, then we re-dex all the
classes. Even so, this limited reduction in dependencies from using D8
for desugaring reduced the previous regression from +50% to +10% for the
base_java_sig benchmark.

Follow-up CLs will attempt to make use of the more granular desugar
dependency information to further improve the timing of D8 desugar. For
the time being, we are continuing to use bazel desugar.

Bug: 1015559
Change-Id: If507a4013af7bed0820758629a4b9db69942727b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2621928
Commit-Queue: Peter Wen <[email protected]>
Auto-Submit: Peter Wen <[email protected]>
Reviewed-by: Andrew Grieve <[email protected]>
Cr-Commit-Position: refs/heads/master@{#844201}
diff --git a/BUILD.gn b/BUILD.gn
index 86c82ac..ab2f323 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -353,6 +353,7 @@
       "//services:services_junit_tests",
       "//testing/android/junit:junit_unit_tests",
       "//third_party/catapult/devil",
+      "//third_party/r8:custom_d8_java",
       "//third_party/smhasher:murmurhash3",
       "//tools/android:android_tools",
       "//tools/android:memconsumer",