Merge changes Iedcff7df,I4cb294c2 am: 001ca325fb
am: c6b4caf37e
Change-Id: Id1b12796c0e9ffe050820f295380271bfdab0f42
This commit is contained in:
47
apex/apex.go
47
apex/apex.go
@@ -63,8 +63,26 @@ var (
|
||||
usesTag = dependencyTag{name: "uses"}
|
||||
androidAppTag = dependencyTag{name: "androidApp", payload: true}
|
||||
apexAvailWl = makeApexAvailableWhitelist()
|
||||
|
||||
inverseApexAvailWl = invertApexWhiteList(apexAvailWl)
|
||||
)
|
||||
|
||||
// Transform the map of apex -> modules to module -> apexes.
|
||||
func invertApexWhiteList(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 while list of apexes to which the supplied module belongs.
|
||||
func WhitelistedApexAvailable(moduleName string) []string {
|
||||
return inverseApexAvailWl[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.
|
||||
@@ -969,7 +987,7 @@ func makeApexAvailableWhitelist() map[string][]string {
|
||||
//
|
||||
// Module separator
|
||||
//
|
||||
m["//any"] = []string{
|
||||
m[android.AvailableToAnyApex] = []string{
|
||||
"crtbegin_dynamic",
|
||||
"crtbegin_dynamic1",
|
||||
"crtbegin_so",
|
||||
@@ -2400,6 +2418,21 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
|
||||
func whitelistedApexAvailable(apex, moduleName string) bool {
|
||||
key := apex
|
||||
moduleName = normalizeModuleName(moduleName)
|
||||
|
||||
if val, ok := apexAvailWl[key]; ok && android.InList(moduleName, val) {
|
||||
return true
|
||||
}
|
||||
|
||||
key = android.AvailableToAnyApex
|
||||
if val, ok := apexAvailWl[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 = strings.TrimPrefix(moduleName, "prebuilt_")
|
||||
@@ -2408,17 +2441,7 @@ func whitelistedApexAvailable(apex, moduleName string) bool {
|
||||
// We don't want to list them all
|
||||
moduleName = "libclang_rt"
|
||||
}
|
||||
|
||||
if val, ok := apexAvailWl[key]; ok && android.InList(moduleName, val) {
|
||||
return true
|
||||
}
|
||||
|
||||
key = "//any"
|
||||
if val, ok := apexAvailWl[key]; ok && android.InList(moduleName, val) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
return moduleName
|
||||
}
|
||||
|
||||
func newApexBundle() *apexBundle {
|
||||
|
Reference in New Issue
Block a user