Start using "struct Objects" to store object Paths

So that we can represent other files that get generated along with the
objects, like the gcno coverage information, and per-file clang-tidy
runs.

Test: Soong's build.ninja identical before/after
Change-Id: I5c553a153c436d5403549f62c73fe79c5f101779
This commit is contained in:
Dan Willemsen
2016-09-26 17:33:01 -07:00
parent 5d5db02bf6
commit 5cb580f407
11 changed files with 81 additions and 67 deletions

View File

@@ -76,8 +76,8 @@ type PathDeps struct {
StaticLibs, LateStaticLibs, WholeStaticLibs android.Paths
// Paths to .o files
ObjFiles android.Paths
WholeStaticLibObjFiles android.Paths
Objs Objects
WholeStaticLibObjs Objects
// Paths to generated source files
GeneratedSources android.Paths
@@ -174,7 +174,7 @@ type compiler interface {
appendCflags([]string)
appendAsflags([]string)
compile(ctx ModuleContext, flags Flags, deps PathDeps) android.Paths
compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects
}
type linker interface {
@@ -183,7 +183,7 @@ type linker interface {
linkerFlags(ctx ModuleContext, flags Flags) Flags
linkerProps() []interface{}
link(ctx ModuleContext, flags Flags, deps PathDeps, objFiles android.Paths) android.Path
link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path
appendLdflags([]string)
}
@@ -440,16 +440,16 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
flags.GlobalFlags = append(flags.GlobalFlags, deps.Flags...)
var objFiles android.Paths
var objs Objects
if c.compiler != nil {
objFiles = c.compiler.compile(ctx, flags, deps)
objs = c.compiler.compile(ctx, flags, deps)
if ctx.Failed() {
return
}
}
if c.linker != nil {
outputFile := c.linker.link(ctx, flags, deps, objFiles)
outputFile := c.linker.link(ctx, flags, deps, objs)
if ctx.Failed() {
return
}
@@ -813,8 +813,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
}
if tag == reuseObjTag {
depPaths.ObjFiles = append(depPaths.ObjFiles,
cc.compiler.(libraryInterface).reuseObjs()...)
depPaths.Objs = depPaths.Objs.Append(cc.compiler.(libraryInterface).reuseObjs())
return
}
@@ -868,10 +867,9 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
}
ctx.AddMissingDependencies(missingDeps)
}
depPaths.WholeStaticLibObjFiles =
append(depPaths.WholeStaticLibObjFiles, staticLib.objs()...)
depPaths.WholeStaticLibObjs = depPaths.WholeStaticLibObjs.Append(staticLib.objs())
case objDepTag:
ptr = &depPaths.ObjFiles
depPaths.Objs.objFiles = append(depPaths.Objs.objFiles, linkFile.Path())
case crtBeginDepTag:
depPaths.CrtBegin = linkFile
case crtEndDepTag: