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
This commit is contained in:
parent
e25bc9ba83
commit
7fc17dbfce
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue