Clarify ExistentPathForSource docs

Specify that these paths are relative to SrcDir, not relative to a
module's local source directory.

Test: n/a
Change-Id: I9a80f19b2eb3a15e6276e98200796b0680af9ee7
This commit is contained in:
Liz Kammer
2021-02-11 09:16:14 -05:00
parent aef038aac1
commit 7aa52883dd

View File

@@ -279,7 +279,8 @@ func (paths Paths) containsPath(path Path) bool {
return false return false
} }
// PathsForSource returns Paths rooted from SrcDir // PathsForSource returns Paths rooted from SrcDir, *not* rooted from the module's local source
// directory
func PathsForSource(ctx PathContext, paths []string) Paths { func PathsForSource(ctx PathContext, paths []string) Paths {
ret := make(Paths, len(paths)) ret := make(Paths, len(paths))
for i, path := range paths { for i, path := range paths {
@@ -288,9 +289,9 @@ func PathsForSource(ctx PathContext, paths []string) Paths {
return ret return ret
} }
// ExistentPathsForSources returns a list of Paths rooted from SrcDir that are // ExistentPathsForSources returns a list of Paths rooted from SrcDir, *not* rooted from the
// found in the tree. If any are not found, they are omitted from the list, // module's local source directory, that are found in the tree. If any are not found, they are
// and dependencies are added so that we're re-run when they are added. // omitted from the list, and dependencies are added so that we're re-run when they are added.
func ExistentPathsForSources(ctx PathContext, paths []string) Paths { func ExistentPathsForSources(ctx PathContext, paths []string) Paths {
ret := make(Paths, 0, len(paths)) ret := make(Paths, 0, len(paths))
for _, path := range paths { for _, path := range paths {
@@ -914,9 +915,10 @@ func PathForSource(ctx PathContext, pathComponents ...string) SourcePath {
return path return path
} }
// ExistentPathForSource returns an OptionalPath with the SourcePath if the // ExistentPathForSource returns an OptionalPath with the SourcePath, rooted from SrcDir, *not*
// path exists, or an empty OptionalPath if it doesn't exist. Dependencies are added // rooted from the module's local source directory, if the path exists, or an empty OptionalPath if
// so that the ninja file will be regenerated if the state of the path changes. // it doesn't exist. Dependencies are added so that the ninja file will be regenerated if the state
// of the path changes.
func ExistentPathForSource(ctx PathContext, pathComponents ...string) OptionalPath { func ExistentPathForSource(ctx PathContext, pathComponents ...string) OptionalPath {
path, err := pathForSource(ctx, pathComponents...) path, err := pathForSource(ctx, pathComponents...)
if err != nil { if err != nil {