bp2build: remove header globs in generated srcs.

Not needed anymore for bp2build-incremental since https://android-review.googlesource.com/q/topic:no-include-check.

Not needed for mixed builds either, since cc compile actions aren't sandboxed.

Fixes: 186488830
Test: treehugger and go tests

Change-Id: Ib5d4908dcce6bf910a653c457bb251d726e717d4
This commit is contained in:
Jingwen Chen
2021-04-27 05:54:20 +00:00
parent c30d7beb8f
commit 882bcc1c1c
8 changed files with 14 additions and 262 deletions

View File

@@ -64,43 +64,6 @@ type LabelList struct {
Excludes []Label
}
// GlobsInDir returns a list of glob expressions for a list of extensions
// (optionally recursive) within a directory.
func GlobsInDir(dir string, recursive bool, extensions []string) []string {
globs := []string{}
globInfix := ""
if dir == "." {
if recursive {
// e.g "**/*.h"
globInfix = "**/"
} // else e.g. "*.h"
for _, ext := range extensions {
globs = append(globs, globInfix+"*"+ext)
}
} else {
if recursive {
// e.g. "foo/bar/**/*.h"
dir += "/**"
} // else e.g. "foo/bar/*.h"
for _, ext := range extensions {
globs = append(globs, dir+"/*"+ext)
}
}
return globs
}
// LooseHdrsGlobs returns the list of non-recursive header globs for each parent directory of
// each source file in this LabelList's Includes.
func (ll *LabelList) LooseHdrsGlobs(exts []string) []string {
var globs []string
for _, parentDir := range ll.uniqueParentDirectories() {
globs = append(globs,
GlobsInDir(parentDir, false, exts)...)
}
return globs
}
// uniqueParentDirectories returns a list of the unique parent directories for
// all files in ll.Includes.
func (ll *LabelList) uniqueParentDirectories() []string {