diff options
-rw-r--r-- | android/package_ctx.go | 5 | ||||
-rw-r--r-- | android/paths.go | 14 | ||||
-rw-r--r-- | build.ninja.in | 10 |
3 files changed, 16 insertions, 13 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{} diff --git a/build.ninja.in b/build.ninja.in index a7176724..9449d734 100644 --- a/build.ninja.in +++ b/build.ninja.in @@ -70,7 +70,6 @@ rule g.bootstrap.test build $ ${g.bootstrap.buildDir}/.bootstrap/blueprint/test/github.com/google/blueprint.a $ : g.bootstrap.compile ${g.bootstrap.srcDir}/build/blueprint/context.go $ - ${g.bootstrap.srcDir}/build/blueprint/fs.go $ ${g.bootstrap.srcDir}/build/blueprint/glob.go $ ${g.bootstrap.srcDir}/build/blueprint/live_tracker.go $ ${g.bootstrap.srcDir}/build/blueprint/mangle.go $ @@ -139,7 +138,6 @@ default ${g.bootstrap.buildDir}/.bootstrap/blueprint/test/test.passed build $ ${g.bootstrap.buildDir}/.bootstrap/blueprint/pkg/github.com/google/blueprint.a $ : g.bootstrap.compile ${g.bootstrap.srcDir}/build/blueprint/context.go $ - ${g.bootstrap.srcDir}/build/blueprint/fs.go $ ${g.bootstrap.srcDir}/build/blueprint/glob.go $ ${g.bootstrap.srcDir}/build/blueprint/live_tracker.go $ ${g.bootstrap.srcDir}/build/blueprint/mangle.go $ @@ -217,7 +215,7 @@ default $ # Variant: # Type: bootstrap_go_package # Factory: github.com/google/blueprint/bootstrap.newGoPackageModuleFactory.func1 -# Defined: build/blueprint/Blueprints:50:1 +# Defined: build/blueprint/Blueprints:49:1 build $ ${g.bootstrap.buildDir}/.bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a $ @@ -233,7 +231,7 @@ default $ # Variant: # Type: bootstrap_go_package # Factory: github.com/google/blueprint/bootstrap.newGoPackageModuleFactory.func1 -# Defined: build/blueprint/Blueprints:34:1 +# Defined: build/blueprint/Blueprints:33:1 build $ ${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/test/github.com/google/blueprint/parser.a $ @@ -300,12 +298,13 @@ default $ # Variant: # Type: bootstrap_go_package # Factory: github.com/google/blueprint/bootstrap.newGoPackageModuleFactory.func1 -# Defined: build/blueprint/Blueprints:56:1 +# Defined: build/blueprint/Blueprints:55:1 build $ ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/test/github.com/google/blueprint/pathtools.a $ : g.bootstrap.compile $ ${g.bootstrap.srcDir}/build/blueprint/pathtools/lists.go $ + ${g.bootstrap.srcDir}/build/blueprint/pathtools/fs.go $ ${g.bootstrap.srcDir}/build/blueprint/pathtools/glob.go $ ${g.bootstrap.srcDir}/build/blueprint/pathtools/glob_test.go | $ ${g.bootstrap.compileCmd} $ @@ -351,6 +350,7 @@ build $ ${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $ : g.bootstrap.compile $ ${g.bootstrap.srcDir}/build/blueprint/pathtools/lists.go $ + ${g.bootstrap.srcDir}/build/blueprint/pathtools/fs.go $ ${g.bootstrap.srcDir}/build/blueprint/pathtools/glob.go | $ ${g.bootstrap.compileCmd} $ ${g.bootstrap.buildDir}/.bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a |