Merge "Remove config from basePath" am: 618eeff010
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1652615 Change-Id: I10dc32d568e6812dd714000fd79bfc4b1e4edf5f
This commit is contained in:
@@ -935,9 +935,8 @@ func (p WritablePaths) Paths() Paths {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type basePath struct {
|
type basePath struct {
|
||||||
path string
|
path string
|
||||||
config Config
|
rel string
|
||||||
rel string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p basePath) Ext() string {
|
func (p basePath) Ext() string {
|
||||||
@@ -984,7 +983,7 @@ func (p SourcePath) withRel(rel string) SourcePath {
|
|||||||
// code that is embedding ninja variables in paths
|
// code that is embedding ninja variables in paths
|
||||||
func safePathForSource(ctx PathContext, pathComponents ...string) (SourcePath, error) {
|
func safePathForSource(ctx PathContext, pathComponents ...string) (SourcePath, error) {
|
||||||
p, err := validateSafePath(pathComponents...)
|
p, err := validateSafePath(pathComponents...)
|
||||||
ret := SourcePath{basePath{p, ctx.Config(), ""}, ctx.Config().srcDir}
|
ret := SourcePath{basePath{p, ""}, ctx.Config().srcDir}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ret, err
|
return ret, err
|
||||||
}
|
}
|
||||||
@@ -1000,7 +999,7 @@ func safePathForSource(ctx PathContext, pathComponents ...string) (SourcePath, e
|
|||||||
// pathForSource creates a SourcePath from pathComponents, but does not check that it exists.
|
// pathForSource creates a SourcePath from pathComponents, but does not check that it exists.
|
||||||
func pathForSource(ctx PathContext, pathComponents ...string) (SourcePath, error) {
|
func pathForSource(ctx PathContext, pathComponents ...string) (SourcePath, error) {
|
||||||
p, err := validatePath(pathComponents...)
|
p, err := validatePath(pathComponents...)
|
||||||
ret := SourcePath{basePath{p, ctx.Config(), ""}, ctx.Config().srcDir}
|
ret := SourcePath{basePath{p, ""}, ctx.Config().srcDir}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ret, err
|
return ret, err
|
||||||
}
|
}
|
||||||
@@ -1189,7 +1188,7 @@ var _ Path = toolDepPath{}
|
|||||||
// Only use this function to construct paths for dependencies of the build
|
// Only use this function to construct paths for dependencies of the build
|
||||||
// tool invocation.
|
// tool invocation.
|
||||||
func pathForBuildToolDep(ctx PathContext, path string) toolDepPath {
|
func pathForBuildToolDep(ctx PathContext, path string) toolDepPath {
|
||||||
return toolDepPath{basePath{path, ctx.Config(), ""}}
|
return toolDepPath{basePath{path, ""}}
|
||||||
}
|
}
|
||||||
|
|
||||||
// PathForOutput joins the provided paths and returns an OutputPath that is
|
// PathForOutput joins the provided paths and returns an OutputPath that is
|
||||||
@@ -1202,7 +1201,7 @@ func PathForOutput(ctx PathContext, pathComponents ...string) OutputPath {
|
|||||||
}
|
}
|
||||||
fullPath := filepath.Join(ctx.Config().buildDir, path)
|
fullPath := filepath.Join(ctx.Config().buildDir, path)
|
||||||
path = fullPath[len(fullPath)-len(path):]
|
path = fullPath[len(fullPath)-len(path):]
|
||||||
return OutputPath{basePath{path, ctx.Config(), ""}, ctx.Config().buildDir, fullPath}
|
return OutputPath{basePath{path, ""}, ctx.Config().buildDir, fullPath}
|
||||||
}
|
}
|
||||||
|
|
||||||
// PathsForOutput returns Paths rooted from buildDir
|
// PathsForOutput returns Paths rooted from buildDir
|
||||||
@@ -1436,7 +1435,7 @@ func PathForBazelOut(ctx PathContext, paths ...string) BazelOutPath {
|
|||||||
reportPathError(ctx, err)
|
reportPathError(ctx, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
outputPath := OutputPath{basePath{"", ctx.Config(), ""},
|
outputPath := OutputPath{basePath{"", ""},
|
||||||
ctx.Config().buildDir,
|
ctx.Config().buildDir,
|
||||||
ctx.Config().BazelContext.OutputBase()}
|
ctx.Config().BazelContext.OutputBase()}
|
||||||
|
|
||||||
@@ -1654,7 +1653,7 @@ func pathForInstall(ctx PathContext, os OsType, arch ArchType, partition string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
base := InstallPath{
|
base := InstallPath{
|
||||||
basePath: basePath{partionPath, ctx.Config(), ""},
|
basePath: basePath{partionPath, ""},
|
||||||
buildDir: ctx.Config().buildDir,
|
buildDir: ctx.Config().buildDir,
|
||||||
partitionDir: partionPath,
|
partitionDir: partionPath,
|
||||||
makePath: false,
|
makePath: false,
|
||||||
@@ -1665,7 +1664,7 @@ func pathForInstall(ctx PathContext, os OsType, arch ArchType, partition string,
|
|||||||
|
|
||||||
func pathForNdkOrSdkInstall(ctx PathContext, prefix string, paths []string) InstallPath {
|
func pathForNdkOrSdkInstall(ctx PathContext, prefix string, paths []string) InstallPath {
|
||||||
base := InstallPath{
|
base := InstallPath{
|
||||||
basePath: basePath{prefix, ctx.Config(), ""},
|
basePath: basePath{prefix, ""},
|
||||||
buildDir: ctx.Config().buildDir,
|
buildDir: ctx.Config().buildDir,
|
||||||
partitionDir: prefix,
|
partitionDir: prefix,
|
||||||
makePath: false,
|
makePath: false,
|
||||||
@@ -1801,7 +1800,7 @@ func PathForPhony(ctx PathContext, phony string) WritablePath {
|
|||||||
if strings.ContainsAny(phony, "$/") {
|
if strings.ContainsAny(phony, "$/") {
|
||||||
ReportPathErrorf(ctx, "Phony target contains invalid character ($ or /): %s", phony)
|
ReportPathErrorf(ctx, "Phony target contains invalid character ($ or /): %s", phony)
|
||||||
}
|
}
|
||||||
return PhonyPath{basePath{phony, ctx.Config(), ""}}
|
return PhonyPath{basePath{phony, ""}}
|
||||||
}
|
}
|
||||||
|
|
||||||
type PhonyPath struct {
|
type PhonyPath struct {
|
||||||
|
Reference in New Issue
Block a user