diff options
Diffstat (limited to 'android/apex.go')
-rw-r--r-- | android/apex.go | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/android/apex.go b/android/apex.go index fcbd13ea2..2ac6ed08d 100644 --- a/android/apex.go +++ b/android/apex.go @@ -350,7 +350,8 @@ type SkipApexAllowedDependenciesCheck interface { // ApexModuleBase provides the default implementation for the ApexModule interface. APEX-aware // modules are expected to include this struct and call InitApexModule(). type ApexModuleBase struct { - ApexProperties ApexProperties + ApexProperties ApexProperties + apexPropertiesLock sync.Mutex // protects ApexProperties during parallel apexDirectlyInAnyMutator canHaveApexVariants bool @@ -761,18 +762,22 @@ func UpdateUniqueApexVariationsForDeps(mctx BottomUpMutatorContext, am ApexModul // UpdateDirectlyInAnyApex uses the final module to store if any variant of this module is directly // in any APEX, and then copies the final value to all the modules. It also copies the -// DirectlyInAnyApex value to any direct dependencies with a CopyDirectlyInAnyApexTag dependency -// tag. +// DirectlyInAnyApex value to any transitive dependencies with a CopyDirectlyInAnyApexTag +// dependency tag. func UpdateDirectlyInAnyApex(mctx BottomUpMutatorContext, am ApexModule) { base := am.apexModuleBase() - // Copy DirectlyInAnyApex and InAnyApex from any direct dependencies with a + // Copy DirectlyInAnyApex and InAnyApex from any transitive dependencies with a // CopyDirectlyInAnyApexTag dependency tag. - mctx.VisitDirectDeps(func(dep Module) { - if _, ok := mctx.OtherModuleDependencyTag(dep).(CopyDirectlyInAnyApexTag); ok { - depBase := dep.(ApexModule).apexModuleBase() + mctx.WalkDeps(func(child, parent Module) bool { + if _, ok := mctx.OtherModuleDependencyTag(child).(CopyDirectlyInAnyApexTag); ok { + depBase := child.(ApexModule).apexModuleBase() + depBase.apexPropertiesLock.Lock() + defer depBase.apexPropertiesLock.Unlock() depBase.ApexProperties.DirectlyInAnyApex = base.ApexProperties.DirectlyInAnyApex depBase.ApexProperties.InAnyApex = base.ApexProperties.InAnyApex + return true } + return false }) if base.ApexProperties.DirectlyInAnyApex { |