aboutsummaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2016-11-02 20:43:13 -0700
committerDan Willemsen <dwillemsen@google.com>2016-11-02 21:19:11 -0700
commit21ec49068f7be873e963dd8dc5cff610539540c5 (patch)
treec99797f9e04319a88c26d8bf189d740f63744dcd /android
parenteb716e25590a50541c5c2b3be81ae0468ac35690 (diff)
downloadbuild_soong-21ec49068f7be873e963dd8dc5cff610539540c5.tar.gz
build_soong-21ec49068f7be873e963dd8dc5cff610539540c5.tar.bz2
build_soong-21ec49068f7be873e963dd8dc5cff610539540c5.zip
Add subdir to GenPath
We were emulating this for proto files, standardize it and make the other generators use it as well. Test: Compare out/soong/build.ninja before/after change Test: mmma -j system/tools/hidl Change-Id: I1888c7b981749060a398387bbb9b481270bf6d75
Diffstat (limited to 'android')
-rw-r--r--android/paths.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/android/paths.go b/android/paths.go
index 56c3715f..1202d6d4 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -94,7 +94,7 @@ type WritablePath interface {
}
type genPathProvider interface {
- genPathWithExt(ctx ModuleContext, ext string) ModuleGenPath
+ genPathWithExt(ctx ModuleContext, subdir, ext string) ModuleGenPath
}
type objPathProvider interface {
objPathWithExt(ctx ModuleContext, subdir, ext string) ModuleObjPath
@@ -105,9 +105,9 @@ type resPathProvider interface {
// GenPathWithExt derives a new file path in ctx's generated sources directory
// from the current path, but with the new extension.
-func GenPathWithExt(ctx ModuleContext, p Path, ext string) ModuleGenPath {
+func GenPathWithExt(ctx ModuleContext, subdir string, p Path, ext string) ModuleGenPath {
if path, ok := p.(genPathProvider); ok {
- return path.genPathWithExt(ctx, ext)
+ return path.genPathWithExt(ctx, subdir, ext)
}
reportPathError(ctx, "Tried to create generated file from unsupported path: %s(%s)", reflect.TypeOf(p).Name(), p)
return PathForModuleGen(ctx)
@@ -115,7 +115,7 @@ func GenPathWithExt(ctx ModuleContext, p Path, ext string) ModuleGenPath {
// ObjPathWithExt derives a new file path in ctx's object directory from the
// current path, but with the new extension.
-func ObjPathWithExt(ctx ModuleContext, p Path, subdir, ext string) ModuleObjPath {
+func ObjPathWithExt(ctx ModuleContext, subdir string, p Path, ext string) ModuleObjPath {
if path, ok := p.(objPathProvider); ok {
return path.objPathWithExt(ctx, subdir, ext)
}
@@ -535,8 +535,8 @@ func (p ModuleSrcPath) String() string {
return p.sourcePath.String()
}
-func (p ModuleSrcPath) genPathWithExt(ctx ModuleContext, ext string) ModuleGenPath {
- return PathForModuleGen(ctx, p.moduleDir, pathtools.ReplaceExtension(p.path, ext))
+func (p ModuleSrcPath) genPathWithExt(ctx ModuleContext, subdir, ext string) ModuleGenPath {
+ return PathForModuleGen(ctx, subdir, p.moduleDir, pathtools.ReplaceExtension(p.path, ext))
}
func (p ModuleSrcPath) objPathWithExt(ctx ModuleContext, subdir, ext string) ModuleObjPath {
@@ -583,9 +583,9 @@ func PathForModuleGen(ctx ModuleContext, paths ...string) ModuleGenPath {
}
}
-func (p ModuleGenPath) genPathWithExt(ctx ModuleContext, ext string) ModuleGenPath {
+func (p ModuleGenPath) genPathWithExt(ctx ModuleContext, subdir, ext string) ModuleGenPath {
// TODO: make a different path for local vs remote generated files?
- return PathForModuleGen(ctx, pathtools.ReplaceExtension(p.path, ext))
+ return PathForModuleGen(ctx, subdir, pathtools.ReplaceExtension(p.path, ext))
}
func (p ModuleGenPath) objPathWithExt(ctx ModuleContext, subdir, ext string) ModuleObjPath {