From 303978dcd27eec120c5c54180b1d400b00a88ee7 Mon Sep 17 00:00:00 2001 From: Liz Kammer Date: Fri, 4 Nov 2022 16:12:43 -0400 Subject: [PATCH] Connect base.zip to mixed builds Test: go test soong tests Test: mixed_droid Change-Id: Iaf1fbd1e7cde63892b01a9c9f4cd29ae69e2d6e3 --- apex/apex.go | 4 ++-- apex/apex_test.go | 10 ++++++++++ bazel/cquery/request_type.go | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/apex/apex.go b/apex/apex.go index 98722c40e..72403f9ba 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -1903,10 +1903,10 @@ func (a *apexBundle) ProcessBazelQueryResponse(ctx android.ModuleContext) { apexType := a.properties.ApexType switch apexType { case imageApex: + // TODO(b/190817312): Generate the notice file from the apex rule. a.htmlGzNotice = android.PathForBazelOut(ctx, "NOTICE.html.gz") - // TODO(b/239081457): Generate the bazel bundle module file from the apex rule. - a.bundleModuleFile = android.PathForBazelOut(ctx, a.Name()+apexType.suffix()+"-base.zip") + a.bundleModuleFile = android.PathForBazelOut(ctx, outputs.BundleFile) a.nativeApisUsedByModuleFile = android.ModuleOutPath(android.PathForBazelOut(ctx, outputs.SymbolsUsedByApex)) a.nativeApisBackedByModuleFile = android.ModuleOutPath(android.PathForBazelOut(ctx, outputs.BackingLibs)) // TODO(b/239084755): Generate the java api using.xml file from Bazel. diff --git a/apex/apex_test.go b/apex/apex_test.go index 9964ae458..7b4371f23 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -9760,6 +9760,7 @@ apex { ContainerKeyInfo: []string{"container_cert", "container_private"}, SymbolsUsedByApex: "foo_using.txt", JavaSymbolsUsedByApex: "foo_using.xml", + BundleFile: "apex_bundle.zip", // unused PackageName: "pkg_name", @@ -9804,4 +9805,13 @@ apex { if w, g := "out/bazel/execroot/__main__/foo_using.xml", ab.javaApisUsedByModuleFile.String(); w != g { t.Errorf("Expected output file %q, got %q", w, g) } + + mkData := android.AndroidMkDataForTest(t, result.TestContext, m) + var builder strings.Builder + mkData.Custom(&builder, "foo", "BAZEL_TARGET_", "", mkData) + + data := builder.String() + if w := "ALL_MODULES.$(my_register_name).BUNDLE := out/bazel/execroot/__main__/apex_bundle.zip"; !strings.Contains(data, w) { + t.Errorf("Expected %q in androidmk data, but did not find %q", w, data) + } } diff --git a/bazel/cquery/request_type.go b/bazel/cquery/request_type.go index b1b9089a6..b99780a87 100644 --- a/bazel/cquery/request_type.go +++ b/bazel/cquery/request_type.go @@ -221,6 +221,7 @@ return json_encode({ "symbols_used_by_apex": info.symbols_used_by_apex.path, "java_symbols_used_by_apex": info.java_symbols_used_by_apex.path, "backing_libs": info.backing_libs.path, + "bundle_file": info.base_with_config_zip.path, })` } @@ -235,6 +236,7 @@ type ApexInfo struct { SymbolsUsedByApex string `json:"symbols_used_by_apex"` JavaSymbolsUsedByApex string `json:"java_symbols_used_by_apex"` BackingLibs string `json:"backing_libs"` + BundleFile string `json:"bundle_file"` } // ParseResult returns a value obtained by parsing the result of the request's Starlark function.