From 4813867ec3a17e9afd123220b985039c6e57a315 Mon Sep 17 00:00:00 2001 From: Justin Yun Date: Thu, 25 Feb 2021 18:21:27 +0900 Subject: [PATCH] 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 --- cc/snapshot_prebuilt.go | 21 ++++++--------------- cc/vendor_snapshot_test.go | 5 +++++ 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/cc/snapshot_prebuilt.go b/cc/snapshot_prebuilt.go index 62daafde4..69b994861 100644 --- a/cc/snapshot_prebuilt.go +++ b/cc/snapshot_prebuilt.go @@ -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 } diff --git a/cc/vendor_snapshot_test.go b/cc/vendor_snapshot_test.go index 7e283fb89..4b76f5163 100644 --- a/cc/vendor_snapshot_test.go +++ b/cc/vendor_snapshot_test.go @@ -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",