filesystem modules gathers first target only
With this change, the deps property in filesystem modules gather the
first target of the filesystem module only.
To gather dependencies across both targets, use multilib.both.deps
instead.
Bug: N/A
Test: go test ./...
Change-Id: Ie2ff0c48f08c61c8b219fc2c1540476ff8e4b1fc
diff --git a/android/packaging.go b/android/packaging.go
index 383f828..080dcfe 100644
--- a/android/packaging.go
+++ b/android/packaging.go
@@ -142,6 +142,10 @@
// for rare cases like when there's a dependency to a module which exists in certain repo
// checkouts, this is needed.
IgnoreMissingDependencies bool
+
+ // If this is set to true by a module type inheriting PackagingBase, the deps property
+ // collects the first target only even with compile_multilib: true.
+ DepsCollectFirstTargetOnly bool
}
type depsProperty struct {
@@ -154,6 +158,7 @@
Common depsProperty `android:"arch_variant"`
Lib32 depsProperty `android:"arch_variant"`
Lib64 depsProperty `android:"arch_variant"`
+ Both depsProperty `android:"arch_variant"`
}
type packagingArchProperties struct {
@@ -194,11 +199,28 @@
ret = append(ret, p.properties.Multilib.Common.Deps...)
}
- for i, t := range ctx.MultiTargets() {
- if t.Arch.ArchType == arch {
- ret = append(ret, p.properties.Deps...)
- if i == 0 {
- ret = append(ret, p.properties.Multilib.First.Deps...)
+ if p.DepsCollectFirstTargetOnly {
+ if len(p.properties.Multilib.First.Deps) > 0 {
+ ctx.PropertyErrorf("multilib.first.deps", "not supported. use \"deps\" instead")
+ }
+ for i, t := range ctx.MultiTargets() {
+ if t.Arch.ArchType == arch {
+ ret = append(ret, p.properties.Multilib.Both.Deps...)
+ if i == 0 {
+ ret = append(ret, p.properties.Deps...)
+ }
+ }
+ }
+ } else {
+ if len(p.properties.Multilib.Both.Deps) > 0 {
+ ctx.PropertyErrorf("multilib.both.deps", "not supported. use \"deps\" instead")
+ }
+ for i, t := range ctx.MultiTargets() {
+ if t.Arch.ArchType == arch {
+ ret = append(ret, p.properties.Deps...)
+ if i == 0 {
+ ret = append(ret, p.properties.Multilib.First.Deps...)
+ }
}
}
}