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/package_ctx.go b/android/package_ctx.go
index ee826c8..d9bb109 100644
--- a/android/package_ctx.go
+++ b/android/package_ctx.go
@@ -18,6 +18,7 @@
 	"fmt"
 
 	"github.com/google/blueprint"
+	"github.com/google/blueprint/pathtools"
 )
 
 // AndroidPackageContext is a wrapper for blueprint.PackageContext that adds
@@ -55,6 +56,10 @@
 	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 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{}
diff --git a/build.ninja.in b/build.ninja.in
index a717672..9449d73 100644
--- a/build.ninja.in
+++ b/build.ninja.in
@@ -70,7 +70,6 @@
 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 @@
 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 @@
 # 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 @@
 # 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 @@
 # 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 @@
         ${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