Merge "Speed up vendor snapshot header globs"
This commit is contained in:
commit
ab15f9644b
1 changed files with 27 additions and 13 deletions
|
@ -449,23 +449,37 @@ func (l *libraryDecorator) collectHeadersForSnapshot(ctx android.ModuleContext)
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
exts := headerExts
|
glob, err := ctx.GlobWithDeps(dir+"/**/*", nil)
|
||||||
// Glob all files under this special directory, because of C++ headers.
|
if err != nil {
|
||||||
if strings.HasPrefix(dir, "external/libcxx/include") {
|
ctx.ModuleErrorf("glob failed: %#v", err)
|
||||||
exts = []string{""}
|
return
|
||||||
}
|
}
|
||||||
for _, ext := range exts {
|
isLibcxx := strings.HasPrefix(dir, "external/libcxx/include")
|
||||||
glob, err := ctx.GlobWithDeps(dir+"/**/*"+ext, nil)
|
j := 0
|
||||||
if err != nil {
|
for i, header := range glob {
|
||||||
ctx.ModuleErrorf("glob failed: %#v", err)
|
if isLibcxx {
|
||||||
return
|
// Glob all files under this special directory, because of C++ headers with no
|
||||||
}
|
// extension.
|
||||||
for _, header := range glob {
|
if !strings.HasSuffix(header, "/") {
|
||||||
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 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ret = append(ret, android.PathForSource(ctx, header))
|
|
||||||
}
|
}
|
||||||
|
if i != j {
|
||||||
|
glob[j] = glob[i]
|
||||||
|
}
|
||||||
|
j++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue