Loading android/paths.go +8 −5 Original line number Diff line number Diff line Loading @@ -968,6 +968,9 @@ func (p basePath) withRel(rel string) basePath { // SourcePath is a Path representing a file path rooted from SrcDir type SourcePath struct { basePath // The sources root, i.e. Config.SrcDir() srcDir string } var _ Path = SourcePath{} Loading @@ -981,7 +984,7 @@ func (p SourcePath) withRel(rel string) SourcePath { // code that is embedding ninja variables in paths func safePathForSource(ctx PathContext, pathComponents ...string) (SourcePath, error) { p, err := validateSafePath(pathComponents...) ret := SourcePath{basePath{p, ctx.Config(), ""}} ret := SourcePath{basePath{p, ctx.Config(), ""}, ctx.Config().srcDir} if err != nil { return ret, err } Loading @@ -997,7 +1000,7 @@ func safePathForSource(ctx PathContext, pathComponents ...string) (SourcePath, e // pathForSource creates a SourcePath from pathComponents, but does not check that it exists. func pathForSource(ctx PathContext, pathComponents ...string) (SourcePath, error) { p, err := validatePath(pathComponents...) ret := SourcePath{basePath{p, ctx.Config(), ""}} ret := SourcePath{basePath{p, ctx.Config(), ""}, ctx.Config().srcDir} if err != nil { return ret, err } Loading Loading @@ -1091,7 +1094,7 @@ func ExistentPathForSource(ctx PathContext, pathComponents ...string) OptionalPa } func (p SourcePath) String() string { return filepath.Join(p.config.srcDir, p.path) return filepath.Join(p.srcDir, p.path) } // Join creates a new SourcePath with paths... joined with the current path. The Loading Loading @@ -1123,7 +1126,7 @@ func (p SourcePath) OverlayPath(ctx ModuleMissingDepsPathContext, path Path) Opt ReportPathErrorf(ctx, "Cannot find relative path for %s(%s)", reflect.TypeOf(path).Name(), path) return OptionalPath{} } dir := filepath.Join(p.config.srcDir, p.path, relDir) dir := filepath.Join(p.srcDir, p.path, relDir) // Use Glob so that we are run again if the directory is added. if pathtools.IsGlob(dir) { ReportPathErrorf(ctx, "Path may not contain a glob: %s", dir) Loading @@ -1136,7 +1139,7 @@ func (p SourcePath) OverlayPath(ctx ModuleMissingDepsPathContext, path Path) Opt if len(paths) == 0 { return OptionalPath{} } relPath := Rel(ctx, p.config.srcDir, paths[0]) relPath := Rel(ctx, p.srcDir, paths[0]) return OptionalPathForPath(PathForSource(ctx, relPath)) } Loading Loading
android/paths.go +8 −5 Original line number Diff line number Diff line Loading @@ -968,6 +968,9 @@ func (p basePath) withRel(rel string) basePath { // SourcePath is a Path representing a file path rooted from SrcDir type SourcePath struct { basePath // The sources root, i.e. Config.SrcDir() srcDir string } var _ Path = SourcePath{} Loading @@ -981,7 +984,7 @@ func (p SourcePath) withRel(rel string) SourcePath { // code that is embedding ninja variables in paths func safePathForSource(ctx PathContext, pathComponents ...string) (SourcePath, error) { p, err := validateSafePath(pathComponents...) ret := SourcePath{basePath{p, ctx.Config(), ""}} ret := SourcePath{basePath{p, ctx.Config(), ""}, ctx.Config().srcDir} if err != nil { return ret, err } Loading @@ -997,7 +1000,7 @@ func safePathForSource(ctx PathContext, pathComponents ...string) (SourcePath, e // pathForSource creates a SourcePath from pathComponents, but does not check that it exists. func pathForSource(ctx PathContext, pathComponents ...string) (SourcePath, error) { p, err := validatePath(pathComponents...) ret := SourcePath{basePath{p, ctx.Config(), ""}} ret := SourcePath{basePath{p, ctx.Config(), ""}, ctx.Config().srcDir} if err != nil { return ret, err } Loading Loading @@ -1091,7 +1094,7 @@ func ExistentPathForSource(ctx PathContext, pathComponents ...string) OptionalPa } func (p SourcePath) String() string { return filepath.Join(p.config.srcDir, p.path) return filepath.Join(p.srcDir, p.path) } // Join creates a new SourcePath with paths... joined with the current path. The Loading Loading @@ -1123,7 +1126,7 @@ func (p SourcePath) OverlayPath(ctx ModuleMissingDepsPathContext, path Path) Opt ReportPathErrorf(ctx, "Cannot find relative path for %s(%s)", reflect.TypeOf(path).Name(), path) return OptionalPath{} } dir := filepath.Join(p.config.srcDir, p.path, relDir) dir := filepath.Join(p.srcDir, p.path, relDir) // Use Glob so that we are run again if the directory is added. if pathtools.IsGlob(dir) { ReportPathErrorf(ctx, "Path may not contain a glob: %s", dir) Loading @@ -1136,7 +1139,7 @@ func (p SourcePath) OverlayPath(ctx ModuleMissingDepsPathContext, path Path) Opt if len(paths) == 0 { return OptionalPath{} } relPath := Rel(ctx, p.config.srcDir, paths[0]) relPath := Rel(ctx, p.srcDir, paths[0]) return OptionalPathForPath(PathForSource(ctx, relPath)) } Loading