From a62d9563b4c29be9476c2d162f55930957754e25 Mon Sep 17 00:00:00 2001 From: Spandan Das Date: Tue, 6 Aug 2024 00:13:31 +0000 Subject: [PATCH] Disable ResourceProcessorBusyBox in kythe builds ResourceProcessorBusyBox generates the R.jar binary from R.txt without creating an intermediate R.srcjar file. Disable this behavior in kythe builds (ctx.Config().EmitXrefRules()) to support xrefs to R imports Test: XREF_CORPUS=$internal_corpus m nothing Test: aninja -t query out/soong/.intermediates/frameworks/libs/systemui/animationlib/animationlib_tests/android_common/animationlib_tests.kzip Test: verified that an R.srcjar is present in its deps Bug: 354854007 Change-Id: I2d63c3393c5bc58103c267c4593172ce77fbc79c --- java/aar.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/java/aar.go b/java/aar.go index b69b7c262..f8375b23e 100644 --- a/java/aar.go +++ b/java/aar.go @@ -166,7 +166,11 @@ func propagateRROEnforcementMutator(ctx android.TopDownMutatorContext) { func (a *aapt) useResourceProcessorBusyBox(ctx android.BaseModuleContext) bool { return BoolDefault(a.aaptProperties.Use_resource_processor, ctx.Config().UseResourceProcessorByDefault()) && // TODO(b/331641946): remove this when ResourceProcessorBusyBox supports generating shared libraries. - !slices.Contains(a.aaptProperties.Aaptflags, "--shared-lib") + !slices.Contains(a.aaptProperties.Aaptflags, "--shared-lib") && + // Use the legacy resource processor in kythe builds. + // The legacy resource processor creates an R.srcjar, which kythe can use for generating crossrefs. + // TODO(b/354854007): Re-enable BusyBox in kythe builds + !ctx.Config().EmitXrefRules() } func (a *aapt) filterProduct() string {