From e21a8d4dc6ef36c7de97254e40acfd389e887a2d Mon Sep 17 00:00:00 2001 From: Spandan Das Date: Tue, 23 Jan 2024 23:56:29 +0000 Subject: Fix the args used to dexpreopt system server jars in prebuilt apexes For prebuilts, java.dexpreopt gets called twice 1. in the context of the top-level prebuilt apex 2. in the context of the java_library shim Only the artifacts of (1) get installed. The artifacts generated by 2) are unused. However the args used to generate the artifacts of (1) are incorrect. It uses moduleName(ctx) to do special-handling of apex system server jars. This special-handling does not happen in (1), so although dexpreopt artficats get generated, they get generated with the wrong args. To fix this, add an additional parameter in java.dexpreopt to pass the libraryName explicitly. Details - Delete moduleName function. This was used to determine the java library name, which is no longer safe - Add a libraryName parameter to java.dexpreopt - Most module types will use j.Name() as libraryName - prebuilt_apex and apex_set will iterate over its `contents` and use each element as libraryName when invoking java.dexpreopt With the correct args passed from (1), we can drop j.dexpreopt from (2) completely. Dropping (2) also breaks profile guided dexpreopt tests. These currently operate on (2). They will be moved to (1) in the next CL of this stack. Test: presubmits Test: lunch cf_x86_64_auto-trunk_staging-userdebug && m nothing (this was a postsubmit failure with aosp/2923733) Test: art_standalone_dexpreopt_tests on next https://android-build.corp.google.com/builds/abtd/run/L86000030001579256 Test: art-gtest on git_master-art-host https://android-build.corp.google.com/builds/abtd/run/L07800030001550262 Bug: 308790457 Bug: 322255144 Change-Id: I8eb604c82f1fa5289d3cd1a20084d56e4d7485e3 --- apex/bootclasspath_fragment_test.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'apex/bootclasspath_fragment_test.go') diff --git a/apex/bootclasspath_fragment_test.go b/apex/bootclasspath_fragment_test.go index f1e71b05c..778c20a56 100644 --- a/apex/bootclasspath_fragment_test.go +++ b/apex/bootclasspath_fragment_test.go @@ -316,6 +316,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) { java.CheckModuleDependencies(t, result.TestContext, "com.android.art", "android_common_com.android.art", []string{ `art-bootclasspath-fragment`, `com.android.art.key`, + `dex2oatd`, }) // Make sure that the source bootclasspath_fragment copies its dex files to the predefined @@ -387,6 +388,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) { java.CheckModuleDependencies(t, result.TestContext, "com.android.art", "android_common_com.android.art", []string{ `art-bootclasspath-fragment`, `com.android.art.key`, + `dex2oatd`, `prebuilt_com.android.art`, }) @@ -650,6 +652,7 @@ func TestBootclasspathFragmentContentsNoName(t *testing.T) { }) java.CheckModuleDependencies(t, result.TestContext, "myapex", "android_common_myapex", []string{ + `dex2oatd`, `myapex.key`, `mybootclasspathfragment`, }) -- cgit v1.2.3-59-g8ed1b