Merge changes from topic "multi_install_skip_symbol_files" am: d7d179a0e8

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2424705

Change-Id: Icb9c28690762c46079d405b716f86aff53d79036
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jooyung Han
2023-02-07 22:27:07 +00:00
committed by Automerger Merge Worker
5 changed files with 9 additions and 54 deletions

View File

@@ -95,20 +95,6 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo
return moduleNames return moduleNames
} }
// b/140136207. When there are overriding APEXes for a VNDK APEX, the symbols file for the overridden
// APEX and the overriding APEX will have the same installation paths at /apex/com.android.vndk.v<ver>
// as their apexName will be the same. To avoid the path conflicts, skip installing the symbol files
// for the overriding VNDK APEXes.
symbolFilesNotNeeded := a.vndkApex && len(a.overridableProperties.Overrides) > 0
if symbolFilesNotNeeded && apexType != flattenedApex {
return moduleNames
}
// Avoid creating duplicate build rules for multi-installed APEXes.
if proptools.BoolDefault(a.properties.Multi_install_skip_symbol_files, false) {
return moduleNames
}
seenDataOutPaths := make(map[string]bool) seenDataOutPaths := make(map[string]bool)
for _, fi := range a.filesInfo { for _, fi := range a.filesInfo {
@@ -152,7 +138,7 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo
// /system/apex/<name>/{lib|framework|...} // /system/apex/<name>/{lib|framework|...}
modulePath = filepath.Join(a.installDir.String(), apexBundleName, fi.installDir) modulePath = filepath.Join(a.installDir.String(), apexBundleName, fi.installDir)
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", modulePath) fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", modulePath)
if a.primaryApexType && !symbolFilesNotNeeded { if a.primaryApexType {
fmt.Fprintln(w, "LOCAL_SOONG_SYMBOL_PATH :=", pathWhenActivated) fmt.Fprintln(w, "LOCAL_SOONG_SYMBOL_PATH :=", pathWhenActivated)
} }
android.AndroidMkEmitAssignList(w, "LOCAL_MODULE_SYMLINKS", fi.symlinks) android.AndroidMkEmitAssignList(w, "LOCAL_MODULE_SYMLINKS", fi.symlinks)

View File

@@ -149,16 +149,6 @@ type apexBundleProperties struct {
// Should be only used in non-system apexes (e.g. vendor: true). Default is false. // Should be only used in non-system apexes (e.g. vendor: true). Default is false.
Use_vndk_as_stable *bool Use_vndk_as_stable *bool
// Whether this is multi-installed APEX should skip installing symbol files.
// Multi-installed APEXes share the same apex_name and are installed at the same time.
// Default is false.
//
// Should be set to true for all multi-installed APEXes except the singular
// default version within the multi-installed group.
// Only the default version can install symbol files in $(PRODUCT_OUT}/apex,
// or else conflicting build rules may be created.
Multi_install_skip_symbol_files *bool
// The type of APEX to build. Controls what the APEX payload is. Either 'image', 'zip' or // The type of APEX to build. Controls what the APEX payload is. Either 'image', 'zip' or
// 'both'. When set to image, contents are stored in a filesystem image inside a zip // 'both'. When set to image, contents are stored in a filesystem image inside a zip
// container. When set to zip, contents are stored in a zip container directly. This type is // container. When set to zip, contents are stored in a zip container directly. This type is

View File

@@ -3806,11 +3806,9 @@ func TestVndkApexNameRule(t *testing.T) {
}`+vndkLibrariesTxtFiles("28", "current")) }`+vndkLibrariesTxtFiles("28", "current"))
assertApexName := func(expected, moduleName string) { assertApexName := func(expected, moduleName string) {
bundle := ctx.ModuleForTests(moduleName, "android_common_image").Module().(*apexBundle) module := ctx.ModuleForTests(moduleName, "android_common_image")
actual := proptools.String(bundle.properties.Apex_name) apexManifestRule := module.Rule("apexManifestRule")
if !reflect.DeepEqual(actual, expected) { ensureContains(t, apexManifestRule.Args["opt"], "-v name "+expected)
t.Errorf("Got '%v', expected '%v'", actual, expected)
}
} }
assertApexName("com.android.vndk.v29", "com.android.vndk.current") assertApexName("com.android.vndk.v29", "com.android.vndk.current")
@@ -4136,9 +4134,6 @@ func TestApexName(t *testing.T) {
`) `)
module := ctx.ModuleForTests("myapex", "android_common_com.android.myapex_image") module := ctx.ModuleForTests("myapex", "android_common_com.android.myapex_image")
apexManifestRule := module.Rule("apexManifestRule")
ensureContains(t, apexManifestRule.Args["opt"], "-v name com.android.myapex")
apexBundle := module.Module().(*apexBundle) apexBundle := module.Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, ctx, apexBundle) data := android.AndroidMkDataForTest(t, ctx, apexBundle)
name := apexBundle.BaseModuleName() name := apexBundle.BaseModuleName()

View File

@@ -241,10 +241,11 @@ func (a *apexBundle) buildManifest(ctx android.ModuleContext, provideNativeLibs,
provideNativeLibs = android.SortedUniqueStrings(provideNativeLibs) provideNativeLibs = android.SortedUniqueStrings(provideNativeLibs)
requireNativeLibs = android.SortedUniqueStrings(android.RemoveListFromList(requireNativeLibs, provideNativeLibs)) requireNativeLibs = android.SortedUniqueStrings(android.RemoveListFromList(requireNativeLibs, provideNativeLibs))
// APEX name can be overridden // VNDK APEX name is determined at runtime, so update "name" in apex_manifest
optCommands := []string{} optCommands := []string{}
if a.properties.Apex_name != nil { if a.vndkApex {
optCommands = append(optCommands, "-v name "+*a.properties.Apex_name) apexName := vndkApexNamePrefix + a.vndkVersion(ctx.DeviceConfig())
optCommands = append(optCommands, "-v name "+apexName)
} }
// Collect jniLibs. Notice that a.filesInfo is already sorted // Collect jniLibs. Notice that a.filesInfo is already sorted
@@ -454,19 +455,6 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
installSymbolFiles := (!ctx.Config().KatiEnabled() || a.ExportedToMake()) && a.installable() installSymbolFiles := (!ctx.Config().KatiEnabled() || a.ExportedToMake()) && a.installable()
// b/140136207. When there are overriding APEXes for a VNDK APEX, the symbols file for the overridden
// APEX and the overriding APEX will have the same installation paths at /apex/com.android.vndk.v<ver>
// as their apexName will be the same. To avoid the path conflicts, skip installing the symbol files
// for the overriding VNDK APEXes.
if a.vndkApex && len(a.overridableProperties.Overrides) > 0 {
installSymbolFiles = false
}
// Avoid creating duplicate build rules for multi-installed APEXes.
if proptools.BoolDefault(a.properties.Multi_install_skip_symbol_files, false) {
installSymbolFiles = false
}
// set of dependency module:location mappings // set of dependency module:location mappings
installMapSet := make(map[string]bool) installMapSet := make(map[string]bool)
@@ -1012,7 +1000,7 @@ func (a *apexBundle) getOverrideManifestPackageName(ctx android.ModuleContext) s
if a.vndkApex { if a.vndkApex {
overrideName, overridden := ctx.DeviceConfig().OverrideManifestPackageNameFor(vndkApexName) overrideName, overridden := ctx.DeviceConfig().OverrideManifestPackageNameFor(vndkApexName)
if overridden { if overridden {
return strings.Replace(*a.properties.Apex_name, vndkApexName, overrideName, 1) return overrideName + ".v" + a.vndkVersion(ctx.DeviceConfig())
} }
return "" return ""
} }

View File

@@ -65,10 +65,6 @@ func apexVndkMutator(mctx android.TopDownMutatorContext) {
} }
vndkVersion := ab.vndkVersion(mctx.DeviceConfig()) vndkVersion := ab.vndkVersion(mctx.DeviceConfig())
// Ensure VNDK APEX mount point is formatted as com.android.vndk.v###
ab.properties.Apex_name = proptools.StringPtr(vndkApexNamePrefix + vndkVersion)
apiLevel, err := android.ApiLevelFromUser(mctx, vndkVersion) apiLevel, err := android.ApiLevelFromUser(mctx, vndkVersion)
if err != nil { if err != nil {
mctx.PropertyErrorf("vndk_version", "%s", err.Error()) mctx.PropertyErrorf("vndk_version", "%s", err.Error())