summaryrefslogtreecommitdiff
path: root/sdk/sdk.go
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2021-07-14 10:29:36 +0100
committer Paul Duffin <paulduffin@google.com> 2021-08-31 17:07:07 +0100
commit296701e35b96c232bc4c0af69cfe0e367fd54ef4 (patch)
tree8315ccc4bc1ffad392779a4efc2b08336f31cd9c /sdk/sdk.go
parent45de13f93dc9c859fd763b320a80fb6d740c0a62 (diff)
Refactor SdkMemberType.AddDependencies()
Replaces the BottomUpMutatorContext parameter with a new SdkDependencyContext type that extends BottomUpMutatorContext. This is to allow the sdk to pass additional information to the implementations of that method to allow the behavior to be more finely tuned. Bug: 195754365 Test: m nothing Change-Id: I69c6d2c523934eb67d7a7e6c55c241e9b8a81773
Diffstat (limited to 'sdk/sdk.go')
-rw-r--r--sdk/sdk.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/sdk/sdk.go b/sdk/sdk.go
index b1c8aebf9..a972f31da 100644
--- a/sdk/sdk.go
+++ b/sdk/sdk.go
@@ -341,6 +341,19 @@ func (s *sdk) AndroidMkEntries() []android.AndroidMkEntries {
}}
}
+// newDependencyContext creates a new SdkDependencyContext for this sdk.
+func (s *sdk) newDependencyContext(mctx android.BottomUpMutatorContext) android.SdkDependencyContext {
+ return &dependencyContext{
+ BottomUpMutatorContext: mctx,
+ }
+}
+
+type dependencyContext struct {
+ android.BottomUpMutatorContext
+}
+
+var _ android.SdkDependencyContext = (*dependencyContext)(nil)
+
// RegisterPreDepsMutators registers pre-deps mutators to support modules implementing SdkAware
// interface and the sdk module type. This function has been made public to be called by tests
// outside of the sdk package
@@ -410,6 +423,7 @@ func memberMutator(mctx android.BottomUpMutatorContext) {
if s, ok := mctx.Module().(*sdk); ok {
// Add dependencies from enabled and non CommonOS variants to the sdk member variants.
if s.Enabled() && !s.IsCommonOSVariant() {
+ ctx := s.newDependencyContext(mctx)
for _, memberListProperty := range s.memberListProperties() {
if memberListProperty.getter == nil {
continue
@@ -417,7 +431,7 @@ func memberMutator(mctx android.BottomUpMutatorContext) {
names := memberListProperty.getter(s.dynamicMemberTypeListProperties)
if len(names) > 0 {
tag := memberListProperty.dependencyTag
- memberListProperty.memberType.AddDependencies(mctx, tag, names)
+ memberListProperty.memberType.AddDependencies(ctx, tag, names)
}
}
}