summaryrefslogtreecommitdiff
path: root/android/packaging.go
diff options
context:
space:
mode:
author Jiyong Park <jiyong@google.com> 2024-05-14 21:49:11 +0900
committer Jiyong Park <jiyong@google.com> 2024-05-14 21:56:42 +0900
commitc6a773df6493ac4697d9e6ad244028a54eceabec (patch)
treec89fe65fb6349a4ba73c31ef6fd900669ddddf45 /android/packaging.go
parent635e1218bddb8274c520fc59a222e619e89b0d65 (diff)
Filter-out deps of unsupported arch
When a common-arch module (ex: phony) has the "required" dependencies on native modules (ex: cc_library), both 32 and 64-bit variants of the native modules are added as dependencies. This by itself is fine and actually is intended, otherwise there's no way for us to install both arch variants via required deps. However, this imposes a problem when the common-arch module is depended on by a filesystem module with compile_multilib: "first". Here, the expectation is that only the first variant (64-bit) of the native module is instaled, but in reality both variants are installed. To handle this situation, make sure that the packaging routine filters out packaging specs from unsupported architecture. Bug: N/A Test: go test ./... under soong/filesyste Change-Id: Ie1ad5ace2e5d88e00183a115f4a76e5df87a8166
Diffstat (limited to 'android/packaging.go')
-rw-r--r--android/packaging.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/android/packaging.go b/android/packaging.go
index a7260a641..383f828bd 100644
--- a/android/packaging.go
+++ b/android/packaging.go
@@ -51,6 +51,9 @@ type PackagingSpec struct {
// Paths of aconfig files for the built artifact
aconfigPaths *Paths
+
+ // ArchType of the module which produced this packaging spec
+ archType ArchType
}
func (p *PackagingSpec) Equals(other *PackagingSpec) bool {
@@ -260,11 +263,31 @@ func (p *PackagingBase) AddDeps(ctx BottomUpMutatorContext, depTag blueprint.Dep
func (p *PackagingBase) GatherPackagingSpecsWithFilter(ctx ModuleContext, filter func(PackagingSpec) bool) map[string]PackagingSpec {
m := make(map[string]PackagingSpec)
+
+ var arches []ArchType
+ for _, target := range p.getSupportedTargets(ctx) {
+ arches = append(arches, target.Arch.ArchType)
+ }
+
+ // filter out packaging specs for unsupported architecture
+ filterArch := func(ps PackagingSpec) bool {
+ for _, arch := range arches {
+ if arch == ps.archType {
+ return true
+ }
+ }
+ return false
+ }
+
ctx.VisitDirectDeps(func(child Module) {
if pi, ok := ctx.OtherModuleDependencyTag(child).(PackagingItem); !ok || !pi.IsPackagingItem() {
return
}
for _, ps := range child.TransitivePackagingSpecs() {
+ if !filterArch(ps) {
+ continue
+ }
+
if filter != nil {
if !filter(ps) {
continue