Optimize javacFlags and aidlFlags in ninja files

aidlFlags gets specified for every aidl file.  Use a module scoped
ninja variable to hold the aidl flags, and while we're at it do the
same for javacFlags.

Change-Id: I980f0006c41918154ab0479d56387630a7e1d677
This commit is contained in:
Colin Cross 2015-04-13 13:53:40 -07:00
parent aa8630ba09
commit f03c82b8fa

View file

@ -171,7 +171,7 @@ func (j *javaBase) AndroidDynamicDependencies(ctx common.AndroidDynamicDependerM
}
func (j *javaBase) aidlFlags(ctx common.AndroidModuleContext, aidlPreprocess string,
aidlIncludeDirs []string) string {
aidlIncludeDirs []string) []string {
localAidlIncludes := pathtools.PrefixPaths(j.properties.Aidl_includes, common.ModuleSrcDir(ctx))
@ -187,7 +187,7 @@ func (j *javaBase) aidlFlags(ctx common.AndroidModuleContext, aidlPreprocess str
flags = append(flags, "-I"+common.ModuleSrcDir(ctx))
flags = append(flags, "-I"+filepath.Join(common.ModuleSrcDir(ctx), "src"))
return strings.Join(flags, " ")
return flags
}
func (j *javaBase) collectDeps(ctx common.AndroidModuleContext) (classpath []string,
@ -239,9 +239,18 @@ func (j *javaBase) GenerateJavaBuildActions(ctx common.AndroidModuleContext) {
classpath, bootClasspath, classJarSpecs, resourceJarSpecs, aidlPreprocess,
aidlIncludeDirs := j.collectDeps(ctx)
flags := javaBuilderFlags{
javacFlags: strings.Join(j.properties.Javacflags, " "),
aidlFlags: j.aidlFlags(ctx, aidlPreprocess, aidlIncludeDirs),
var flags javaBuilderFlags
javacFlags := j.properties.Javacflags
if len(javacFlags) > 0 {
ctx.Variable(pctx, "javacFlags", strings.Join(javacFlags, " "))
flags.javacFlags = "$javacFlags"
}
aidlFlags := j.aidlFlags(ctx, aidlPreprocess, aidlIncludeDirs)
if len(aidlFlags) > 0 {
ctx.Variable(pctx, "aidlFlags", strings.Join(aidlFlags, " "))
flags.aidlFlags = "$aidlFlags"
}
var javacDeps []string