From 16f23a4038d9156286a06ba757eaa9c1c86e562a Mon Sep 17 00:00:00 2001 From: Ramy Medhat Date: Thu, 3 Sep 2020 01:29:49 -0400 Subject: [PATCH] Check UseRBE is set before replacing any template with the RE version. Test: presubmit Change-Id: I6df58b4e700f0d231367af2710672d731d20a736 --- apex/builder.go | 2 +- cc/builder.go | 10 +++++----- java/app_builder.go | 4 ++-- java/builder.go | 6 +++--- java/dex.go | 4 ++-- java/droiddoc.go | 2 +- java/java.go | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/apex/builder.go b/apex/builder.go index 0a1ec3eb3..27de00e5c 100644 --- a/apex/builder.go +++ b/apex/builder.go @@ -648,7 +648,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) { a.container_certificate_file, a.container_private_key_file, } - if ctx.Config().IsEnvTrue("RBE_SIGNAPK") { + if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_SIGNAPK") { rule = java.SignapkRE args["implicits"] = strings.Join(implicits.Strings(), ",") args["outCommaList"] = a.outputFile.String() diff --git a/cc/builder.go b/cc/builder.go index f2bab8cb4..bd409d503 100644 --- a/cc/builder.go +++ b/cc/builder.go @@ -579,7 +579,7 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and tidyFiles = append(tidyFiles, tidyFile) rule := clangTidy - if ctx.Config().IsEnvTrue("RBE_CLANG_TIDY") { + if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_CLANG_TIDY") { rule = clangTidyRE } @@ -605,7 +605,7 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and sAbiDumpFiles = append(sAbiDumpFiles, sAbiDumpFile) dumpRule := sAbiDump - if ctx.Config().IsEnvTrue("RBE_ABI_DUMPER") { + if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_ABI_DUMPER") { dumpRule = sAbiDumpRE } ctx.Build(pctx, android.BuildParams{ @@ -740,7 +740,7 @@ func TransformObjToDynamicBinary(ctx android.ModuleContext, "ldFlags": flags.globalLdFlags + " " + flags.localLdFlags, "crtEnd": crtEnd.String(), } - if ctx.Config().IsEnvTrue("RBE_CXX_LINKS") { + if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_CXX_LINKS") { rule = ldRE args["implicitOutputs"] = strings.Join(implicitOutputs.Strings(), ",") } @@ -783,7 +783,7 @@ func TransformDumpToLinkedDump(ctx android.ModuleContext, sAbiDumps android.Path "arch": ctx.Arch().ArchType.Name, "exportedHeaderFlags": exportedHeaderFlags, } - if ctx.Config().IsEnvTrue("RBE_ABI_LINKER") { + if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_ABI_LINKER") { rule = sAbiLinkRE rbeImplicits := implicits.Strings() for _, p := range strings.Split(exportedHeaderFlags, " ") { @@ -906,7 +906,7 @@ func TransformObjsToObj(ctx android.ModuleContext, objFiles android.Paths, "ldCmd": ldCmd, "ldFlags": flags.globalLdFlags + " " + flags.localLdFlags, } - if ctx.Config().IsEnvTrue("RBE_CXX_LINKS") { + if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_CXX_LINKS") { rule = partialLdRE args["inCommaList"] = strings.Join(objFiles.Strings(), ",") } diff --git a/java/app_builder.go b/java/app_builder.go index 014bd54f1..2a08e04c8 100644 --- a/java/app_builder.go +++ b/java/app_builder.go @@ -97,7 +97,7 @@ func SignAppPackage(ctx android.ModuleContext, signedApk android.WritablePath, u "certificates": strings.Join(certificateArgs, " "), "flags": strings.Join(flags, " "), } - if ctx.Config().IsEnvTrue("RBE_SIGNAPK") { + if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_SIGNAPK") { rule = SignapkRE args["implicits"] = strings.Join(deps.Strings(), ",") args["outCommaList"] = strings.Join(outputFiles.Strings(), ",") @@ -236,7 +236,7 @@ func TransformJniLibsToJar(ctx android.ModuleContext, outputFile android.Writabl args := map[string]string{ "jarArgs": strings.Join(proptools.NinjaAndShellEscapeList(jarArgs), " "), } - if ctx.Config().IsEnvTrue("RBE_ZIP") { + if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_ZIP") { rule = zipRE args["implicits"] = strings.Join(deps.Strings(), ",") } diff --git a/java/builder.go b/java/builder.go index 7318fcbad..3043e46db 100644 --- a/java/builder.go +++ b/java/builder.go @@ -385,7 +385,7 @@ func TransformJavaToHeaderClasses(ctx android.ModuleContext, outputFile android. "outDir": android.PathForModuleOut(ctx, "turbine", "classes").String(), "javaVersion": flags.javaVersion.String(), } - if ctx.Config().IsEnvTrue("RBE_TURBINE") { + if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_TURBINE") { rule = turbineRE args["implicits"] = strings.Join(deps.Strings(), ",") } @@ -452,7 +452,7 @@ func transformJavaToClasses(ctx android.ModuleContext, outputFile android.Writab annoDir = filepath.Join(shardDir, annoDir) } rule := javac - if ctx.Config().IsEnvTrue("RBE_JAVAC") { + if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_JAVAC") { rule = javacRE } ctx.Build(pctx, android.BuildParams{ @@ -480,7 +480,7 @@ func TransformResourcesToJar(ctx android.ModuleContext, outputFile android.Writa jarArgs []string, deps android.Paths) { rule := jar - if ctx.Config().IsEnvTrue("RBE_JAR") { + if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_JAR") { rule = jarRE } ctx.Build(pctx, android.BuildParams{ diff --git a/java/dex.go b/java/dex.go index c85914c41..15b4431db 100644 --- a/java/dex.go +++ b/java/dex.go @@ -288,7 +288,7 @@ func (d *dexer) compileDex(ctx android.ModuleContext, flags javaBuilderFlags, mi "outUsageZip": proguardUsageZip.String(), "outDir": outDir.String(), } - if ctx.Config().IsEnvTrue("RBE_R8") { + if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_R8") { rule = r8RE args["implicits"] = strings.Join(r8Deps.Strings(), ",") } @@ -304,7 +304,7 @@ func (d *dexer) compileDex(ctx android.ModuleContext, flags javaBuilderFlags, mi } else { d8Flags, d8Deps := d8Flags(flags) rule := d8 - if ctx.Config().IsEnvTrue("RBE_D8") { + if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_D8") { rule = d8RE } ctx.Build(pctx, android.BuildParams{ diff --git a/java/droiddoc.go b/java/droiddoc.go index 4c5f66c18..67892d467 100644 --- a/java/droiddoc.go +++ b/java/droiddoc.go @@ -1464,7 +1464,7 @@ func metalavaCmd(ctx android.ModuleContext, rule *android.RuleBuilder, javaVersi // Metalava uses lots of memory, restrict the number of metalava jobs that can run in parallel. rule.HighMem() cmd := rule.Command() - if ctx.Config().IsEnvTrue("RBE_METALAVA") { + if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_METALAVA") { rule.Remoteable(android.RemoteRuleSupports{RBE: true}) pool := ctx.Config().GetenvWithDefault("RBE_METALAVA_POOL", "metalava") execStrategy := ctx.Config().GetenvWithDefault("RBE_METALAVA_EXEC_STRATEGY", remoteexec.LocalExecStrategy) diff --git a/java/java.go b/java/java.go index 4d7d568ad..d7faf9f25 100644 --- a/java/java.go +++ b/java/java.go @@ -1483,7 +1483,7 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) { args := map[string]string{ "jarArgs": "-P META-INF/services/ " + strings.Join(proptools.NinjaAndShellEscapeList(zipargs), " "), } - if ctx.Config().IsEnvTrue("RBE_ZIP") { + if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_ZIP") { rule = zipRE args["implicits"] = strings.Join(services.Strings(), ",") }