platform_build_soong/dexpreopt
Ulya Trafimovich 8c35fcf4d5 Add non-fatal mode for verify_uses_libraries check.
The new mode is enabled with environment variable
RELAX_USES_LIBRARY_CHECK. If the variable is set to true, then a
verify_uses_libraries check failure does not fail the build, instead it
sets a special compiler filter "extract" for dexpreopt, which means that
the DEX file will be extracted, but it won't be compiled to native code.
Class loader context will be set to empty in this case (not &, as it is
going to be deprecated soon).

If the variable RELAX_USES_LIBRARY_CHECK is unset or set to something
other than "true", then the old behaviour of the verify_uses_libraries
check is preserved.

The intended use case for this flag is to have a smoother migration path
for the Java modules that need to add <uses-library> information in
the build files. The flag allows to quickly silence build errors. This
flag should be used with caution and only as a temporary measure, as it
masks real errors and affects performance.

verify_uses_libraries check is reworked so that it writes the error
message to a status file (which is used instead of the former timestamp
file). Currently the stored error message is not used, but it may be
used later to produce a warning. Dexpreopt command checks if the status
file exists and is nonempty; if that is the case, then compiler filter
is set to "extract".
Bug: 132357300

Test: Manually add some mismatch between the libraries in the Android.bp
      and Android.mk files for dexpreopted apps, build with
      RELAX_USES_LIBRARY_CHECK=true and obsserve that the build doesn't
      fail and they are compiled with compiler-filter "extract".
      Unset RELAX_USES_LIBRARY_CHECK and observe that the build fails.

Change-Id: Ibb5d993a25b1df1d2e70b7d5aafc6997f9d64e67
2021-02-22 15:41:03 +00:00
..
dexpreopt_gen Add LOCAL_LICENSE_KINDS to build/soong 2021-02-06 04:23:21 +00:00
Android.bp Add LOCAL_LICENSE_KINDS to build/soong 2021-02-06 04:23:21 +00:00
OWNERS Add an owners file for dexpreopt files. 2018-12-18 20:28:06 +00:00
class_loader_context.go Preserve <uses-library> order in dexpreopt.config files. 2021-02-11 16:58:51 +00:00
class_loader_context_test.go Remove obsolete class loader context API and update unit tests. 2021-01-05 15:41:55 +00:00
config.go Add non-fatal mode for verify_uses_libraries check. 2021-02-22 15:41:03 +00:00
dexpreopt.go Add non-fatal mode for verify_uses_libraries check. 2021-02-22 15:41:03 +00:00
dexpreopt_test.go Add non-fatal mode for verify_uses_libraries check. 2021-02-22 15:41:03 +00:00
testing.go Make dexpreopt tools available for all java tests 2021-01-25 19:15:19 +00:00