add tidy files to mixed builds

Bug: 195029134
Test: m --bazel-mode-dev
Change-Id: I6fa370334c6ff2b6ae4313a7fcbaa34b16b0fa92
This commit is contained in:
Sam Delmerico
2022-11-07 16:41:43 -05:00
parent 658a4da53b
commit 9a9f652bdd
2 changed files with 13 additions and 0 deletions

View File

@@ -30,6 +30,7 @@ type CcInfo struct {
// be a subset of OutputFiles. (or shared libraries, this will be equal to OutputFiles,
// but general cc_library will also have dynamic libraries in output files).
RootDynamicLibraries []string
TidyFiles []string
TocFile string
UnstrippedOutput string
}
@@ -165,6 +166,12 @@ else:
# NOTE: It's OK if there's no ToC, as Soong just uses it for optimization
pass
tidy_files = []
p = providers(target)
clang_tidy_info = p.get("//build/bazel/rules/cc:clang_tidy.bzl%ClangTidyInfo")
if clang_tidy_info:
tidy_files = [v.path for v in clang_tidy_info.tidy_files.to_list()]
return json_encode({
"OutputFiles": outputFiles,
"CcObjectFiles": ccObjectFiles,
@@ -175,6 +182,7 @@ return json_encode({
"Headers": headers,
"RootStaticArchives": rootStaticArchives,
"RootDynamicLibraries": rootSharedLibraries,
"TidyFiles": tidy_files,
"TocFile": toc_file,
"UnstrippedOutput": unstripped,
})`

View File

@@ -1853,6 +1853,11 @@ func (c *Module) IsMixedBuildSupported(ctx android.BaseModuleContext) bool {
func (c *Module) ProcessBazelQueryResponse(ctx android.ModuleContext) {
bazelModuleLabel := c.getBazelModuleLabel(ctx)
bazelCtx := ctx.Config().BazelContext
if ccInfo, err := bazelCtx.GetCcInfo(bazelModuleLabel, android.GetConfigKey(ctx)); err == nil {
c.tidyFiles = android.PathsForBazelOut(ctx, ccInfo.TidyFiles)
}
c.bazelHandler.ProcessBazelQueryResponse(ctx, bazelModuleLabel)
c.Properties.SubName = GetSubnameProperty(ctx, c)