Check that apex#filesInfo is not nil in mixed bazel/soong mode.
filesInfo should not be used for an apex that's converted to Bazel,
since all information should come from the Bazel starlark provider.
filesInfo is populated when there's a full Android.bp module graph of
the apex deps.
Test: presubmits
Change-Id: I4b9c596ca7841f4ea76e21f929039282113b6752
diff --git a/apex/apex.go b/apex/apex.go
index bc2a136..ff38773 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1994,21 +1994,17 @@
a.installedFile = ctx.InstallFile(a.installDir, a.Name()+installSuffix, a.outputFile,
a.compatSymlinks.Paths()...)
default:
- panic(fmt.Errorf("unexpected apex_type for the ProcessBazelQuery: %v", a.properties.ApexType))
+ panic(fmt.Errorf("internal error: unexpected apex_type for the ProcessBazelQueryResponse: %v", a.properties.ApexType))
}
- /*
- TODO(asmundak): compared to building an APEX with Soong, building it with Bazel does not
- return filesInfo and requiredDeps fields (in the Soong build the latter is updated).
- Fix this, as these fields are subsequently used in apex/androidmk.go and in apex/builder/go
- To find out what Soong build puts there, run:
- vctx := visitorContext{handleSpecialLibs: !android.Bool(a.properties.Ignore_system_library_special_case)}
- ctx.WalkDepsBlueprint(func(child, parent blueprint.Module) bool {
- return a.depVisitor(&vctx, ctx, child, parent)
- })
- vctx.normalizeFileInfo()
- */
-
+ // filesInfo is not set in mixed mode, because all information about the
+ // apex's contents should completely come from the Starlark providers.
+ //
+ // Prevent accidental writes to filesInfo in the earlier parts Soong by
+ // asserting it to be nil.
+ if a.filesInfo != nil {
+ panic(fmt.Errorf("internal error: filesInfo must be nil for an apex handled by Bazel."))
+ }
}
func (a *apexBundle) setCompression(ctx android.ModuleContext) {