Define getSnapshotNameSuffix() am: 07b9f86f0c am: 1ddff5f76f

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Id247e29f40c86e265932907b88e33765b73b4fa4
This commit is contained in:
Justin Yun
2021-02-26 10:04:51 +00:00
committed by Automerger Merge Worker
2 changed files with 20 additions and 29 deletions

View File

@@ -280,41 +280,36 @@ func (s *snapshot) GenerateAndroidBuildActions(ctx android.ModuleContext) {
// Nothing, the snapshot module is only used to forward dependency information in DepsMutator.
}
func (s *snapshot) DepsMutator(ctx android.BottomUpMutatorContext) {
collectSnapshotMap := func(variations []blueprint.Variation, depTag blueprint.DependencyTag,
names []string, snapshotSuffix, moduleSuffix string) map[string]string {
func getSnapshotNameSuffix(moduleSuffix, version, arch string) string {
versionSuffix := version
if arch != "" {
versionSuffix += "." + arch
}
return moduleSuffix + versionSuffix
}
func (s *snapshot) DepsMutator(ctx android.BottomUpMutatorContext) {
collectSnapshotMap := func(names []string, snapshotSuffix, moduleSuffix string) map[string]string {
snapshotMap := make(map[string]string)
for _, name := range names {
snapshotMap[name] = name +
snapshotSuffix + moduleSuffix +
s.baseSnapshot.version() +
"." + ctx.Arch().ArchType.Name
getSnapshotNameSuffix(snapshotSuffix+moduleSuffix,
s.baseSnapshot.version(), ctx.Arch().ArchType.Name)
}
return snapshotMap
}
snapshotSuffix := s.image.moduleNameSuffix()
headers := collectSnapshotMap(nil, HeaderDepTag(), s.properties.Header_libs, snapshotSuffix, snapshotHeaderSuffix)
binaries := collectSnapshotMap(nil, nil, s.properties.Binaries, snapshotSuffix, snapshotBinarySuffix)
objects := collectSnapshotMap(nil, nil, s.properties.Objects, snapshotSuffix, snapshotObjectSuffix)
staticLibs := collectSnapshotMap([]blueprint.Variation{
{Mutator: "link", Variation: "static"},
}, StaticDepTag(), s.properties.Static_libs, snapshotSuffix, snapshotStaticSuffix)
sharedLibs := collectSnapshotMap([]blueprint.Variation{
{Mutator: "link", Variation: "shared"},
}, SharedDepTag(), s.properties.Shared_libs, snapshotSuffix, snapshotSharedSuffix)
vndkLibs := collectSnapshotMap([]blueprint.Variation{
{Mutator: "link", Variation: "shared"},
}, SharedDepTag(), s.properties.Vndk_libs, "", vndkSuffix)
headers := collectSnapshotMap(s.properties.Header_libs, snapshotSuffix, snapshotHeaderSuffix)
binaries := collectSnapshotMap(s.properties.Binaries, snapshotSuffix, snapshotBinarySuffix)
objects := collectSnapshotMap(s.properties.Objects, snapshotSuffix, snapshotObjectSuffix)
staticLibs := collectSnapshotMap(s.properties.Static_libs, snapshotSuffix, snapshotStaticSuffix)
sharedLibs := collectSnapshotMap(s.properties.Shared_libs, snapshotSuffix, snapshotSharedSuffix)
vndkLibs := collectSnapshotMap(s.properties.Vndk_libs, "", vndkSuffix)
for k, v := range vndkLibs {
sharedLibs[k] = v
}
ctx.SetProvider(SnapshotInfoProvider, SnapshotInfo{
HeaderLibs: headers,
Binaries: binaries,
@@ -386,12 +381,7 @@ func (p *baseSnapshotDecorator) Name(name string) string {
}
func (p *baseSnapshotDecorator) NameSuffix() string {
versionSuffix := p.version()
if p.arch() != "" {
versionSuffix += "." + p.arch()
}
return p.baseProperties.ModuleSuffix + versionSuffix
return getSnapshotNameSuffix(p.moduleSuffix(), p.version(), p.arch())
}
func (p *baseSnapshotDecorator) version() string {

View File

@@ -421,6 +421,7 @@ func TestVendorSnapshotUse(t *testing.T) {
shared_libs: [
"libvendor_without_snapshot",
"libvendor_available",
"libvndk",
],
arch: {
arm64: {