Update soong to use pathtools.FileSystem
Update soong to follow changes in
https://github.com/google/blueprint/pull/141
Test: soong tests
Change-Id: I49a9b83cac7590dc75b26b31136b8707c188bc4a
diff --git a/android/paths.go b/android/paths.go
index 8eabfb8..ac7d81e 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -16,7 +16,6 @@
import (
"fmt"
- "os"
"path/filepath"
"reflect"
"strings"
@@ -28,6 +27,7 @@
// PathContext is the subset of a (Module|Singleton)Context required by the
// Path methods.
type PathContext interface {
+ Fs() pathtools.FileSystem
Config() interface{}
AddNinjaFileDeps(deps ...string)
}
@@ -347,12 +347,10 @@
return ret
}
- if _, err = os.Stat(ret.String()); err != nil {
- if os.IsNotExist(err) {
- reportPathError(ctx, "source path %s does not exist", ret)
- } else {
- reportPathError(ctx, "%s: %s", ret, err.Error())
- }
+ if exists, _, err := ctx.Fs().Exists(ret.String()); err != nil {
+ reportPathError(ctx, "%s: %s", ret, err.Error())
+ } else if !exists {
+ reportPathError(ctx, "source path %s does not exist", ret)
}
return ret
}
@@ -404,7 +402,7 @@
} else {
// We cannot add build statements in this context, so we fall back to
// AddNinjaFileDeps
- files, dirs, err := pathtools.Glob(path.String())
+ files, dirs, err := pathtools.Glob(path.String(), nil)
if err != nil {
reportPathError(ctx, "glob: %s", err.Error())
return OptionalPath{}