Merge "Allow paths containing glob characters in glob results"
diff --git a/android/paths.go b/android/paths.go
index e69fbe7..57ebae2 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -245,7 +245,17 @@
reportPathErrorf(ctx, "Path '%s' is not in module source directory '%s'", p, prefix)
continue
}
- ret = append(ret, PathForModuleSrc(ctx, path[len(prefix):]))
+
+ srcPath, err := pathForSource(ctx, ctx.ModuleDir(), path[len(prefix):])
+ if err != nil {
+ reportPathError(ctx, err)
+ continue
+ }
+
+ moduleSrcPath := ModuleSrcPath{srcPath}
+ moduleSrcPath.basePath.rel = srcPath.path
+
+ ret = append(ret, moduleSrcPath)
}
return ret
}
@@ -529,10 +539,6 @@
return ret, fmt.Errorf("source path %s is in output", abs)
}
- if pathtools.IsGlob(ret.String()) {
- return ret, fmt.Errorf("path may not contain a glob: %s", ret.String())
- }
-
return ret, nil
}
@@ -569,6 +575,10 @@
reportPathError(ctx, err)
}
+ if pathtools.IsGlob(path.String()) {
+ reportPathErrorf(ctx, "path may not contain a glob: %s", path.String())
+ }
+
if modCtx, ok := ctx.(ModuleContext); ok && ctx.Config().AllowMissingDependencies() {
exists, err := existsWithDependencies(ctx, path)
if err != nil {
@@ -595,6 +605,11 @@
return OptionalPath{}
}
+ if pathtools.IsGlob(path.String()) {
+ reportPathErrorf(ctx, "path may not contain a glob: %s", path.String())
+ return OptionalPath{}
+ }
+
exists, err := existsWithDependencies(ctx, path)
if err != nil {
reportPathError(ctx, err)
@@ -774,6 +789,10 @@
reportPathError(ctx, err)
}
+ if pathtools.IsGlob(srcPath.String()) {
+ reportPathErrorf(ctx, "path may not contain a glob: %s", srcPath.String())
+ }
+
path := ModuleSrcPath{srcPath}
path.basePath.rel = p