aboutsummaryrefslogtreecommitdiffstats
path: root/genrule
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2018-02-21 18:28:18 -0800
committerDan Willemsen <dwillemsen@google.com>2018-02-22 02:37:01 +0000
commit9da9d49ede01c762ac76b604dc4ab3ce24658c1c (patch)
tree57b3255c7b7aba8adbabb8c310f9e900746b930d /genrule
parent431e17af07c625cfbe68f82fb8503a6229a9dd87 (diff)
downloadbuild_soong-9da9d49ede01c762ac76b604dc4ab3ce24658c1c.tar.gz
build_soong-9da9d49ede01c762ac76b604dc4ab3ce24658c1c.tar.bz2
build_soong-9da9d49ede01c762ac76b604dc4ab3ce24658c1c.zip
Only depend on a single file for generated headers
While the rule may really need all of the generated header files to exist, only one of them (per genrule task) needs to be in the dependency list, since the rest are essentially aliases. This brings an AOSP aosp_arm-userdebug out/soong/build.ninja file from 372MB to 156MB, with equivalent functionality. The Android-aosp_arm.mk file is reduced from 11MB to 6.5MB. Bug: 73745773 Test: diff out/soong/build.ninja Test: diff out/soong/Android-aosp_arm.mk Test: rm -rf out; m Change-Id: If17377666292cc20957417fc4c3cd52f98971d0c
Diffstat (limited to 'genrule')
-rw-r--r--genrule/genrule.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/genrule/genrule.go b/genrule/genrule.go
index e423ebcc..0cd110ce 100644
--- a/genrule/genrule.go
+++ b/genrule/genrule.go
@@ -43,6 +43,7 @@ func init() {
type SourceFileGenerator interface {
GeneratedSourceFiles() android.Paths
GeneratedHeaderDirs() android.Paths
+ GeneratedDeps() android.Paths
}
type HostToolProvider interface {
@@ -107,6 +108,7 @@ type Module struct {
exportedIncludeDirs android.Paths
outputFiles android.Paths
+ outputDeps android.Paths
}
type taskFunc func(ctx android.ModuleContext, rawCommand string, srcFiles android.Paths) generateTask
@@ -130,6 +132,10 @@ func (g *Module) GeneratedHeaderDirs() android.Paths {
return g.exportedIncludeDirs
}
+func (g *Module) GeneratedDeps() android.Paths {
+ return g.outputDeps
+}
+
func (g *Module) DepsMutator(ctx android.BottomUpMutatorContext) {
android.ExtractSourcesDeps(ctx, g.properties.Srcs)
android.ExtractSourcesDeps(ctx, g.properties.Tool_files)
@@ -334,6 +340,7 @@ func (g *Module) generateSourceFile(ctx android.ModuleContext, task generateTask
for _, outputFile := range task.out {
g.outputFiles = append(g.outputFiles, outputFile)
}
+ g.outputDeps = append(g.outputDeps, task.out[0])
}
func generatorFactory(taskGenerator taskFunc, props ...interface{}) *Module {