Example
$ b build //path/to/module:com.android.module.apex --config=android
Code locations
The main entry point is the apex macro in //build/bazel/rules/apex/apex.bzl, which expands to the _apex rule implementation.
Related files in this directory include:
cc.bzl for the C/C++ specific aspect that traverses into native dependenciestoolchain.bzl for the host toolchaintransition.bzl for the configuration transition to add APEX-specific configuration to dependencies, like the APEX name and min sdk version.apex_aab.bzl to repackage APEXes into multi-architecture Android app bundles and APK sets.apex_info.bzl contains ApexInfo and ApexMkInfo providers. These form the main interface of an APEX target.apex_key.bzl for the apex_key() ruleapex_test.bzl for Starlark analysis testsThe bp2build converter (ConvertWithBp2build) is located here.
The mixed build handler (ProcessBazelQueryResponse) is located here.
Major features
ext4 images and containers for all architectures/bitness.apex, .capex (compressed apex), .aab (Android app bundle), .apks (APK set)sh_binaryapex, override_apex and apex_test Soong module typesb and full platform build with m (preloaded on system)installed_files.txtDetailed features
//build/bazel/rules/apex/BUILD, like apexer_verbose and unsafe_disable_apex_allowed_deps_checkapex_test)file_contextsallowed_deps.txt validationapex_available validationmin_sdk_version validationlogging_parent, package_name, android_manifest, key.apex_manifest.pb conversioncanned_fs_config generationfile_contexts generationNOTICE.html.gz embedded in the APEX--output_groups=<coverage_files,backing_libs,...>Guardrails / others
--config=android is needed to build for the device. All APEX targets set target_compatible_with to android only - no host APEXes.apex_test.bzl//build/bazel/examples/apex/...//build/bazel/{examples,tests,rules}/apex/... and //build/soong/tests/...Known issues / gap analysis (non-exhaustive)
Upcoming features are based on Roboleaf module conversion priorities, like Java, Rust, DCLA and API fingerprinting support.
override_apex modules are converted to a regular apex with duplicated attributes. These are hidden by bp2build currently and will be cleaned up with macros in the future.apex_aab to mainline_modules_* products