From e59af4e1c03ad13785409d160e7aa3b7ef0b06ed Mon Sep 17 00:00:00 2001 From: Chris Parsons Date: Wed, 31 Mar 2021 13:32:41 -0400 Subject: [PATCH] Use correct includes for mixed build gen headers Previously, genrules which were used as generated_headers only propagated the old Soong gen directory as an include path, even if the genrule was managed by Bazel. With this chance, the gen directory of the Baze output files are used in mixed-build mode. Test: USE_BAZEL_ANALYSIS=1 m libc Test: m libc Change-Id: I3913c4e5b0354421ba1fe43d1f6ef4d1e729a058 --- android/bazel.go | 1 - genrule/genrule.go | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/android/bazel.go b/android/bazel.go index 51ff3cb27..3fb34c79d 100644 --- a/android/bazel.go +++ b/android/bazel.go @@ -169,7 +169,6 @@ var ( "liblinker_debuggerd_stub", // ruperts@, cc_library_static, depends on //system/libbase "libbionic_tests_headers_posix", // ruperts@, cc_library_static "libc_dns", // ruperts@, cc_library_static - "generated_android_ids", // cparsons@, genrule "note_memtag_heap_async", // cparsons@, cc_library_static "note_memtag_heap_sync", // cparsons@, cc_library_static } diff --git a/genrule/genrule.go b/genrule/genrule.go index 5d438eac2..d07b00253 100644 --- a/genrule/genrule.go +++ b/genrule/genrule.go @@ -229,11 +229,16 @@ func (c *Module) generateBazelBuildActions(ctx android.ModuleContext, label stri filePaths, ok := bazelCtx.GetOutputFiles(label, ctx.Arch().ArchType) if ok { var bazelOutputFiles android.Paths + exportIncludeDirs := map[string]bool{} for _, bazelOutputFile := range filePaths { bazelOutputFiles = append(bazelOutputFiles, android.PathForBazelOut(ctx, bazelOutputFile)) + exportIncludeDirs[filepath.Dir(bazelOutputFile)] = true } c.outputFiles = bazelOutputFiles c.outputDeps = bazelOutputFiles + for includePath, _ := range exportIncludeDirs { + c.exportedIncludeDirs = append(c.exportedIncludeDirs, android.PathForBazelOut(ctx, includePath)) + } } return ok }