Dexpreopt: prepare to merge class loader context from all deps.

The makefile implementation of dexpreopt is lagging behind the Soong
implementation in the way it handles transitive dependencies: Soong
propagates class loader context through transitive dependencies, such
as static libraries, but makefiles only propagate that information
through uses-library dependencies.

This discrepancy is caused by the difficulty of handling class loader
contexts in makefies: since there is no topological order in handling
module and its dependencies, the information is propagated via file
level dependencies on dexpreopt.configs and merged into the module's
dexpreopt.config with a python script.

To handle transitive dependencies correctly, it is necessary to
generate dexpreopt.config files for all libraries, not just those that
enable dexpreopt.

This change only prepares dex_preopt_odex_install.mk for that and
updates if for corresponding changes in manifest_check.py. It does not
enable generation of dexpreopt.config files for non uses-library
dependencies (e.g. static libraries). This will be done as a follow-up.

Changes:

  - renamed option for dependency dexpreopt.config files
  - added option for self dexpreopt.config
  - moved variable definitions so that they can be used both by
    uses-library check and dexpreopt command
  - add 'Optional' field in makefile-generated dexpreopt.config to
    align it on par with Soong-generated configs
  - modify dex_preopt_config_merger.py to add uses-libraries propagated
    via dexpreopt.config files

Bug: 214255490
Test: lunch aosp_cf_x86_64_phone-userdebug && m && launch_cvd \
    && adb wait-for-device && adb root \
    && adb logcat | grep -E 'ClassLoaderContext [a-z ]+ mismatch'
    # a few unrelated errors caused by missing optional uses-libraries
    #   android.net.ipsec.ike
    #   androidx.window.extensions
    #   androidx.window.sidecar
    # that were present before this patch
Change-Id: I6522319a8415f22f90fc96059a34675fb830e5cc
2 files changed
tree: af088dee9442ebe96ff6feded2a1b25272af7b4f
  1. common/
  2. core/
  3. orchestrator/
  4. packaging/
  5. target/
  6. tests/
  7. tools/
  8. .gitignore
  9. banchanHelp.sh
  10. buildspec.mk.default
  11. Changes.md
  12. CleanSpec.mk
  13. Deprecation.md
  14. envsetup.sh
  15. finalize_branch_for_release.sh
  16. help.sh
  17. METADATA
  18. navbar.md
  19. OWNERS
  20. PREUPLOAD.cfg
  21. rbesetup.sh
  22. README.md
  23. tapasHelp.sh
  24. Usage.txt
README.md

Android Make Build System

This is the Makefile-based portion of the Android Build System.

For documentation on how to run a build, see Usage.txt

For a list of behavioral changes useful for Android.mk writers see Changes.md

For an outdated reference on Android.mk files, see build-system.html. Our Android.mk files look similar, but are entirely different from the Android.mk files used by the NDK build system. When searching for documentation elsewhere, ensure that it is for the platform build system -- most are not.

This Makefile-based system is in the process of being replaced with Soong, a new build system written in Go. During the transition, all of these makefiles are read by Kati, and generate a ninja file instead of being executed directly. That's combined with a ninja file read by Soong so that the build graph of the two systems can be combined and run as one.