aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2015-07-14 18:26:10 -0700
committerColin Cross <ccross@android.com>2015-07-23 17:52:17 -0700
commita819f08275a1916c792b8f4b7c2116012cd1ce2e (patch)
treeec58b6800e22ceab2f3d3c85f83e0c73aa247e0a
parentf5a959c99fcd1614e06037de48dc5e73a65f6990 (diff)
downloadbuild_soong-a819f08275a1916c792b8f4b7c2116012cd1ce2e.tar.gz
build_soong-a819f08275a1916c792b8f4b7c2116012cd1ce2e.tar.bz2
build_soong-a819f08275a1916c792b8f4b7c2116012cd1ce2e.zip
Fix glob filename overlap
If resources and java files were compiled from the same directory, ctx.Glob could try to create a glob file that had the same name as the directory containing another glob file. Namespace each call to ctx.Glob so they never conflict. Change-Id: I4db73af568a2ff2e708e9db64798073b1ed2ff61
-rw-r--r--common/module.go8
-rw-r--r--java/app.go4
-rw-r--r--java/resources.go2
3 files changed, 7 insertions, 7 deletions
diff --git a/common/module.go b/common/module.go
index b19b6d1c..e8c4a87e 100644
--- a/common/module.go
+++ b/common/module.go
@@ -55,7 +55,7 @@ type AndroidModuleContext interface {
androidBaseContext
ExpandSources(srcFiles, excludes []string) []string
- Glob(globPattern string, excludes []string) []string
+ Glob(outDir, globPattern string, excludes []string) []string
InstallFile(installPath, srcPath string, deps ...string) string
InstallFileName(installPath, name, srcPath string, deps ...string) string
@@ -504,7 +504,7 @@ func (ctx *androidModuleContext) ExpandSources(srcFiles, excludes []string) []st
globbedSrcFiles := make([]string, 0, len(srcFiles))
for _, s := range srcFiles {
if glob.IsGlob(s) {
- globbedSrcFiles = append(globbedSrcFiles, ctx.Glob(s, excludes)...)
+ globbedSrcFiles = append(globbedSrcFiles, ctx.Glob("src_glob", s, excludes)...)
} else {
globbedSrcFiles = append(globbedSrcFiles, s)
}
@@ -513,8 +513,8 @@ func (ctx *androidModuleContext) ExpandSources(srcFiles, excludes []string) []st
return globbedSrcFiles
}
-func (ctx *androidModuleContext) Glob(globPattern string, excludes []string) []string {
- ret, err := Glob(ctx, ModuleOutDir(ctx), globPattern, excludes)
+func (ctx *androidModuleContext) Glob(outDir, globPattern string, excludes []string) []string {
+ ret, err := Glob(ctx, filepath.Join(ModuleOutDir(ctx), outDir), globPattern, excludes)
if err != nil {
ctx.ModuleErrorf("glob: %s", err.Error())
}
diff --git a/java/app.go b/java/app.go
index e6851b5c..a6e651d8 100644
--- a/java/app.go
+++ b/java/app.go
@@ -246,14 +246,14 @@ func (a *AndroidApp) aaptFlags(ctx common.AndroidModuleContext) ([]string, []str
var aaptDeps []string
var hasResources bool
for _, d := range resourceDirs {
- newDeps := ctx.Glob(filepath.Join(d, "**/*"), aaptIgnoreFilenames)
+ newDeps := ctx.Glob("app_resources", filepath.Join(d, "**/*"), aaptIgnoreFilenames)
aaptDeps = append(aaptDeps, newDeps...)
if len(newDeps) > 0 {
hasResources = true
}
}
for _, d := range assetDirs {
- newDeps := ctx.Glob(filepath.Join(d, "**/*"), aaptIgnoreFilenames)
+ newDeps := ctx.Glob("app_assets", filepath.Join(d, "**/*"), aaptIgnoreFilenames)
aaptDeps = append(aaptDeps, newDeps...)
}
diff --git a/java/resources.go b/java/resources.go
index dfdbeb5d..995e60df 100644
--- a/java/resources.go
+++ b/java/resources.go
@@ -54,7 +54,7 @@ func ResourceDirsToJarSpecs(ctx common.AndroidModuleContext, resourceDirs, exclu
continue
}
resourceDir := filepath.Join(common.ModuleSrcDir(ctx), resourceDir)
- dirs := ctx.Glob(resourceDir, nil)
+ dirs := ctx.Glob("java_resources", resourceDir, nil)
for _, dir := range dirs {
fileListFile := filepath.Join(common.ModuleOutDir(ctx), "res", dir, "resources.list")
depFile := fileListFile + ".d"