diff options
author | 2023-10-26 20:48:02 +0000 | |
---|---|---|
committer | 2023-11-08 18:37:18 +0000 | |
commit | e3fcb41ff7dcdb2d65c068c575147f965e8afb47 (patch) | |
tree | 4f7e70873ad771733f76ea3e0317838d1fe88d58 /android/prebuilt.go | |
parent | 04445d54430b41905c7ccc013286269bcf75a5f9 (diff) |
Create a singleton all_apex_contributions module type
This will be a container for the the apex_contributions
selected using build flags. This module will be used to query the state of
selected apex contributions instead of a global that can be mutated by
anyone.
It will set a provider containing metadata for source vs prebuilts
selection. To reduce the overhead of a new mutator, this will be done in
the existing `prebuilt_select` mutator.
It will validate that there are no dups (`foo` and `prebuilt_foo` cannot
be both selected)
Bug: 308174923
Test: go test ./android
Change-Id: Ie42999a71f35d70e0e977f5ab07ce451608d9f35
Diffstat (limited to 'android/prebuilt.go')
-rw-r--r-- | android/prebuilt.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/android/prebuilt.go b/android/prebuilt.go index e7b79796e..5acef1de4 100644 --- a/android/prebuilt.go +++ b/android/prebuilt.go @@ -435,6 +435,10 @@ func checkInvariantsForSourceAndPrebuilt(ctx BaseModuleContext, s, p Module) { // PrebuiltSelectModuleMutator marks prebuilts that are used, either overriding source modules or // because the source module doesn't exist. It also disables installing overridden source modules. +// +// If the visited module is the metadata module `all_apex_contributions`, it sets a +// provider containing metadata about whether source or prebuilt of mainline modules should be used. +// This logic was added here to prevent the overhead of creating a new mutator. func PrebuiltSelectModuleMutator(ctx TopDownMutatorContext) { m := ctx.Module() if p := GetEmbeddedPrebuilt(m); p != nil { @@ -455,6 +459,11 @@ func PrebuiltSelectModuleMutator(ctx TopDownMutatorContext) { } }) } + // If this is `all_apex_contributions`, set a provider containing + // metadata about source vs prebuilts selection + if am, ok := m.(*allApexContributions); ok { + am.SetPrebuiltSelectionInfoProvider(ctx) + } } // PrebuiltPostDepsMutator replaces dependencies on the source module with dependencies on the |