Merge "Add ApexInfo.RequiresLibs to mixed build handler for apex" am: c935d777b7 am: f9a6519191

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2355806

Change-Id: I18110f10042cad06d41eb191d98343597bfe65ca
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Vinh Tran 2022-12-15 14:54:42 +00:00 committed by Automerger Merge Worker
commit 09c9861dc0
3 changed files with 15 additions and 1 deletions

View file

@ -458,6 +458,11 @@ func bp2buildModuleLabel(ctx BazelConversionContext, module blueprint.Module) st
return fmt.Sprintf("//%s:%s", moduleDir, moduleName)
}
// ModuleFromBazelLabel reverses the logic in bp2buildModuleLabel
func ModuleFromBazelLabel(label string) string {
return strings.Split(label, ":")[1]
}
// BazelOutPath is a Bazel output path compatible to be used for mixed builds within Soong/Ninja.
type BazelOutPath struct {
OutputPath

View file

@ -1906,6 +1906,12 @@ func (a *apexBundle) ProcessBazelQueryResponse(ctx android.ModuleContext) {
a.containerCertificateFile = android.PathForBazelOut(ctx, outputs.ContainerKeyInfo[0])
a.containerPrivateKeyFile = android.PathForBazelOut(ctx, outputs.ContainerKeyInfo[1])
// Ensure ApexInfo.RequiresLibs are installed as part of a bundle build
for _, bazelLabel := range outputs.RequiresLibs {
// convert Bazel label back to Soong module name
a.requiredDeps = append(a.requiredDeps, android.ModuleFromBazelLabel(bazelLabel))
}
apexType := a.properties.ApexType
switch apexType {
case imageApex:

View file

@ -9835,11 +9835,11 @@ apex {
JavaSymbolsUsedByApex: "foo_using.xml",
BundleFile: "apex_bundle.zip",
InstalledFiles: "installed-files.txt",
RequiresLibs: []string{"//path/c:c", "//path/d:d"},
// unused
PackageName: "pkg_name",
ProvidesLibs: []string{"a", "b"},
RequiresLibs: []string{"c", "d"},
},
},
}
@ -9895,4 +9895,7 @@ apex {
if w := "$(call dist-for-goals,checkbuild,out/bazel/execroot/__main__/installed-files.txt:foo-installed-files.txt)"; !strings.Contains(data, w) {
t.Errorf("Expected %q in androidmk data, but did not find %q", w, data)
}
if w := "LOCAL_REQUIRED_MODULES := c d"; !strings.Contains(data, w) {
t.Errorf("Expected %q in androidmk data, but did not find it in %q", w, data)
}
}