LOCAL_REQUIRED_MODULES from apex has ":32" or ":64" suffix
Currently, when a module is included in an APEX, the dependencies of the
modules are listed in LOCAL_REQUIRED_MODULES of the APEX. There are two
purposes for this:
1) for native dependencies, they are installed to
$(TARGET_OUT)/apex/<apexname> directories which isn't packaged as an
*.img. However, as a side effect of the installation, their symbol files
are placed under $(TARGET_OUT)/symbols directory to aid debugging.
2) to implement the symlink optimization. When the APEX is not
updatable, the dependencies are not included inside the APEX, but
installed directly to /system partition because the same files might be
used outside of the APEX. The files in the APEX are replaced with
symlinks to the system copy.
So far, the module name like "libfoo" was directly used in
LOCAL_REQUIRED_MODULES. This becomes problematic when only a single arch
variant of the module is used by the APEX. The build system will install
both arch variants to the system partition.
This change fixes the problem by appending ":32" or ":64" suffix
when composing LOCAL_REQUIRED_MODULES.
Bug: N/A
Test: m
Test: Cherry-pick I285c5d1bb9b27265c8589f2588d95eafa324d412 and its
dependencies from internal master. `m nothing` doesn't show the artifact
path requirement error.
Change-Id: I78feae1d5b18f93b0f984d3b1558812fd1689a96
diff --git a/apex/androidmk.go b/apex/androidmk.go
index 0b114f8..4408283 100644
--- a/apex/androidmk.go
+++ b/apex/androidmk.go
@@ -126,8 +126,18 @@
moduleName := a.fullModuleName(apexBundleName, &fi)
- if !android.InList(moduleName, moduleNames) {
- moduleNames = append(moduleNames, moduleName)
+ // This name will be added to LOCAL_REQUIRED_MODULES of the APEX. We need to be
+ // arch-specific otherwise we will end up installing both ABIs even when only
+ // either of the ABI is requested.
+ aName := moduleName
+ switch fi.multilib {
+ case "lib32":
+ aName = aName + ":32"
+ case "lib64":
+ aName = aName + ":64"
+ }
+ if !android.InList(aName, moduleNames) {
+ moduleNames = append(moduleNames, aName)
}
if linkToSystemLib {