Remove bp2build deps mutator
Refactor bp2build to retrieve modules directly by name, instead of via
DirectDeps. This functions properly as bp2build has no need for variant
information of the blueprint graph.
Test: USE_BAZEL_ANALYSIS=1 m fmtlib
Change-Id: Ief4b67bc56f24929871af772f3a742f07085bf8c
diff --git a/android/bazel_paths.go b/android/bazel_paths.go
index f74fed1..26cacdb 100644
--- a/android/bazel_paths.go
+++ b/android/bazel_paths.go
@@ -73,6 +73,7 @@
EarlyModulePathContext
GetDirectDep(name string) (blueprint.Module, blueprint.DependencyTag)
+ ModuleFromName(name string) (blueprint.Module, bool)
Module() Module
ModuleType() string
OtherModuleName(m blueprint.Module) string
@@ -331,11 +332,9 @@
// module. The label will be relative to the current directory if appropriate. The dependency must
// already be resolved by either deps mutator or path deps mutator.
func getOtherModuleLabel(ctx BazelConversionPathContext, dep, tag string, isWholeLibs bool) bazel.Label {
- m, _ := ctx.GetDirectDep(dep)
+ m, _ := ctx.ModuleFromName(dep)
if m == nil {
- panic(fmt.Errorf(`Cannot get direct dep %q of %q.
- This is likely because it was not added via AddDependency().
- This may be due a mutator skipped during bp2build.`, dep, ctx.Module().Name()))
+ panic(fmt.Errorf("No module named %q found, but was a direct dep of %q", dep, ctx.Module().Name()))
}
otherLabel := bazelModuleLabel(ctx, m, tag)
label := bazelModuleLabel(ctx, ctx.Module(), "")