Add bazel-built modules as deps on the system image
These bazel-built modules will be installed into the system image
as part of the bazel rule, rather than going through the make staging
directory.
Bug: 297269187
Test: m bazel_sandwich
Change-Id: I96c6e58f8e0898b2ad92cb7069745ca2059a39f8
diff --git a/android/bazel.go b/android/bazel.go
index 202fc48..1602b9b 100644
--- a/android/bazel.go
+++ b/android/bazel.go
@@ -81,6 +81,11 @@
// If non-nil, indicates that the module could not be converted successfully
// with bp2build. This will describe the reason the module could not be converted.
UnconvertedReason *UnconvertedReason
+
+ // The Partition this module will be installed on.
+ // TODO(b/306200980) Investigate how to handle modules that are installed in multiple
+ // partitions.
+ Partition string `blueprint:"mutated"`
}
// The reason a module could not be converted to a BUILD target via bp2build.
@@ -674,6 +679,9 @@
bModule.ConvertWithBp2build(ctx)
+ installCtx := &baseModuleContextToModuleInstallPathContext{ctx}
+ ctx.Module().base().setPartitionForBp2build(modulePartition(installCtx, true))
+
if len(ctx.Module().base().Bp2buildTargets()) == 0 && ctx.Module().base().GetUnconvertedReason() == nil {
panic(fmt.Errorf("illegal bp2build invariant: module '%s' was neither converted nor marked unconvertible", ctx.ModuleName()))
}