Merge "Add compile-time pathDeps as implicit dependencies"

This commit is contained in:
Treehugger Robot
2017-12-20 04:05:39 +00:00
committed by Gerrit Code Review
4 changed files with 21 additions and 18 deletions

View File

@@ -290,7 +290,7 @@ func (a Objects) Append(b Objects) Objects {
// Generate rules for compiling multiple .c, .cpp, or .S files to individual .o files
func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles android.Paths,
flags builderFlags, deps android.Paths) Objects {
flags builderFlags, pathDeps android.Paths, genDeps android.Paths) Objects {
objFiles := make(android.Paths, len(srcFiles))
var tidyFiles android.Paths
@@ -363,7 +363,8 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
Description: "yasm " + srcFile.Rel(),
Output: objFile,
Input: srcFile,
OrderOnly: deps,
Implicits: pathDeps,
OrderOnly: genDeps,
Args: map[string]string{
"asFlags": flags.yasmFlags,
},
@@ -375,7 +376,8 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
Description: "windres " + srcFile.Rel(),
Output: objFile,
Input: srcFile,
OrderOnly: deps,
Implicits: pathDeps,
OrderOnly: genDeps,
Args: map[string]string{
"windresCmd": gccCmd(flags.toolchain, "windres"),
"flags": flags.toolchain.WindresFlags(),
@@ -443,7 +445,8 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
Output: objFile,
ImplicitOutputs: implicitOutputs,
Input: srcFile,
OrderOnly: deps,
Implicits: pathDeps,
OrderOnly: genDeps,
Args: map[string]string{
"cFlags": moduleCflags,
"ccCmd": ccCmd,

View File

@@ -157,7 +157,8 @@ func NewBaseCompiler() *baseCompiler {
type baseCompiler struct {
Properties BaseCompilerProperties
Proto android.ProtoProperties
deps android.Paths
genDeps android.Paths
pathDeps android.Paths
flags builderFlags
// Sources that were passed to the C/C++ compiler
@@ -536,17 +537,16 @@ func (compiler *baseCompiler) compile(ctx ModuleContext, flags Flags, deps PathD
srcs := append(android.Paths(nil), compiler.srcsBeforeGen...)
srcs, genDeps := genSources(ctx, srcs, buildFlags)
pathDeps = append(pathDeps, genDeps...)
pathDeps = append(pathDeps, flags.CFlagsDeps...)
compiler.deps = pathDeps
compiler.pathDeps = pathDeps
compiler.genDeps = genDeps
// Save src, buildFlags and context
compiler.srcs = srcs
// Compile files listed in c.Properties.Srcs into objects
objs := compileObjs(ctx, buildFlags, "", srcs, compiler.deps)
objs := compileObjs(ctx, buildFlags, "", srcs, pathDeps, genDeps)
if ctx.Failed() {
return Objects{}
@@ -557,7 +557,7 @@ func (compiler *baseCompiler) compile(ctx ModuleContext, flags Flags, deps PathD
// Compile a list of source files into objects a specified subdirectory
func compileObjs(ctx android.ModuleContext, flags builderFlags,
subdir string, srcFiles, deps android.Paths) Objects {
subdir string, srcFiles, pathDeps android.Paths, genDeps android.Paths) Objects {
return TransformSourceToObj(ctx, subdir, srcFiles, flags, deps)
return TransformSourceToObj(ctx, subdir, srcFiles, flags, pathDeps, genDeps)
}

View File

@@ -384,11 +384,11 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa
if library.static() {
srcs := android.PathsForModuleSrc(ctx, library.Properties.Static.Srcs)
objs = objs.Append(compileObjs(ctx, buildFlags, android.DeviceStaticLibrary,
srcs, library.baseCompiler.deps))
srcs, library.baseCompiler.pathDeps, library.baseCompiler.genDeps))
} else if library.shared() {
srcs := android.PathsForModuleSrc(ctx, library.Properties.Shared.Srcs)
objs = objs.Append(compileObjs(ctx, buildFlags, android.DeviceSharedLibrary,
srcs, library.baseCompiler.deps))
srcs, library.baseCompiler.pathDeps, library.baseCompiler.genDeps))
}
return objs
@@ -671,8 +671,8 @@ func (library *libraryDecorator) link(ctx ModuleContext,
}
library.reexportFlags(flags)
library.reuseExportedFlags = append(library.reuseExportedFlags, flags...)
library.reexportDeps(library.baseCompiler.deps) // TODO: restrict to aidl deps
library.reuseExportedDeps = append(library.reuseExportedDeps, library.baseCompiler.deps...)
library.reexportDeps(library.baseCompiler.genDeps) // TODO: restrict to aidl deps
library.reuseExportedDeps = append(library.reuseExportedDeps, library.baseCompiler.genDeps...)
}
}
@@ -684,8 +684,8 @@ func (library *libraryDecorator) link(ctx ModuleContext,
}
library.reexportFlags(flags)
library.reuseExportedFlags = append(library.reuseExportedFlags, flags...)
library.reexportDeps(library.baseCompiler.deps) // TODO: restrict to proto deps
library.reuseExportedDeps = append(library.reuseExportedDeps, library.baseCompiler.deps...)
library.reexportDeps(library.baseCompiler.genDeps) // TODO: restrict to proto deps
library.reuseExportedDeps = append(library.reuseExportedDeps, library.baseCompiler.genDeps...)
}
}

View File

@@ -288,7 +288,7 @@ func compileStubLibrary(ctx ModuleContext, flags Flags, symbolFile, apiLevel, vn
subdir := ""
srcs := []android.Path{stubSrcPath}
return compileObjs(ctx, flagsToBuilderFlags(flags), subdir, srcs, nil), versionScriptPath
return compileObjs(ctx, flagsToBuilderFlags(flags), subdir, srcs, nil, nil), versionScriptPath
}
func (c *stubDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {