Lines Matching refs:p
128 func GenPathWithExt(ctx ModuleContext, subdir string, p Path, ext string) ModuleGenPath {
129 if path, ok := p.(genPathProvider); ok {
132 …f(ctx, "Tried to create generated file from unsupported path: %s(%s)", reflect.TypeOf(p).Name(), p)
138 func ObjPathWithExt(ctx ModuleContext, subdir string, p Path, ext string) ModuleObjPath {
139 if path, ok := p.(objPathProvider); ok {
142 …orf(ctx, "Tried to create object file from unsupported path: %s (%s)", reflect.TypeOf(p).Name(), p)
149 func ResPathWithName(ctx ModuleContext, p Path, name string) ModuleResPath {
150 if path, ok := p.(resPathProvider); ok {
153 …Errorf(ctx, "Tried to create res file from unsupported path: %s (%s)", reflect.TypeOf(p).Name(), p)
172 func (p OptionalPath) Valid() bool {
173 return p.valid
178 func (p OptionalPath) Path() Path {
179 if !p.valid {
182 return p.path
186 func (p OptionalPath) String() string {
187 if p.valid {
188 return p.path.String()
212 p := ExistentPathForSource(ctx, path)
213 if p.Valid() {
214 ret = append(ret, p.Path())
333 p := pathForModuleSrc(ctx, s)
334 if exists, _, err := ctx.Fs().Exists(p.String()); err != nil {
335 reportPathErrorf(ctx, "%s: %s", p, err.Error())
337 reportPathErrorf(ctx, "module source path %q does not exist", p)
340 j := findStringInSlice(p.String(), expandedExcludes)
344 return Paths{p}, nil
359 for _, p := range paths {
360 if !incDirs && strings.HasSuffix(p, "/") {
363 path := filepath.Clean(p)
365 reportPathErrorf(ctx, "Path %q is not in module source directory %q", p, prefix)
395 func (p Paths) Strings() []string {
396 if p == nil {
399 ret := make([]string, len(p))
400 for i, path := range p {
463 func inPathList(p Path, list []Path) bool {
464 return indexPathList(p, list) != -1
480 func (p Paths) HasExt(ext string) bool {
481 for _, path := range p {
491 func (p Paths) FilterByExt(ext string) Paths {
492 ret := make(Paths, 0, len(p))
493 for _, path := range p {
502 func (p Paths) FilterOutByExt(ext string) Paths {
503 ret := make(Paths, 0, len(p))
504 for _, path := range p {
527 func (p DirectorySortedPaths) PathsInDirectory(dir string) Paths {
529 start := sort.Search(len(p), func(i int) bool {
530 return prefix < p[i].String()
533 ret := p[start:]
548 func (p WritablePaths) Strings() []string {
549 if p == nil {
552 ret := make([]string, len(p))
553 for i, path := range p {
560 func (p WritablePaths) Paths() Paths {
561 if p == nil {
564 ret := make(Paths, len(p))
565 for i, path := range p {
577 func (p basePath) Ext() string {
578 return filepath.Ext(p.path)
581 func (p basePath) Base() string {
582 return filepath.Base(p.path)
585 func (p basePath) Rel() string {
586 if p.rel != "" {
587 return p.rel
589 return p.path
592 func (p basePath) String() string {
593 return p.path
596 func (p basePath) withRel(rel string) basePath {
597 p.path = filepath.Join(p.path, rel)
598 p.rel = rel
599 return p
609 func (p SourcePath) withRel(rel string) SourcePath {
610 p.basePath = p.basePath.withRel(rel)
611 return p
617 p, err := validateSafePath(pathComponents...)
618 ret := SourcePath{basePath{p, ctx.Config(), ""}}
633 p, err := validatePath(pathComponents...)
634 ret := SourcePath{basePath{p, ctx.Config(), ""}}
726 func (p SourcePath) String() string {
727 return filepath.Join(p.config.srcDir, p.path)
732 func (p SourcePath) Join(ctx PathContext, paths ...string) SourcePath {
737 return p.withRel(path)
741 func (p SourcePath) join(ctx PathContext, paths ...string) SourcePath {
746 return p.withRel(path)
751 func (p SourcePath) OverlayPath(ctx ModuleContext, path Path) OptionalPath {
759 dir := filepath.Join(p.config.srcDir, p.path, relDir)
772 relPath := Rel(ctx, p.config.srcDir, paths[0])
781 func (p OutputPath) withRel(rel string) OutputPath {
782 p.basePath = p.basePath.withRel(rel)
783 return p
786 func (p OutputPath) WithoutRel() OutputPath {
787 p.basePath.rel = filepath.Base(p.basePath.path)
788 return p
813 func (p OutputPath) writablePath() {}
815 func (p OutputPath) String() string {
816 return filepath.Join(p.config.buildDir, p.path)
819 func (p OutputPath) RelPathString() string {
820 return p.path
825 func (p OutputPath) Join(ctx PathContext, paths ...string) OutputPath {
830 return p.withRel(path)
834 func (p OutputPath) ReplaceExtension(ctx PathContext, ext string) OutputPath {
838 ret := PathForOutput(ctx, pathtools.ReplaceExtension(p.path, ext))
839 ret.rel = pathtools.ReplaceExtension(p.rel, ext)
844 func (p OutputPath) InSameDir(ctx PathContext, paths ...string) OutputPath {
850 ret := PathForOutput(ctx, filepath.Dir(p.path), path)
851 ret.rel = filepath.Join(filepath.Dir(p.rel), path)
872 p, err := validatePath(pathComponents...)
876 paths, err := expandOneSrcPath(ctx, p, nil)
889 reportPathErrorf(ctx, "%q produced no files, expected exactly one", p)
892 reportPathErrorf(ctx, "%q produced %d files, expected exactly one", p, len(paths))
898 p, err := validatePath(paths...)
903 path, err := pathForSource(ctx, ctx.ModuleDir(), p)
908 path.basePath.rel = p
936 func OptionalPathForModuleSrc(ctx ModuleContext, p *string) OptionalPath {
937 if p == nil {
940 return OptionalPathForPath(PathForModuleSrc(ctx, *p))
943 func (p SourcePath) genPathWithExt(ctx ModuleContext, subdir, ext string) ModuleGenPath {
944 return PathForModuleGen(ctx, subdir, pathtools.ReplaceExtension(p.path, ext))
947 func (p SourcePath) objPathWithExt(ctx ModuleContext, subdir, ext string) ModuleObjPath {
948 return PathForModuleObj(ctx, subdir, pathtools.ReplaceExtension(p.path, ext))
951 func (p SourcePath) resPathWithName(ctx ModuleContext, name string) ModuleResPath {
953 return PathForModuleRes(ctx, p.path, name)
1006 p, err := validatePath(paths...)
1011 OutputPath: pathForModule(ctx).withRel(p),
1028 p, err := validatePath(paths...)
1034 OutputPath: pathForModule(ctx).withRel("gen").withRel(p),
1039 func (p ModuleGenPath) genPathWithExt(ctx ModuleContext, subdir, ext string) ModuleGenPath {
1041 return PathForModuleGen(ctx, subdir, pathtools.ReplaceExtension(p.path, ext))
1044 func (p ModuleGenPath) objPathWithExt(ctx ModuleContext, subdir, ext string) ModuleObjPath {
1045 return PathForModuleObj(ctx, subdir, pathtools.ReplaceExtension(p.path, ext))
1059 p, err := validatePath(pathComponents...)
1063 return ModuleObjPath{PathForModuleOut(ctx, "obj", p)}
1077 p, err := validatePath(pathComponents...)
1082 return ModuleResPath{PathForModuleOut(ctx, "res", p)}
1178 func (p PhonyPath) writablePath() {}
1187 func (p testPath) String() string {
1188 return p.path
1195 func (p testPath) writablePath() {}
1200 p, err := validateSafePath(paths...)
1204 return testPath{basePath{path: p, rel: p}}
1209 p := make(Paths, len(strs))
1211 p[i] = PathForTesting(s)
1214 return p
1220 p, err := validateSafePath(paths...)
1224 return testWritablePath{testPath{basePath{path: p, rel: p}}}
1230 p := make(WritablePaths, len(strs))
1232 p[i] = WritablePathForTesting(s)
1235 return p