From f2635ec4340732e1f86cef3ff9e5fa64b9c9dc3c Mon Sep 17 00:00:00 2001 From: Martin Stjernholm Date: Wed, 16 Dec 2020 01:01:59 +0000 Subject: [PATCH] Always track transitive dependencies for host. This fixes a regression in https://r.android.com/1515154 when building the host ART APEX (com.android.art.host). Test: art/build/apex/runtests.sh Bug: 166468760 Change-Id: I39a00019b7bfa77a865e7287c66add3566b34d87 --- apex/apex.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apex/apex.go b/apex/apex.go index 261284c72..82d7ecf4b 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -1682,8 +1682,15 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { } af := apexFileForNativeLibrary(ctx, cc, handleSpecialLibs) af.transitiveDep = true + + // Always track transitive dependencies for host. + if a.Host() { + filesInfo = append(filesInfo, af) + return true + } + abInfo := ctx.Provider(ApexBundleInfoProvider).(ApexBundleInfo) - if !a.Host() && !abInfo.Contents.DirectlyInApex(depName) && (cc.IsStubs() || cc.HasStubsVariants()) { + if !abInfo.Contents.DirectlyInApex(depName) && (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 @@ -1716,7 +1723,8 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { // else-if clause for the indirect dependencies. // Currently, that's impossible because we would // like to record requiredNativeLibs even when - // DepIsInSameAPex is false. + // DepIsInSameAPex is false. We also shouldn't do + // this for host. if !am.DepIsInSameApex(ctx, am) { return false }