Merge changes from topic "revert_vendor" am: c21e30bb56 am: 0ba23c1903

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I388ee43c37f35de0447c7566821e183d8f5371cd
This commit is contained in:
Colin Cross
2021-01-25 16:33:57 +00:00
committed by Automerger Merge Worker

View File

@@ -449,24 +449,39 @@ func (l *libraryDecorator) collectHeadersForSnapshot(ctx android.ModuleContext)
}
continue
}
exts := headerExts
// Glob all files under this special directory, because of C++ headers.
if strings.HasPrefix(dir, "external/libcxx/include") {
exts = []string{""}
}
for _, ext := range exts {
glob, err := ctx.GlobWithDeps(dir+"/**/*"+ext, nil)
glob, err := ctx.GlobWithDeps(dir+"/**/*", nil)
if err != nil {
ctx.ModuleErrorf("glob failed: %#v", err)
return
}
for _, header := range glob {
if strings.HasSuffix(header, "/") {
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
}
ret = append(ret, android.PathForSource(ctx, header))
} 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 {
continue
}
}
if i != j {
glob[j] = glob[i]
}
j++
}
glob = glob[:j]
}
// Collect generated headers