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
This commit is contained in:
Colin Cross
2015-07-14 18:26:10 -07:00
parent f5a959c99f
commit a819f08275
3 changed files with 7 additions and 7 deletions

View File

@@ -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())
}