Reland #3 "Android: Make building junit_binary() targets faster"

This reverts commit 02e8cce7fa9d1b8aed2f765a3f0cced8c7555917.

Reason for reland: Fixed missing dep.

> > > > > Original change's description:
> > > > > > Android: Make building junit_binary() targets faster
> > > > > >
> > > > > > by skipping dex generation.
> > > > > >
> > > > > > Changes to java_library_impl subtargets:
> > > > > > * Renames __impl to __host, and removes __dex dep from it
> > > > > > * Adds __validate subtargets for static analysis
> > > > > >
> > > > > > In order to minimize the number of subtargets:
> > > > > > * The ijar/turbine targets now double as the __header subtarget
> > > > > >   when present.
> > > > > > * The classpath validation target doubles as the __validate subtarget
> > > > > >   when present.
> > > > > > * The fake_rjava_target target doubles as the __assetres subtarget
> > > > > >   when present
> > > > > >
> > > > > > To make robolectric_library and junit_binary targets avoid building
> > > > > > dex, they now depend on __host targets of deps rather than the
> > > > > > top-level targets of deps. In order to not break analysis steps, they
> > > > > > also depend on the __validate subtargets.
> > > > > >
> > > > > > I originally tried creating targets for __device, __dex, __javac. This
> > > > > > allowed apk and bytecode checker targets to skip building __host .jar
> > > > > > files, for apk steps to not have to wait for static analysis steps,
> > > > > > and for proguarded targets to not dex library targets. However, it
> > > > > > came with the cost of 3 more group targets per java target, which
> > > > > > slows down GN & Ninja, and the build speed-up was minor. It may still
> > > > > > be worth attempting this in the future, but this CL is a big enough
> > > > > > change on its own, and provides the biggest benefit.
> > > > > >
> > > > > > Doing a clean build of content_junit_tests without static analysis:
> > > > > > Before:
> > > > > >     20.8 s weighted time to generate 140 .javac.jar files (719.2 s elapsed time sum)
> > > > > >     94.7 s weighted time to generate 298 .dex.jar files (1801.7 s elapsed time sum)
> > > > > >     140.2 s weighted time (3686.0 s elapsed time sum, 26.3x parallelism)
> > > > > >
> > > > > > After:
> > > > > >     23.1 s weighted time to generate 140 .javac.jar files (492.5 s elapsed time sum)
> > > > > >     45.5 s weighted time (1239.2 s elapsed time sum, 27.2x parallelism)
> > > > > >
> > > > > > A run average of "gn gen" actually gets a bit faster with this change:
> > > > > > Before:
> > > > > >     Made 40518 targets from 3240 files in 8733ms
> > > > > >
> > > > > > After:
> > > > > >     Made 40572 targets from 3240 files in 8181ms
> > > > > >
> > > > > > Bug: 1334449
> > > > > > Change-Id: Ia03d28756abc3f52485c2c080930ecbdd3e52137
> > > > > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3723297
> > > > > > Reviewed-by: Peter Wen <wnwen@chromium.org>
> > > > > > Commit-Queue: Andrew Grieve <agrieve@chromium.org>
> > > > > > Cr-Commit-Position: refs/heads/main@{#1018841}

Bug: 1334449
Change-Id: I0ee7e07b69173f20a2f83a31e30e18e0dcfa2b89
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3744164
Commit-Queue: Peter Wen <wnwen@chromium.org>
Reviewed-by: Peter Wen <wnwen@chromium.org>
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1020840}
NOKEYCHECK=True
GitOrigin-RevId: d90689426878ac8e6156c6f095a7b49bf63eeb73
2 files changed