Don't install system image copies of libraries in unbundled apex builds
Apex builds are setting LOCAL_REQUIRED_MODULES to include external
dependencies into the system image. This make sense for device builds,
but just causes extra unnecessary builds for unbundled apex builds
that are not building device images. Skip the dependency during
unbundled builds.
Test: aosp-master-art mainline_modules_x86_64-userdebug builds
Change-Id: I363995b7309cc3c90b0a584d051050f105b5b915
diff --git a/apex/apex.go b/apex/apex.go
index 9485a4b..c76fad3 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -2340,7 +2340,10 @@
//
// Always include if we are a host-apex however since those won't have any
// system libraries.
- if ch.IsStubsImplementationRequired() && !am.DirectlyInAnyApex() {
+ //
+ // Skip the dependency in unbundled builds where the device image is not
+ // being built.
+ if ch.IsStubsImplementationRequired() && !am.DirectlyInAnyApex() && !ctx.Config().UnbundledBuild() {
// we need a module name for Make
name := ch.ImplementationModuleNameForMake(ctx) + ch.Properties.SubName
if !android.InList(name, a.requiredDeps) {