aboutsummaryrefslogtreecommitdiffstats
path: root/apex
diff options
context:
space:
mode:
authorJiyong Park <jiyong@google.com>2019-02-20 21:49:26 +0900
committerJiyong Park <jiyong@google.com>2019-02-20 22:02:22 +0900
commitac2bacd418b0813cfdbe82af7ff21ca19e57d665 (patch)
tree35b01403bdfdae072bb8552ab29b54e5a42a3079 /apex
parente0233a5bdd560ad567dc716990ab17c3fe0c5a4f (diff)
downloadbuild_soong-ac2bacd418b0813cfdbe82af7ff21ca19e57d665.tar.gz
build_soong-ac2bacd418b0813cfdbe82af7ff21ca19e57d665.tar.bz2
build_soong-ac2bacd418b0813cfdbe82af7ff21ca19e57d665.zip
Install external deps of an APEX
By default, if a lib is included in an APEX, all its direct and indirect dependencies are also included in the same APEX. However, when one of the dependencies have stable API (i.e. has stubs: {...}) then the lib having stable API and its dependencies are not included in the APEX. However, the problem here is that the lib having stable API might not be installed on the system, thus causing error at runtime. This can happen if there is no other module in the platform that depends on the lib. This change fixes the problem by adding such libraries as external dependencies so that they are also installed on the device along with the APEXes using them. Bug: 124831003 Test: m installclean; m com.android.resolv libbinder_ndk, libvndksupport are found under system/lib Change-Id: I457e03ff3fce37e0890c64d911e6e0ea6d0c6dd6
Diffstat (limited to 'apex')
-rw-r--r--apex/apex.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/apex/apex.go b/apex/apex.go
index 408415eb..86393377 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -389,6 +389,9 @@ type apexBundle struct {
// list of files to be included in this apex
filesInfo []apexFile
+ // list of module names that this APEX is depending on
+ externalDeps []string
+
flattened bool
testApex bool
@@ -731,6 +734,14 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if am, ok := child.(android.ApexModule); ok && am.CanHaveApexVariants() && am.IsInstallableToApex() {
if cc, ok := child.(*cc.Module); ok {
if cc.IsStubs() || cc.HasStubsVariants() {
+ // If the dependency is a stubs lib, don't include it in this APEX,
+ // but make sure that the lib is installed on the device.
+ // In case no APEX is having the lib, the lib is installed to the system
+ // partition.
+ if !android.DirectlyInAnyApex(ctx, cc.Name()) && !android.InList(cc.Name(), a.externalDeps) {
+ a.externalDeps = append(a.externalDeps, cc.Name())
+ }
+ // Don't track further
return false
}
depName := ctx.OtherModuleName(child)
@@ -1126,6 +1137,9 @@ func (a *apexBundle) androidMkForType(apexType apexPackaging) android.AndroidMkD
if len(moduleNames) > 0 {
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES +=", strings.Join(moduleNames, " "))
}
+ if len(a.externalDeps) > 0 {
+ fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES +=", strings.Join(a.externalDeps, " "))
+ }
fmt.Fprintln(w, "include $(BUILD_PREBUILT)")
if apexType == imageApex {