aboutsummaryrefslogtreecommitdiff
path: root/apex/deapexer.go
Commit message (Collapse)AuthorAgeFilesLines
* Propagate profile_guided requirement of imports to top-level apexSpandan Das2024-01-301-0/+5
| | | | | | | | | | | | | | | | | | | | | | For prebuilts, the dexpreopt rules of system server jars are now generated from the context of the top-level prebuilt apex and not in the context of the shim java_import modules. Since `dex_preopt.profile_guided` property is defined in java_import, this needs to be bubbled up to the top-level apex. This will be done using deapxerInfo. If profile_guided of a transitive java_import is true, the deapexed .prof file will be set as dexreopter.inputProfilePathOnHost before invoking dexpreopter.dexpreopt. This ensures that only that java_import undergoes profile guided dexpreopt, and not every other transitive java_import Test: go test ./apex -run TestPrebuiltStandaloneSystemserverclasspathFragmentContents Test: lunch cf_x86_64_only_phone-next-userdebug && m $ANDROID_PRODUCT_OUT/system/framework/oat/x86_64/apex@com.android.art@javalib@service-art.jar@classes.odex Test: du -sh $ANDROID_PRODUCT_OUT/system/framework/oat/x86_64/apex@com.android.art@javalib@service-art.jar@classes.odex 24K Bug: 308790457 Change-Id: Ibf46ecb400b3f126b243fc8d27b08d9a1aa4cc97
* Use the correct bootjars when multiple prebuilt apexes existSpandan Das2023-12-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | hiddenapi and dexpreopt require boot and system server jars from apexes. When building with prebuilts, this comes via java_import/java_sdk_library_import, which acts as a hook for prebuilt_apex/apex_set. If we have multiple apexes in the tree, this hook becomes 1:many. This CL prepares dex_bootjars to select the right deapexerd .jar files when mutliple prebuilts exist. Implementation details - Update prebuilt module types (prebuilt_apex/apex_set) and source apexes to set a map of library name to dex jar path on host. - dex_bootjars will access the path of the .dex jar on host via the provider. These then copied/installed to the right locations. This CL does not drop the old mechanism to get the dex file (i.e. by creating a dep on java_library). Once all mainline modules have been flagged using apex_contributions, the old mechanism will be dropped Bug: 308790457 Test: git_master-art-host:art-gtest https://android-build.corp.google.com/builds/abtd/run/L21500030000926533 Test: git_main:art_standalone_dexpreopt_tests https://android-build.corp.google.com/builds/abtd/run/L99000030000891212 Test: Added a unit test that checks that the right .jar is selected when multiple prebuilts exists Change-Id: I6ef94135b9303a35135810930af4b641df13a583
* Convert SetProvider to generic providers APIColin Cross2023-12-141-1/+1
| | | | | | | | | Convert all of the callers of SetProvider to use the type-safe android.SetProvider API. Bug: 316410648 Test: builds Change-Id: If58f4b5355264ddab2045bc3591a4eac19cd58fc
* Remove --blkid_path argumentJooyung Han2023-06-141-1/+0
| | | | | | | | | deapexer doesn't need it. Bug: 279858383 Test: presubmit Test: m MODULE_BUILD_FROM_SOURCE=false droid Change-Id: Ie8311c74682f366cf6aeebb669500d01675cd0bf
* Fix deapexer usage in prebuilt_apex/apex_setPaul Duffin2022-12-121-0/+2
| | | | | | | | | | | | | A previous change to the deapexer script to check that blkid_path and fsckerofs_path were set broke the scripts/unpack-prebuilt-apex.sh scripts use of deapexer. This change fixes it by passing the paths through to the script which then passes it on to deapexer. Bug: 255963179 Bug: 240288941 Bug: 259958590 Test: m MODULE_BUILD_FROM_SOURCE=false droid Change-Id: Ief7f36219b7fe1cf7104c08163e10d8e39f181d0
* Consolidate the code to resolve a deapexer module dependency.Martin Stjernholm2021-09-231-2/+16
| | | | | | | | | | | It will get more logic in upcoming CLs. Add a property to DeapexerInfo for the APEX name, for use in error messages. Test: m nothing Bug: 192006406 Change-Id: I957f3df8b34543a38cde38768dac93e78132d672
* Preopt APEX system server jars from prebuilts.Jiakai Zhang2021-09-151-1/+1
| | | | | | | | | Similar to the previous CL, but for jars from prebuilts. Test: manual - 1. Patch aosp/1818020 and aosp/1810840. 2. m SOONG_CONFIG_art_module_source_build=false com.android.art Bug: 194150908 Change-Id: Idc0c73a78045a602ad3a91cb5071d291bd611015
* Simplify deapexer supportPaul Duffin2021-06-171-22/+10
| | | | | | | | | | Uses the apex relative path to the file as the identifier that is used to obtain the path to the corresponding file extracted from the apex. That is instead of a special constructed string id. Bug: 177892522 Test: m nothing Change-Id: I5dc77c8fb272bac289b8891d1eac801e541af1f5
* Export boot image files from prebuilt_apex/apex_setPaul Duffin2021-06-171-2/+2
| | | | | | | | | | | | | | | | | | Previously, the prebuilt art-bootclasspath-fragment did not provide any boot image files. That meant it was impossible to build any module that requires access to those files from prebuilts, e.g. any module that needs to be dexpreopt-ed. This change enables that module to retrieve those files from the prebuilt_apex. Bug: 177892522 Bug: 189298093 Test: m nothing m droid SOONG_CONFIG_art_module_source_build=false SKIP_BOOT_JARS_CHECK=true - the previous command does not work but this change does fix one of the issues reported. Change-Id: I1d4d9545172d79282918130df6b9aa55471bffc1
* Generalize deapexer module to export any filesPaul Duffin2021-05-101-15/+29
| | | | | | | | | | | | | | | | | | | | | Previously, the deapexer module had to duplicate the java library specific logic for constructing the path to the library's dex file in the .apex file. That is not something that the deapexer needs to be aware of, all it needs is a list of files that should be exported. This change moves that logic into the prebuilt_apex/apex_set modules and generalizes the deapexer module so that it can export any files that are requested. The deapexer module does still need to know which java modules need access to exported files so it can add dependencies from them onto itself. However, it does not need to know what the type of the module is. Bug: 186455808 Test: m nothing m SOONG_CONFIG_art_module_source_build=false nothing Change-Id: I71c6f0f761efe3b6d66d54273786e98cd545811c
* Add exported_bootclasspath_fragments to prebuilt_apex/apex_setPaul Duffin2021-04-231-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | This is needed to allow a prebuilt_bootclasspath_fragment to be used interchangeably with a bootclasspath_fragment in the platform_bootclasspath module. The platform_bootclasspath module depends on APEX specific variants of bootclasspath_fragment modules. That works because the bootclasspath_fragment modules are part of an apex and so have an APEX specific variant which the platform_bootclasspath can specify. Using a prebuilt_bootclasspath_fragment in place of a bootclasspath_fragment requires that the prebuilt also has an APEX specific variant. Specifying exported_bootclasspath_fragments on a prebuilt_apex/apex_set will cause it to create an APEX variant for the named module whcih will allow it to be selected by the platform_bootclasspath module. Bug: 186034565 Bug: 177892522 Test: m nothing Change-Id: I7ddacc6498ec3a4a9f26c5f78b7f9a033e494d78
* Separate apex selection from apex.PrebuiltPaul Duffin2021-04-071-7/+13
| | | | | | | | | | | | | | | | | | This dedups the apex selection (which was previously being done by both the apex.Prebuilt module type and the Deapexer module type) by separating it out into its own module. The apex.Prebuilt module retrieves the selected apex from its selected_apex property which is simply initialized with ":<selector-module-name>". The Deapexer module retrieves the selected apex it should use from its src property which is initialized in the same way. That makes it easy for the Deapexer module to be reused by the apex_set in a similar way. Bug: 181267622 Test: m droid Change-Id: I90cfb55698d35a97dcf28b95afcb1f58584bc90c
* Stop deapexer module type from being treated as a prebuiltPaul Duffin2021-04-071-11/+1
| | | | | | | | | | | | | | | | Previously, the private deapexer module type was treated as a prebuilt as that was the quickest way to implement it. However, there is no reason why it should be as there is no corresponding source module type which it might replace. This change removes the prebuilt support to simplify the module type in preparation for future work. As part of that it extracts the logic for retrieving a single path from a PrebuiltSrcsSupplier to ensure consistent behavior. Bug: 181267622 Test: m droid Change-Id: I1b2bb49601c13a3fff99a0026c235eaa70d2e612
* Remove deapexer and prebuilt apex select mutatorsPaul Duffin2021-03-011-11/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally, when the prebuilt_apex was first created, it selected the source to use in its DepsMutator. It did that because that was a convenient place for it to perform that work which had to be: * After the arch mutator had run so MultiTargets() was available. * Before the prebuilt_select mutator runs as that relied on the Source property to have been set. Change 064b70c9 then duplicated the call from the DepsMutator of the deapexer module type that was added as part of the work to make dex files available for hiddenapi processing. Change 356f7d45 moved it out of the the DepsMutator methods into its their own mutators, presumably because it interfered with the Soong -> Bazel conversion work. This change improves the existing PrebuiltSrcsSupplier mechanism to support reporting errors so that the logic for selecting the source can be done on demand rather than in separate mutators. The main complication was that PrebuiltSrcsSupplier is called with a BaseModuleContext for both source and prebuilt modules so it cannot use any methods on it that are related to the current module. That necessitated adding MultiTargets() to android.Module. Bug: 181267622 Test: m droid Change-Id: I106c78fd21016f051a315b82b470d8f12b1f820b
* bp2build: convert paths/module refs to Bazel labelLiz Kammer2021-02-041-2/+7
| | | | | | | | | | | This currently expands all globs, still need to support converting glob syntax. Test: go build_conversion_test Test: GENERATE_BAZEL_FILES=true m nothing Test: m nothing Bug: 165114590 Change-Id: If7b26e8e663d17566fad9614ca87a8da1f095284
* Export dex implementation jars from prebuilt_apexPaul Duffin2021-01-151-0/+139
Dexpreopt and boot jars package check all require access to dex implementation jars created for java_library and java_sdk_library. They were available when building from source but not when building from prebuilts, even though they are embedded within the .apex files that are referenced from prebuilt_apex. This changes adds support to prebuilt_apex to export the dex implementation jars and updates java_import to use those exported dex implementation jars. In a source build dexpreopt/boot jars package check access the apex (or platform) specific variant of a java_library, e.g. core-oj, from which it retrieves the dex implementation jar path. After this change in a prebuilt build dexpreopt/boot jars package check behave in the same way except in this case they retrieve the dex implementation jar path from the apex (or platform) specific variant of the java_import, e.g. core-oj. The work to export files from a `.apex` file for use by other modules is performed by a new `deapexer` module type. It is not used directly in an `Android.bp` file but instead is created implicitly by `prebuilt_apex`, In order to do that this contains the following changes: * Adds a new `dexapexer` module type to handle the exporting of files from the `.apex` file. * Adds an exported_java_libs property to prebuilt_apex to specify the set of libraries whose dex implementation jars need exporting. * Creates apex specific variants of the libraries listed in the exported_java_libs property. * Adds the set of exported files to the ApexInfo to make them available to the apex specific variants. * Prevents the prebuilt_apex variants from being merged together as they will not be compatible. * Modifies java_import to use the exported file for variants of a prebuilt_apex. * Adds a ninja rule to unpack (using deapexer) the contents of the prebuilt_apex's apex file, verify that the required files are present and make them available as outputs for other rules to use. * Some minor refactorings to support these changes. * Adds tests to cover prebuilt only, prebuilt with source preferred, and prebuilt preferred with source. Test: m nothing Bug: 171061220 Change-Id: Ic9bed81fb65b92f0d59f64c0bce168a9ed44cfac