diff --git a/android/paths.go b/android/paths.go index e69fbe728..57ebae2a3 100644 --- a/android/paths.go +++ b/android/paths.go @@ -245,7 +245,17 @@ func pathsForModuleSrcFromFullPath(ctx ModuleContext, paths []string, incDirs bo 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 @@ func pathForSource(ctx PathContext, pathComponents ...string) (SourcePath, error 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 @@ func PathForSource(ctx PathContext, pathComponents ...string) SourcePath { 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 @@ func ExistentPathForSource(ctx PathContext, pathComponents ...string) OptionalPa 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 @@ func PathForModuleSrc(ctx ModuleContext, paths ...string) ModuleSrcPath { 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