Remove extra basePath from ModuleSrcPath
ModuleSrcPath contains an embedded basePath as well as a
SoucePath that contains another basePath. Remove the embedded
basePath, and make the SourcePath embedded.
Test: no change to build.ninja
Change-Id: I3cdf3477eca41ed35fac08a892aab22cbcdb2224
diff --git a/android/paths.go b/android/paths.go
index e76e1fe..8eabfb8 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -437,7 +437,7 @@
func (p SourcePath) OverlayPath(ctx ModuleContext, path Path) OptionalPath {
var relDir string
if moduleSrcPath, ok := path.(ModuleSrcPath); ok {
- relDir = moduleSrcPath.sourcePath.path
+ relDir = moduleSrcPath.path
} else if srcPath, ok := path.(SourcePath); ok {
relDir = srcPath.path
} else {
@@ -507,9 +507,7 @@
// ModuleSrcPath is a Path representing a file rooted from a module's local source dir
type ModuleSrcPath struct {
- basePath
- sourcePath SourcePath
- moduleDir string
+ SourcePath
}
var _ Path = ModuleSrcPath{}
@@ -521,7 +519,7 @@
// module's local source directory.
func PathForModuleSrc(ctx ModuleContext, paths ...string) ModuleSrcPath {
path := validatePath(ctx, paths...)
- return ModuleSrcPath{basePath{path, ctx.AConfig()}, PathForSource(ctx, ctx.ModuleDir(), path), ctx.ModuleDir()}
+ return ModuleSrcPath{PathForSource(ctx, ctx.ModuleDir(), path)}
}
// OptionalPathForModuleSrc returns an OptionalPath. The OptionalPath contains a
@@ -533,16 +531,12 @@
return OptionalPathForPath(PathForModuleSrc(ctx, *p))
}
-func (p ModuleSrcPath) String() string {
- return p.sourcePath.String()
-}
-
func (p ModuleSrcPath) genPathWithExt(ctx ModuleContext, subdir, ext string) ModuleGenPath {
- return PathForModuleGen(ctx, subdir, p.moduleDir, pathtools.ReplaceExtension(p.path, ext))
+ return PathForModuleGen(ctx, subdir, pathtools.ReplaceExtension(p.path, ext))
}
func (p ModuleSrcPath) objPathWithExt(ctx ModuleContext, subdir, ext string) ModuleObjPath {
- return PathForModuleObj(ctx, subdir, p.moduleDir, pathtools.ReplaceExtension(p.path, ext))
+ return PathForModuleObj(ctx, subdir, pathtools.ReplaceExtension(p.path, ext))
}
func (p ModuleSrcPath) resPathWithName(ctx ModuleContext, name string) ModuleResPath {