summaryrefslogtreecommitdiff
path: root/android/apex.go
diff options
context:
space:
mode:
author Yu Liu <yudiliu@google.com> 2024-12-10 23:39:24 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-12-10 23:39:24 +0000
commitc4179b5f7fc5e6de0ce27d9583ff5edfc93389c0 (patch)
treefc3ce0b4f1f3daeaea8107dfc169f4e95b85b080 /android/apex.go
parentea96c9fb69fc7c98b7789bf2d18fb398c5223908 (diff)
parentb73c3a6d221523f06d30c15145866056556187d0 (diff)
Merge "Convert checkApexAvailability to use ModuleProxy." into main
Diffstat (limited to 'android/apex.go')
-rw-r--r--android/apex.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/android/apex.go b/android/apex.go
index f625bafcc..78511f9aa 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -77,6 +77,9 @@ type ApexInfo struct {
// Returns the value of `apex_available_name`
ApexAvailableName string
+
+ // Returns the apex names that this module is available for
+ ApexAvailableFor []string
}
// AllApexInfo holds the ApexInfo of all apexes that include this module.
@@ -213,6 +216,12 @@ type ApexModule interface {
// apex_available property of the module.
AvailableFor(what string) bool
+ // Returns the apexes that are available for this module, valid values include
+ // "//apex_available:platform", "//apex_available:anyapex" and specific apexes.
+ // There are some differences between this one and the ApexAvailable on
+ // ApexModuleBase for cc, java library and sdkLibraryXml.
+ ApexAvailableFor() []string
+
// AlwaysRequiresPlatformApexVariant allows the implementing module to determine whether an
// APEX mutator should always be created for it.
//
@@ -320,6 +329,10 @@ func (m *ApexModuleBase) ApexAvailable() []string {
return CopyOf(availableToPlatformList)
}
+func (m *ApexModuleBase) ApexAvailableFor() []string {
+ return m.ApexAvailable()
+}
+
// Implements ApexModule
func (m *ApexModuleBase) BuildForApex(apex ApexInfo) {
m.apexInfosLock.Lock()
@@ -420,7 +433,7 @@ func CheckAvailableForApex(what string, apex_available []string) bool {
// Implements ApexModule
func (m *ApexModuleBase) AvailableFor(what string) bool {
- return CheckAvailableForApex(what, m.ApexProperties.Apex_available)
+ return CheckAvailableForApex(what, m.ApexAvailableFor())
}
// Implements ApexModule
@@ -614,6 +627,7 @@ func MutateApexTransition(ctx BaseModuleContext, variation string) {
} else {
panic(fmt.Errorf("failed to find apexInfo for incoming variation %q", variation))
}
+ thisApexInfo.ApexAvailableFor = module.ApexAvailableFor()
SetProvider(ctx, ApexInfoProvider, thisApexInfo)
}