bazel apex: Add mixed builds support for <module>_using.xml file.

This file contains the java APIs parsed by the 'dexdeps' tool within the gen_java_usedby_apex.sh.

Bug: 239084755
Fixes: 239084755
Test: presubmits
Change-Id: Ia271783a6be3ea3a343481306cde1aaba2166e88
This commit is contained in:
Jingwen Chen
2022-11-07 14:36:12 +00:00
parent 926d00c2ad
commit 1ec7785ec5
4 changed files with 26 additions and 16 deletions

View File

@@ -69,6 +69,9 @@ var (
"build/soong/scripts": Bp2BuildDefaultTrueRecursively, "build/soong/scripts": Bp2BuildDefaultTrueRecursively,
"cts/common/device-side/nativetesthelper/jni": Bp2BuildDefaultTrueRecursively, "cts/common/device-side/nativetesthelper/jni": Bp2BuildDefaultTrueRecursively,
"dalvik/tools/dexdeps": Bp2BuildDefaultTrueRecursively,
"development/apps/DevelopmentSettings": Bp2BuildDefaultTrue, "development/apps/DevelopmentSettings": Bp2BuildDefaultTrue,
"development/apps/Fallback": Bp2BuildDefaultTrue, "development/apps/Fallback": Bp2BuildDefaultTrue,
"development/apps/WidgetPreview": Bp2BuildDefaultTrue, "development/apps/WidgetPreview": Bp2BuildDefaultTrue,
@@ -176,7 +179,7 @@ var (
"external/zopfli": Bp2BuildDefaultTrueRecursively, "external/zopfli": Bp2BuildDefaultTrueRecursively,
"external/zstd": Bp2BuildDefaultTrueRecursively, "external/zstd": Bp2BuildDefaultTrueRecursively,
"frameworks/av": Bp2BuildDefaultTrue, "frameworks/av": Bp2BuildDefaultTrue,
"frameworks/av/media/codec2/components/aom": Bp2BuildDefaultTrueRecursively, "frameworks/av/media/codec2/components/aom": Bp2BuildDefaultTrueRecursively,
"frameworks/av/media/codecs": Bp2BuildDefaultTrueRecursively, "frameworks/av/media/codecs": Bp2BuildDefaultTrueRecursively,
"frameworks/av/media/liberror": Bp2BuildDefaultTrueRecursively, "frameworks/av/media/liberror": Bp2BuildDefaultTrueRecursively,

View File

@@ -1910,7 +1910,7 @@ func (a *apexBundle) ProcessBazelQueryResponse(ctx android.ModuleContext) {
a.nativeApisUsedByModuleFile = android.ModuleOutPath(android.PathForBazelOut(ctx, outputs.SymbolsUsedByApex)) a.nativeApisUsedByModuleFile = android.ModuleOutPath(android.PathForBazelOut(ctx, outputs.SymbolsUsedByApex))
a.nativeApisBackedByModuleFile = android.ModuleOutPath(android.PathForBazelOut(ctx, outputs.BackingLibs)) a.nativeApisBackedByModuleFile = android.ModuleOutPath(android.PathForBazelOut(ctx, outputs.BackingLibs))
// TODO(b/239084755): Generate the java api using.xml file from Bazel. // TODO(b/239084755): Generate the java api using.xml file from Bazel.
a.javaApisUsedByModuleFile = android.ModuleOutPath(android.PathForBazelOut(ctx, a.Name()+"_using.xml")) a.javaApisUsedByModuleFile = android.ModuleOutPath(android.PathForBazelOut(ctx, outputs.JavaSymbolsUsedByApex))
installSuffix := imageApexSuffix installSuffix := imageApexSuffix
if a.isCompressed { if a.isCompressed {
installSuffix = imageCapexSuffix installSuffix = imageCapexSuffix

View File

@@ -9754,11 +9754,12 @@ apex {
OutputBaseDir: outputBaseDir, OutputBaseDir: outputBaseDir,
LabelToApexInfo: map[string]cquery.ApexInfo{ LabelToApexInfo: map[string]cquery.ApexInfo{
"//:foo": cquery.ApexInfo{ "//:foo": cquery.ApexInfo{
SignedOutput: "signed_out.apex", SignedOutput: "signed_out.apex",
UnsignedOutput: "unsigned_out.apex", UnsignedOutput: "unsigned_out.apex",
BundleKeyInfo: []string{"public_key", "private_key"}, BundleKeyInfo: []string{"public_key", "private_key"},
ContainerKeyInfo: []string{"container_cert", "container_private"}, ContainerKeyInfo: []string{"container_cert", "container_private"},
SymbolsUsedByApex: "foo_using.txt", SymbolsUsedByApex: "foo_using.txt",
JavaSymbolsUsedByApex: "foo_using.xml",
// unused // unused
PackageName: "pkg_name", PackageName: "pkg_name",
@@ -9799,4 +9800,8 @@ apex {
if w, g := "out/bazel/execroot/__main__/foo_using.txt", ab.nativeApisUsedByModuleFile.String(); w != g { if w, g := "out/bazel/execroot/__main__/foo_using.txt", ab.nativeApisUsedByModuleFile.String(); w != g {
t.Errorf("Expected output file %q, got %q", w, g) t.Errorf("Expected output file %q, got %q", w, g)
} }
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)
}
} }

View File

@@ -219,20 +219,22 @@ return json_encode({
"container_key_info": [container_key_info.pem.path, container_key_info.pk8.path, container_key_info.key_name], "container_key_info": [container_key_info.pem.path, container_key_info.pk8.path, container_key_info.key_name],
"package_name": info.package_name, "package_name": info.package_name,
"symbols_used_by_apex": info.symbols_used_by_apex.path, "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, "backing_libs": info.backing_libs.path,
})` })`
} }
type ApexInfo struct { type ApexInfo struct {
SignedOutput string `json:"signed_output"` SignedOutput string `json:"signed_output"`
UnsignedOutput string `json:"unsigned_output"` UnsignedOutput string `json:"unsigned_output"`
ProvidesLibs []string `json:"provides_native_libs"` ProvidesLibs []string `json:"provides_native_libs"`
RequiresLibs []string `json:"requires_native_libs"` RequiresLibs []string `json:"requires_native_libs"`
BundleKeyInfo []string `json:"bundle_key_info"` BundleKeyInfo []string `json:"bundle_key_info"`
ContainerKeyInfo []string `json:"container_key_info"` ContainerKeyInfo []string `json:"container_key_info"`
PackageName string `json:"package_name"` PackageName string `json:"package_name"`
SymbolsUsedByApex string `json:"symbols_used_by_apex"` SymbolsUsedByApex string `json:"symbols_used_by_apex"`
BackingLibs string `json:"backing_libs"` JavaSymbolsUsedByApex string `json:"java_symbols_used_by_apex"`
BackingLibs string `json:"backing_libs"`
} }
// ParseResult returns a value obtained by parsing the result of the request's Starlark function. // ParseResult returns a value obtained by parsing the result of the request's Starlark function.