| .. | ||
| testdata | ||
| apex_aab_test.bzl | ||
| apex_aab.bzl | ||
| apex_available.bzl | ||
| apex_deps_validation.bzl | ||
| apex_info.bzl | ||
| apex_key_test.bzl | ||
| apex_key.bzl | ||
| apex_mk_test.bzl | ||
| apex_test_helpers.bzl | ||
| apex_test.bzl | ||
| apex.bzl | ||
| BUILD | ||
| bundle.bzl | ||
| cc.bzl | ||
| METADATA | ||
| README.md | ||
| sdk_versions.bzl | ||
| toolchain.bzl | ||
| transition.bzl | ||
The Bazel APEX ruleset
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.bzlfor the C/C++ specific aspect that traverses into native dependenciestoolchain.bzlfor the host toolchaintransition.bzlfor the configuration transition to add APEX-specific configuration to dependencies, like the APEX name and min sdk version.apex_aab.bzlto repackage APEXes into multi-architecture Android app bundles and APK sets.apex_info.bzlcontains ApexInfo and ApexMkInfo providers. These form the main interface of an APEX target.apex_key.bzlfor theapex_key()ruleapex_test.bzlfor Starlark analysis tests
The bp2build converter (ConvertWithBp2build) is located here.
The mixed build handler (ProcessBazelQueryResponse) is located here.
Major features
- Build, compress, and sign APEX
ext4images and containers for all architectures/bitness - Supports outputs:
.apex,.capex(compressed apex),.aab(Android app bundle),.apks(APK set) - Supports packaging prebuilts (e.g. tzdata), native shared libs, native binaries,
sh_binary - Works with
apex,override_apexandapex_testSoong module types - Supports AOSP and Google/Go APEX variants
- Supports standalone/unbundled APEX builds (fast for development) with
band full platform build withm(preloaded on system) - Supports generating Mainline quality signals metadata files: required/provided libs,
installed_files.txt - Internal mainline build scripts is capable of building multi-arch AABs/APKs in a single Bazel invocation
Detailed features
- Bazel build settings/flags in
//build/bazel/rules/apex/BUILD, likeapexer_verboseandunsafe_disable_apex_allowed_deps_check - ABI stability for native deps
- ABI stable stubs are marked as required, and not included within the APEX
- non-ABI stable transitive deps are copied into the APEX
- Supports testonly APEXes (converted from
apex_test) - Supports default certificates with product config
- Supports default
file_contexts - Supports
allowed_deps.txtvalidation - Supports
apex_availablevalidation - Supports
min_sdk_versionvalidation - Supports
logging_parent,package_name,android_manifest,key. - Supports
apex_manifest.pbconversion - Supports
canned_fs_configgeneration - Supports
file_contextsgeneration - Licensing:
NOTICE.html.gzembedded in the APEX - All host tools are built from source by Bazel, or vendored prebuilts
- All actions are fully sandboxed
- Ability to build metadata files on the command line with
--output_groups=<coverage_files,backing_libs,...>
Guardrails / others
--config=androidis needed to build for the device. All APEX targets settarget_compatible_withto android only - no host APEXes.- Comprehensive set of rule analysis tests for in
apex_test.bzl - Example APEX in
//build/bazel/examples/apex/... - Unit and integration tests in
//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_apexmodules 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.- Correct product platform transitions for
apex_aabtomainline_modules_*products - Java support
- Rust support