aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2015-05-12 11:36:53 -0700
committerColin Cross <ccross@android.com>2015-05-12 11:36:53 -0700
commitf22982707d9d94b56263b0a98ddb9efbef762364 (patch)
tree875d1a38c29eb831ece0001f1724813e5e2502cb /common
parent4e13f6d573ec5933b1149940d73d2a2152611f17 (diff)
downloadbuild_soong-f22982707d9d94b56263b0a98ddb9efbef762364.tar.gz
build_soong-f22982707d9d94b56263b0a98ddb9efbef762364.tar.bz2
build_soong-f22982707d9d94b56263b0a98ddb9efbef762364.zip
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
Diffstat (limited to 'common')
-rw-r--r--common/paths.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/common/paths.go b/common/paths.go
index bcd6d8c7..070662ad 100644
--- a/common/paths.go
+++ b/common/paths.go
@@ -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())
+ }
+ }
+ }
+}