Revert "Revert "Remove apex.apex_name""

This reverts commit d1209a89c7.

Reason for revert: apex_name was still in use in the internal/intermediate branch. Fixed(removed apex_name) in the internal branch.

Change-Id: I10b8e0cfdb01dcdb6b623bddf9c04f4dac71fc90
This commit is contained in:
Jooyung Han
2023-02-09 00:11:27 +00:00
committed by Gerrit Code Review
parent d1209a89c7
commit 63dff468d0
4 changed files with 21 additions and 71 deletions

View File

@@ -24,8 +24,6 @@ import (
"android/soong/cc"
"android/soong/java"
"android/soong/rust"
"github.com/google/blueprint/proptools"
)
func (a *apexBundle) AndroidMk() android.AndroidMkData {
@@ -74,12 +72,15 @@ func (a *apexBundle) fullModuleName(apexBundleName string, fi *apexFile) string
return fi.androidMkModuleName + "." + apexBundleName + a.suffix
}
func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, moduleDir string,
func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, moduleDir string,
apexAndroidMkData android.AndroidMkData) []string {
// apexBundleName comes from the 'name' property; apexName comes from 'apex_name' property.
// apexBundleName comes from the 'name' property or soong module.
// apexName comes from 'name' property of apex_manifest.
// An apex is installed to /system/apex/<apexBundleName> and is activated at /apex/<apexName>
// In many cases, the two names are the same, but could be different in general.
// However, symbol files for apex files are installed under /apex/<apexBundleName> to avoid
// conflicts between two apexes with the same apexName.
moduleNames := []string{}
apexType := a.properties.ApexType
@@ -90,11 +91,6 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo
return moduleNames
}
// b/162366062. Prevent GKI APEXes to emit make rules to avoid conflicts.
if strings.HasPrefix(apexName, "com.android.gki.") && apexType != flattenedApex {
return moduleNames
}
seenDataOutPaths := make(map[string]bool)
for _, fi := range a.filesInfo {
@@ -131,15 +127,15 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo
if fi.module != nil && fi.module.Owner() != "" {
fmt.Fprintln(w, "LOCAL_MODULE_OWNER :=", fi.module.Owner())
}
// /apex/<apex_name>/{lib|framework|...}
pathWhenActivated := filepath.Join("$(PRODUCT_OUT)", "apex", apexName, fi.installDir)
// /apex/<apexBundleName>/{lib|framework|...}
pathForSymbol := filepath.Join("$(PRODUCT_OUT)", "apex", apexBundleName, fi.installDir)
var modulePath string
if apexType == flattenedApex {
// /system/apex/<name>/{lib|framework|...}
// /system/apex/<apexBundleName>/{lib|framework|...}
modulePath = filepath.Join(a.installDir.String(), apexBundleName, fi.installDir)
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", modulePath)
if a.primaryApexType {
fmt.Fprintln(w, "LOCAL_SOONG_SYMBOL_PATH :=", pathWhenActivated)
fmt.Fprintln(w, "LOCAL_SOONG_SYMBOL_PATH :=", pathForSymbol)
}
android.AndroidMkEmitAssignList(w, "LOCAL_MODULE_SYMLINKS", fi.symlinks)
newDataPaths := []android.DataPath{}
@@ -152,8 +148,8 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo
}
android.AndroidMkEmitAssignList(w, "LOCAL_TEST_DATA", android.AndroidMkDataPaths(newDataPaths))
} else {
modulePath = pathWhenActivated
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", pathWhenActivated)
modulePath = pathForSymbol
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", modulePath)
// For non-flattend APEXes, the merged notice file is attached to the APEX itself.
// We don't need to have notice file for the individual modules in it. Otherwise,
@@ -311,8 +307,7 @@ func (a *apexBundle) androidMkForType() android.AndroidMkData {
moduleNames := []string{}
apexType := a.properties.ApexType
if a.installable() {
apexName := proptools.StringDefault(a.properties.Apex_name, name)
moduleNames = a.androidMkForFiles(w, name, apexName, moduleDir, data)
moduleNames = a.androidMkForFiles(w, name, moduleDir, data)
}
if apexType == flattenedApex {