Remove apex_available allowlist

Bug: 147364041
Test: m nothing --no-skip-soong-tests
Change-Id: I65ac605fe77a9e013a2c0b64adc36db414c77465
This commit is contained in:
Jooyung Han
2024-08-29 13:00:33 +09:00
parent 88a8daf8ca
commit a89a58ac1c
2 changed files with 1 additions and 73 deletions

View File

@@ -2819,7 +2819,7 @@ func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) {
return false
}
if to.AvailableFor(apexName) || baselineApexAvailable(apexName, toName) {
if to.AvailableFor(apexName) {
return true
}
@@ -2879,74 +2879,6 @@ func (a *apexBundle) IDEInfo(ctx android.BaseModuleContext, dpInfo *android.IdeI
dpInfo.Deps = append(dpInfo.Deps, a.properties.ResolvedSystemserverclasspathFragments...)
}
var (
apexAvailBaseline = makeApexAvailableBaseline()
inverseApexAvailBaseline = invertApexBaseline(apexAvailBaseline)
)
func baselineApexAvailable(apex, moduleName string) bool {
key := apex
moduleName = normalizeModuleName(moduleName)
if val, ok := apexAvailBaseline[key]; ok && android.InList(moduleName, val) {
return true
}
key = android.AvailableToAnyApex
if val, ok := apexAvailBaseline[key]; ok && android.InList(moduleName, val) {
return true
}
return false
}
func normalizeModuleName(moduleName string) string {
// Prebuilt modules (e.g. java_import, etc.) have "prebuilt_" prefix added by the build
// system. Trim the prefix for the check since they are confusing
moduleName = android.RemoveOptionalPrebuiltPrefix(moduleName)
if strings.HasPrefix(moduleName, "libclang_rt.") {
// This module has many arch variants that depend on the product being built.
// We don't want to list them all
moduleName = "libclang_rt"
}
if strings.HasPrefix(moduleName, "androidx.") {
// TODO(b/156996905) Set apex_available/min_sdk_version for androidx support libraries
moduleName = "androidx"
}
return moduleName
}
// Transform the map of apex -> modules to module -> apexes.
func invertApexBaseline(m map[string][]string) map[string][]string {
r := make(map[string][]string)
for apex, modules := range m {
for _, module := range modules {
r[module] = append(r[module], apex)
}
}
return r
}
// Retrieve the baseline of apexes to which the supplied module belongs.
func BaselineApexAvailable(moduleName string) []string {
return inverseApexAvailBaseline[normalizeModuleName(moduleName)]
}
// This is a map from apex to modules, which overrides the apex_available setting for that
// particular module to make it available for the apex regardless of its setting.
// TODO(b/147364041): remove this
func makeApexAvailableBaseline() map[string][]string {
// The "Module separator"s below are employed to minimize merge conflicts.
m := make(map[string][]string)
//
// Module separator
//
m["com.android.runtime"] = []string{
"libz",
}
return m
}
func init() {
android.AddNeverAllowRules(createBcpPermittedPackagesRules(qBcpPackages())...)
android.AddNeverAllowRules(createBcpPermittedPackagesRules(rBcpPackages())...)

View File

@@ -22,7 +22,6 @@ import (
"sort"
"strings"
"android/soong/apex"
"android/soong/cc"
"android/soong/java"
@@ -1133,9 +1132,6 @@ func (s *snapshotBuilder) AddPrebuiltModule(member android.SdkMember, moduleType
apexAvailable = []string{android.AvailableToPlatform}
}
// Add in any baseline apex available settings.
apexAvailable = append(apexAvailable, apex.BaselineApexAvailable(member.Name())...)
// Remove duplicates and sort.
apexAvailable = android.FirstUniqueStrings(apexAvailable)
sort.Strings(apexAvailable)