Remove ModuleSrcPath

ModuleSrcPath was designed as a type that ensured that modules only
referenced sources inside the directory that contained the Android.bp
file.  In practice they don't work very well, because allowing
filegroups and genrules as inputs to any module that takes a source
path means that the path might end up being to a file in another
source directory or to a generated file in the output directory.

Remove ModuleSrcPath, replacing it with SourcePath in the places
that need to explicitly refer to a path in the source tree, or
Path where it may be a source path or a generated path.

Make PathForModuleSrc return a Path instead of a SourcePath in
preparation for consolidation with ctx.ExpandSources, which will
make it possibly return paths to generated files.

Test: All soong tests
Change-Id: I973a78470ed14307eea5f6d0cc93942775a65715
This commit is contained in:
Colin Cross
2019-03-05 12:46:40 -08:00
parent 2fafa3ec49
commit 07e51619a2
6 changed files with 67 additions and 62 deletions

View File

@@ -39,10 +39,10 @@ func ResourceDirsToJarArgs(ctx android.ModuleContext,
var excludeFiles []string
for _, exclude := range excludeResourceDirs {
dirs := ctx.Glob(android.PathForModuleSrc(ctx).Join(ctx, exclude).String(), nil)
dirs := ctx.Glob(android.PathForSource(ctx, ctx.ModuleDir()).Join(ctx, exclude).String(), nil)
for _, dir := range dirs {
excludeDirs = append(excludeDirs, dir.String())
excludeFiles = append(excludeFiles, dir.(android.ModuleSrcPath).Join(ctx, "**/*").String())
excludeFiles = append(excludeFiles, dir.(android.SourcePath).Join(ctx, "**/*").String())
}
}
@@ -52,7 +52,7 @@ func ResourceDirsToJarArgs(ctx android.ModuleContext,
for _, resourceDir := range resourceDirs {
// resourceDir may be a glob, resolve it first
dirs := ctx.Glob(android.PathForModuleSrc(ctx).Join(ctx, resourceDir).String(), excludeDirs)
dirs := ctx.Glob(android.PathForSource(ctx, ctx.ModuleDir()).Join(ctx, resourceDir).String(), excludeDirs)
for _, dir := range dirs {
files := ctx.GlobFiles(filepath.Join(dir.String(), "**/*"), excludeFiles)