Merge "Capture libeigen's header correctly" am: 16fdea928b

Change-Id: Ifbca5ad323c5f3cfe2a605e2379bec45ffc15c7c
This commit is contained in:
Inseob Kim 2020-06-01 01:29:12 +00:00 committed by Automerger Merge Worker
commit fadd0b7db4
1 changed files with 25 additions and 0 deletions

View File

@ -407,6 +407,31 @@ func (l *libraryDecorator) collectHeadersForSnapshot(ctx android.ModuleContext)
if strings.HasPrefix(dir, android.PathForOutput(ctx).String()) {
continue
}
// libeigen wrongly exports the root directory "external/eigen". But only two
// subdirectories "Eigen" and "unsupported" contain exported header files. Even worse
// some of them have no extension. So we need special treatment for libeigen in order
// to glob correctly.
if dir == "external/eigen" {
// Only these two directories contains exported headers.
for _, subdir := range []string{"Eigen", "unsupported/Eigen"} {
glob, err := ctx.GlobWithDeps("external/eigen/"+subdir+"/**/*", nil)
if err != nil {
ctx.ModuleErrorf("glob failed: %#v", err)
return
}
for _, header := range glob {
if strings.HasSuffix(header, "/") {
continue
}
ext := filepath.Ext(header)
if ext != "" && ext != ".h" {
continue
}
ret = append(ret, android.PathForSource(ctx, header))
}
}
continue
}
exts := headerExts
// Glob all files under this special directory, because of C++ headers.
if strings.HasPrefix(dir, "external/libcxx/include") {