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
This commit is contained in:
@@ -126,8 +126,18 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo
|
||||
|
||||
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 {
|
||||
|
@@ -440,6 +440,8 @@ type apexFile struct {
|
||||
transitiveDep bool
|
||||
isJniLib bool
|
||||
|
||||
multilib string
|
||||
|
||||
// TODO(jiyong): remove this
|
||||
module android.Module
|
||||
}
|
||||
@@ -459,6 +461,7 @@ func newApexFile(ctx android.BaseModuleContext, builtFile android.Path, androidM
|
||||
ret.requiredModuleNames = module.RequiredModuleNames()
|
||||
ret.targetRequiredModuleNames = module.TargetRequiredModuleNames()
|
||||
ret.hostRequiredModuleNames = module.HostRequiredModuleNames()
|
||||
ret.multilib = module.Target().Arch.ArchType.Multilib
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
@@ -5536,7 +5536,7 @@ func TestSymlinksFromApexToSystemRequiredModuleNames(t *testing.T) {
|
||||
ensureNotContains(t, androidMk, "LOCAL_MODULE := prebuilt_myotherlib.myapex\n")
|
||||
ensureNotContains(t, androidMk, "LOCAL_MODULE := myotherlib.myapex\n")
|
||||
// `myapex` should have `myotherlib` in its required line, not `prebuilt_myotherlib`
|
||||
ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES += mylib.myapex myotherlib apex_manifest.pb.myapex apex_pubkey.myapex\n")
|
||||
ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES += mylib.myapex:64 myotherlib:64 apex_manifest.pb.myapex apex_pubkey.myapex\n")
|
||||
}
|
||||
|
||||
func TestApexWithJniLibs(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user