summaryrefslogtreecommitdiff
path: root/android/apex.go
diff options
context:
space:
mode:
author Jihoon Kang <jihoonkang@google.com> 2024-05-24 01:03:20 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2024-05-24 01:03:20 +0000
commitd6638ef5e95815ca0618b17a54bbfdda5290be04 (patch)
tree87cc98bf51629bb2906ba0122a8a0449fe0a7b6c /android/apex.go
parent873384423668f851822975686dfef6786edf0856 (diff)
parentd02bd377dad293a207651e035d14a21cb8ba7c73 (diff)
Merge "Propagate DirectlyInAnyApex to transitive dependencies" into main am: d02bd377da
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3098497 Change-Id: I0e06d50acfe4713728649c81dd66a0343108ab73 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'android/apex.go')
-rw-r--r--android/apex.go19
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 {