Check that local, top level, and exported include paths exist
Require directories listed in the include_dirs, local_include_dirs, and exported_include_dirs properties to exist. Change-Id: I5b079bd2c607839bb28dae43801cd7345bde2299
This commit is contained in:
parent
4e13f6d573
commit
f22982707d
5
cc/cc.go
5
cc/cc.go
|
@ -404,6 +404,9 @@ func (c *CCBase) collectFlags(ctx common.AndroidModuleContext, toolchain Toolcha
|
|||
}
|
||||
|
||||
// Include dir cflags
|
||||
common.CheckSrcDirsExist(ctx, c.Properties.Include_dirs, "include_dirs")
|
||||
common.CheckModuleSrcDirsExist(ctx, c.Properties.Local_include_dirs, "local_include_dirs")
|
||||
|
||||
rootIncludeDirs := pathtools.PrefixPaths(c.Properties.Include_dirs, ctx.AConfig().SrcDir())
|
||||
localIncludeDirs := pathtools.PrefixPaths(c.Properties.Local_include_dirs, common.ModuleSrcDir(ctx))
|
||||
flags.GlobalFlags = append(flags.GlobalFlags,
|
||||
|
@ -1096,6 +1099,8 @@ func (c *CCLibrary) compileStaticLibrary(ctx common.AndroidModuleContext,
|
|||
|
||||
c.objFiles = objFiles
|
||||
c.out = outputFile
|
||||
|
||||
common.CheckModuleSrcDirsExist(ctx, c.Properties.Export_include_dirs, "export_include_dirs")
|
||||
includeDirs := pathtools.PrefixPaths(c.Properties.Export_include_dirs, common.ModuleSrcDir(ctx))
|
||||
c.exportFlags = []string{includeDirsToFlags(includeDirs)}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ package common
|
|||
|
||||
import (
|
||||
"path/filepath"
|
||||
"os"
|
||||
)
|
||||
|
||||
// ModuleOutDir returns the path to the module-specific output directory.
|
||||
|
@ -74,3 +75,33 @@ func ModuleProtoDir(ctx AndroidModuleContext) string {
|
|||
func ModuleJSCompiledDir(ctx AndroidModuleContext) string {
|
||||
return filepath.Join(ModuleOutDir(ctx), "js")
|
||||
}
|
||||
|
||||
// CheckModuleSrcDirsExist logs an error on a property if any of the directories relative to the
|
||||
// Blueprints file don't exist.
|
||||
func CheckModuleSrcDirsExist(ctx AndroidModuleContext, dirs []string, prop string) {
|
||||
for _, dir := range dirs {
|
||||
fullDir := filepath.Join(ModuleSrcDir(ctx), dir)
|
||||
if _, err := os.Stat(fullDir); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
ctx.PropertyErrorf(prop, "module source directory %q does not exist", dir)
|
||||
} else {
|
||||
ctx.PropertyErrorf(prop, "%s", err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CheckModuleSrcDirsExist logs an error on a property if any of the directories relative to the
|
||||
// top of the source tree don't exist.
|
||||
func CheckSrcDirsExist(ctx AndroidModuleContext, dirs []string, prop string) {
|
||||
for _, dir := range dirs {
|
||||
fullDir := filepath.Join(ctx.AConfig().SrcDir(), dir)
|
||||
if _, err := os.Stat(fullDir); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
ctx.PropertyErrorf(prop, "top-level source directory %q does not exist", dir)
|
||||
} else {
|
||||
ctx.PropertyErrorf(prop, "%s", err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue