Add buildDir to WritablePath implementations

First, the buildDir() method was renamed to getBuildDir() to avoid
clashing with the buildDir field.

Then, a buildDir was added to both `OutputPath` and `InstallPath` but
not to `PhonyPath` as it does not contain any path components. Instead
the `PhonyPath.getBuildDir()` was changed to simply return "".

Bug: 183650682
Test: m droid
Change-Id: I12e1854c829b980c5c01205753c62c00dc0a4774
This commit is contained in:
Paul Duffin
2021-03-24 09:22:07 +00:00
parent 580efc8716
commit d65c58b204
2 changed files with 25 additions and 14 deletions

View File

@@ -909,7 +909,7 @@ func NormalizePathForTesting(path Path) string {
}
p := path.String()
if w, ok := path.(WritablePath); ok {
rel, err := filepath.Rel(w.buildDir(), p)
rel, err := filepath.Rel(w.getBuildDir(), p)
if err != nil {
panic(err)
}
@@ -944,7 +944,7 @@ func PathRelativeToTop(path Path) string {
}
p := path.String()
if w, ok := path.(WritablePath); ok {
buildDir := w.buildDir()
buildDir := w.getBuildDir()
return StringPathRelativeToTop(buildDir, p)
}
return p