From 0727ba76b11f8387797a2d412c0b1c415d2d4468 Mon Sep 17 00:00:00 2001 From: Spandan Das Date: Tue, 13 Feb 2024 16:37:43 +0000 Subject: Disable dexpreopt if optional_uses_libs does not have an impl At ToT, an optional_uses_libs is not added to the build time CLC if it does not exist in the tree. One edge case here is java_sdk_library_import, which might exist in the tree, but without an implementation. This cause issues during analysis when we try to verify the correctness of the build time CLC. This CL disables dexpreopt if a dependency does not have an implementation. To limit inadvertent side effects, this is restricted to java_sdk_library(_import) module types. (more precisely, it is restricted to java_sdk_library_import, since the source module type will always have an impl) Bug: 315802285 Test: Added a unit test Test: m nothing Test: printf debugging in internal main, verified that this CL does not disable dexpreopt on any android app inadvertently Change-Id: I173fc2f3ff654fe4091e9a43322164afd3222ee7 --- java/java.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'java/java.go') diff --git a/java/java.go b/java/java.go index d7d271cca..576b73b68 100644 --- a/java/java.go +++ b/java/java.go @@ -719,6 +719,9 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) { setUncompressDex(ctx, &j.dexpreopter, &j.dexer) j.dexpreopter.uncompressedDex = *j.dexProperties.Uncompress_dex j.classLoaderContexts = j.usesLibrary.classLoaderContextForUsesLibDeps(ctx) + if j.usesLibrary.shouldDisableDexpreopt { + j.dexpreopter.disableDexpreopt() + } } j.compile(ctx, nil, nil, nil) -- cgit v1.2.3-59-g8ed1b