From 7fc17dbfcec0f21f11ee04503ed72bcd1c181866 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 1 Feb 2017 14:07:55 -0800 Subject: [PATCH] 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 --- android/paths.go | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/android/paths.go b/android/paths.go index e76e1fe61..8eabfb84f 100644 --- a/android/paths.go +++ b/android/paths.go @@ -437,7 +437,7 @@ func (p SourcePath) Join(ctx PathContext, paths ...string) SourcePath { 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 @@ func PathForIntermediates(ctx PathContext, paths ...string) OutputPath { // 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 @@ var _ resPathProvider = ModuleSrcPath{} // 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 @@ func OptionalPathForModuleSrc(ctx ModuleContext, p *string) OptionalPath { 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 {