Remove dependency from vendor_snapshot to each module

The 'vendor_snapshot' module is required to every cc_library to check
if the dependencies need to be rewritten to the snapshot modules or
not. However, as the 'vendor_snapshot' module has dependencies to the
snapshot modules, the dependency to the 'vendor_snapshot' module
creates circular dependencies.
The dependency from the 'vendor_snapshot' to the snapshot modules is
required only to read the module names of the snapshot modules. We
may remove the dependency by setting the name of the snapshot modules
directly.

Bug: 179666286
Test: m nothing
Change-Id: I14abcb06c5c81ef7f8535103578747385c89ae0f
This commit is contained in:
Justin Yun 2021-02-25 18:21:27 +09:00
parent f3e0d22234
commit 4813867ec3
2 changed files with 11 additions and 15 deletions

View File

@ -284,23 +284,14 @@ func (s *snapshot) DepsMutator(ctx android.BottomUpMutatorContext) {
collectSnapshotMap := func(variations []blueprint.Variation, depTag blueprint.DependencyTag,
names []string, snapshotSuffix, moduleSuffix string) map[string]string {
decoratedNames := make([]string, 0, len(names))
for _, name := range names {
decoratedNames = append(decoratedNames, name+
snapshotSuffix+moduleSuffix+
s.baseSnapshot.version()+
"."+ctx.Arch().ArchType.Name)
}
deps := ctx.AddVariationDependencies(variations, depTag, decoratedNames...)
snapshotMap := make(map[string]string)
for _, dep := range deps {
if dep == nil {
continue
}
snapshotMap[dep.(*Module).BaseModuleName()] = ctx.OtherModuleName(dep)
for _, name := range names {
snapshotMap[name] = name +
snapshotSuffix + moduleSuffix +
s.baseSnapshot.version() +
"." + ctx.Arch().ArchType.Name
}
return snapshotMap
}

View File

@ -416,7 +416,12 @@ func TestVendorSnapshotUse(t *testing.T) {
name: "libvendor",
version: "BOARD",
target_arch: "arm64",
compile_multilib: "64",
vendor: true,
shared_libs: [
"libvendor_without_snapshot",
"libvendor_available",
],
arch: {
arm64: {
src: "libvendor.so",