Merge changes from topic "revert_vendor" am: 3e2760a539 am: 7868fe0c6f

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I03f6ff19255abd004bf1b854e65f79f5e128fa70
This commit is contained in:
Daniel Cardenas
2021-01-22 05:39:13 +00:00
committed by Automerger Merge Worker

View File

@@ -449,39 +449,24 @@ func (l *libraryDecorator) collectHeadersForSnapshot(ctx android.ModuleContext)
}
continue
}
glob, err := ctx.GlobWithDeps(dir+"/**/*", nil)
if err != nil {
ctx.ModuleErrorf("glob failed: %#v", err)
return
exts := headerExts
// Glob all files under this special directory, because of C++ headers.
if strings.HasPrefix(dir, "external/libcxx/include") {
exts = []string{""}
}
isLibcxx := strings.HasPrefix(dir, "external/libcxx/include")
j := 0
for i, header := range glob {
if isLibcxx {
// Glob all files under this special directory, because of C++ headers with no
// extension.
if !strings.HasSuffix(header, "/") {
continue
}
} else {
// Filter out only the files with extensions that are headers.
found := false
for _, ext := range headerExts {
if strings.HasSuffix(header, ext) {
found = true
break
}
}
if !found {
for _, ext := range exts {
glob, err := ctx.GlobWithDeps(dir+"/**/*"+ext, nil)
if err != nil {
ctx.ModuleErrorf("glob failed: %#v", err)
return
}
for _, header := range glob {
if strings.HasSuffix(header, "/") {
continue
}
ret = append(ret, android.PathForSource(ctx, header))
}
if i != j {
glob[j] = glob[i]
}
j++
}
glob = glob[:j]
}
// Collect generated headers