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"
|
"fmt"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
|
"github.com/google/blueprint/pathtools"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AndroidPackageContext is a wrapper for blueprint.PackageContext that adds
|
// AndroidPackageContext is a wrapper for blueprint.PackageContext that adds
|
||||||
@@ -55,6 +56,10 @@ func (e *configErrorWrapper) AddNinjaFileDeps(deps ...string) {
|
|||||||
e.pctx.AddNinjaFileDeps(deps...)
|
e.pctx.AddNinjaFileDeps(deps...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (e *configErrorWrapper) Fs() pathtools.FileSystem {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// SourcePathVariable returns a Variable whose value is the source directory
|
// 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
|
// 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
|
// initialization - either from the init() function or as part of a
|
||||||
|
@@ -16,7 +16,6 @@ package android
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -28,6 +27,7 @@ import (
|
|||||||
// PathContext is the subset of a (Module|Singleton)Context required by the
|
// PathContext is the subset of a (Module|Singleton)Context required by the
|
||||||
// Path methods.
|
// Path methods.
|
||||||
type PathContext interface {
|
type PathContext interface {
|
||||||
|
Fs() pathtools.FileSystem
|
||||||
Config() interface{}
|
Config() interface{}
|
||||||
AddNinjaFileDeps(deps ...string)
|
AddNinjaFileDeps(deps ...string)
|
||||||
}
|
}
|
||||||
@@ -347,12 +347,10 @@ func PathForSource(ctx PathContext, paths ...string) SourcePath {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err = os.Stat(ret.String()); err != nil {
|
if exists, _, err := ctx.Fs().Exists(ret.String()); err != nil {
|
||||||
if os.IsNotExist(err) {
|
reportPathError(ctx, "%s: %s", ret, err.Error())
|
||||||
reportPathError(ctx, "source path %s does not exist", ret)
|
} else if !exists {
|
||||||
} else {
|
reportPathError(ctx, "source path %s does not exist", ret)
|
||||||
reportPathError(ctx, "%s: %s", ret, err.Error())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
@@ -404,7 +402,7 @@ func OptionalPathForSource(ctx PathContext, intermediates string, paths ...strin
|
|||||||
} else {
|
} else {
|
||||||
// We cannot add build statements in this context, so we fall back to
|
// We cannot add build statements in this context, so we fall back to
|
||||||
// AddNinjaFileDeps
|
// AddNinjaFileDeps
|
||||||
files, dirs, err := pathtools.Glob(path.String())
|
files, dirs, err := pathtools.Glob(path.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
reportPathError(ctx, "glob: %s", err.Error())
|
reportPathError(ctx, "glob: %s", err.Error())
|
||||||
return OptionalPath{}
|
return OptionalPath{}
|
||||||
|
@@ -70,7 +70,6 @@ rule g.bootstrap.test
|
|||||||
build $
|
build $
|
||||||
${g.bootstrap.buildDir}/.bootstrap/blueprint/test/github.com/google/blueprint.a $
|
${g.bootstrap.buildDir}/.bootstrap/blueprint/test/github.com/google/blueprint.a $
|
||||||
: g.bootstrap.compile ${g.bootstrap.srcDir}/build/blueprint/context.go $
|
: 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/glob.go $
|
||||||
${g.bootstrap.srcDir}/build/blueprint/live_tracker.go $
|
${g.bootstrap.srcDir}/build/blueprint/live_tracker.go $
|
||||||
${g.bootstrap.srcDir}/build/blueprint/mangle.go $
|
${g.bootstrap.srcDir}/build/blueprint/mangle.go $
|
||||||
@@ -139,7 +138,6 @@ default ${g.bootstrap.buildDir}/.bootstrap/blueprint/test/test.passed
|
|||||||
build $
|
build $
|
||||||
${g.bootstrap.buildDir}/.bootstrap/blueprint/pkg/github.com/google/blueprint.a $
|
${g.bootstrap.buildDir}/.bootstrap/blueprint/pkg/github.com/google/blueprint.a $
|
||||||
: g.bootstrap.compile ${g.bootstrap.srcDir}/build/blueprint/context.go $
|
: 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/glob.go $
|
||||||
${g.bootstrap.srcDir}/build/blueprint/live_tracker.go $
|
${g.bootstrap.srcDir}/build/blueprint/live_tracker.go $
|
||||||
${g.bootstrap.srcDir}/build/blueprint/mangle.go $
|
${g.bootstrap.srcDir}/build/blueprint/mangle.go $
|
||||||
@@ -217,7 +215,7 @@ default $
|
|||||||
# Variant:
|
# Variant:
|
||||||
# Type: bootstrap_go_package
|
# Type: bootstrap_go_package
|
||||||
# Factory: github.com/google/blueprint/bootstrap.newGoPackageModuleFactory.func1
|
# Factory: github.com/google/blueprint/bootstrap.newGoPackageModuleFactory.func1
|
||||||
# Defined: build/blueprint/Blueprints:50:1
|
# Defined: build/blueprint/Blueprints:49:1
|
||||||
|
|
||||||
build $
|
build $
|
||||||
${g.bootstrap.buildDir}/.bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a $
|
${g.bootstrap.buildDir}/.bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a $
|
||||||
@@ -233,7 +231,7 @@ default $
|
|||||||
# Variant:
|
# Variant:
|
||||||
# Type: bootstrap_go_package
|
# Type: bootstrap_go_package
|
||||||
# Factory: github.com/google/blueprint/bootstrap.newGoPackageModuleFactory.func1
|
# Factory: github.com/google/blueprint/bootstrap.newGoPackageModuleFactory.func1
|
||||||
# Defined: build/blueprint/Blueprints:34:1
|
# Defined: build/blueprint/Blueprints:33:1
|
||||||
|
|
||||||
build $
|
build $
|
||||||
${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/test/github.com/google/blueprint/parser.a $
|
${g.bootstrap.buildDir}/.bootstrap/blueprint-parser/test/github.com/google/blueprint/parser.a $
|
||||||
@@ -300,12 +298,13 @@ default $
|
|||||||
# Variant:
|
# Variant:
|
||||||
# Type: bootstrap_go_package
|
# Type: bootstrap_go_package
|
||||||
# Factory: github.com/google/blueprint/bootstrap.newGoPackageModuleFactory.func1
|
# Factory: github.com/google/blueprint/bootstrap.newGoPackageModuleFactory.func1
|
||||||
# Defined: build/blueprint/Blueprints:56:1
|
# Defined: build/blueprint/Blueprints:55:1
|
||||||
|
|
||||||
build $
|
build $
|
||||||
${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/test/github.com/google/blueprint/pathtools.a $
|
${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/test/github.com/google/blueprint/pathtools.a $
|
||||||
: g.bootstrap.compile $
|
: g.bootstrap.compile $
|
||||||
${g.bootstrap.srcDir}/build/blueprint/pathtools/lists.go $
|
${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.go $
|
||||||
${g.bootstrap.srcDir}/build/blueprint/pathtools/glob_test.go | $
|
${g.bootstrap.srcDir}/build/blueprint/pathtools/glob_test.go | $
|
||||||
${g.bootstrap.compileCmd} $
|
${g.bootstrap.compileCmd} $
|
||||||
@@ -351,6 +350,7 @@ build $
|
|||||||
${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
|
${g.bootstrap.buildDir}/.bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
|
||||||
: g.bootstrap.compile $
|
: g.bootstrap.compile $
|
||||||
${g.bootstrap.srcDir}/build/blueprint/pathtools/lists.go $
|
${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.go | $
|
||||||
${g.bootstrap.compileCmd} $
|
${g.bootstrap.compileCmd} $
|
||||||
${g.bootstrap.buildDir}/.bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a
|
${g.bootstrap.buildDir}/.bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a
|
||||||
|
Reference in New Issue
Block a user