diff options
author | Colin Cross <ccross@android.com> | 2015-04-13 13:53:40 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2015-04-13 17:31:25 -0700 |
commit | f03c82b8fa0184bd382bacb0ac5256184624a7cd (patch) | |
tree | e73e047864715a6ee6d59a6893a1319c8d2e8a62 | |
parent | aa8630ba0959840fa159520c3f618ba4f3c4feda (diff) | |
download | build_soong-f03c82b8fa0184bd382bacb0ac5256184624a7cd.tar.gz build_soong-f03c82b8fa0184bd382bacb0ac5256184624a7cd.tar.bz2 build_soong-f03c82b8fa0184bd382bacb0ac5256184624a7cd.zip |
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
-rw-r--r-- | java/java.go | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/java/java.go b/java/java.go index bbec5b56..533cabbd 100644 --- a/java/java.go +++ b/java/java.go @@ -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 |