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
This commit is contained in:
@@ -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
|
||||
|
@@ -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 {
|
||||
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{}
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user