aboutsummaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-02-01 14:10:36 -0800
committerColin Cross <ccross@android.com>2017-02-02 16:19:56 -0800
commit294941bee9566e76047a230acea451cbc188210b (patch)
tree1d6eb31f48afbd250050f134620441b0242580cb /android
parentb9eeb1d79a239004ee294e3333509e770ce8b9ea (diff)
downloadbuild_soong-294941bee9566e76047a230acea451cbc188210b.tar.gz
build_soong-294941bee9566e76047a230acea451cbc188210b.tar.bz2
build_soong-294941bee9566e76047a230acea451cbc188210b.zip
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
Diffstat (limited to 'android')
-rw-r--r--android/package_ctx.go5
-rw-r--r--android/paths.go14
2 files changed, 11 insertions, 8 deletions
diff --git a/android/package_ctx.go b/android/package_ctx.go
index ee826c81..d9bb1090 100644
--- a/android/package_ctx.go
+++ b/android/package_ctx.go
@@ -18,6 +18,7 @@ import (
"fmt"
"github.com/google/blueprint"
+ "github.com/google/blueprint/pathtools"
)
// AndroidPackageContext is a wrapper for blueprint.PackageContext that adds
@@ -55,6 +56,10 @@ func (e *configErrorWrapper) AddNinjaFileDeps(deps ...string) {
e.pctx.AddNinjaFileDeps(deps...)
}
+func (e *configErrorWrapper) Fs() pathtools.FileSystem {
+ return nil
+}
+
// SourcePathVariable returns a Variable whose value is the source directory
// appended with the supplied path. It may only be called during a Go package's
// initialization - either from the init() function or as part of a
diff --git a/android/paths.go b/android/paths.go
index 8eabfb84..ac7d81e6 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -16,7 +16,6 @@ package android
import (
"fmt"
- "os"
"path/filepath"
"reflect"
"strings"
@@ -28,6 +27,7 @@ import (
// 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 @@ func PathForSource(ctx PathContext, paths ...string) SourcePath {
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 @@ func OptionalPathForSource(ctx PathContext, intermediates string, paths ...strin
} 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{}