From 9decf834ce398e7bee3bf5210b5fb7796a49e342 Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Tue, 11 Jun 2024 11:45:53 -0700 Subject: [PATCH] Only generate kythe xrefs on the primary module Currently the kythe build is hitting the 6 hour timeout, but we're generating kythe files for all variants. Generating them only for the primary variant should drastically cut its runtime. Bug: 345440993 Test: Presubmits Change-Id: I3846b25c7f0bc22153e4f0a0cb81c5015854dd70 --- cc/builder.go | 4 ++-- java/base.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cc/builder.go b/cc/builder.go index 7a3394a4d..8719d4f87 100644 --- a/cc/builder.go +++ b/cc/builder.go @@ -485,7 +485,7 @@ func transformSourceToObj(ctx ModuleContext, subdir string, srcFiles, noTidySrcs coverageFiles = make(android.Paths, 0, len(srcFiles)) } var kytheFiles android.Paths - if flags.emitXrefs { + if flags.emitXrefs && ctx.Module() == ctx.PrimaryModule() { kytheFiles = make(android.Paths, 0, len(srcFiles)) } @@ -664,7 +664,7 @@ func transformSourceToObj(ctx ModuleContext, subdir string, srcFiles, noTidySrcs }) // Register post-process build statements (such as for tidy or kythe). - if emitXref { + if emitXref && ctx.Module() == ctx.PrimaryModule() { kytheFile := android.ObjPathWithExt(ctx, subdir, srcFile, "kzip") ctx.Build(pctx, android.BuildParams{ Rule: kytheExtract, diff --git a/java/base.go b/java/base.go index b4f800bbd..1a6584bfb 100644 --- a/java/base.go +++ b/java/base.go @@ -1852,7 +1852,7 @@ func (j *Module) compileJavaClasses(ctx android.ModuleContext, jarName string, i classes := android.PathForModuleOut(ctx, "javac", jarName).OutputPath TransformJavaToClasses(ctx, classes, idx, srcFiles, srcJars, annoSrcJar, flags, extraJarDeps) - if ctx.Config().EmitXrefRules() { + if ctx.Config().EmitXrefRules() && ctx.Module() == ctx.PrimaryModule() { extractionFile := android.PathForModuleOut(ctx, kzipName) emitXrefRule(ctx, extractionFile, idx, srcFiles, srcJars, flags, extraJarDeps) j.kytheFiles = append(j.kytheFiles, extractionFile)