aboutsummaryrefslogtreecommitdiff
path: root/apex/bootclasspath_fragment_test.go
AgeCommit message (Collapse)Author
2022-01-28Allow installing boot images outside of APEX for prebuilt.Jiakai Zhang
This change is similar to aosp/1947127, but for prebuilts. After this change, if `bootImageConfig.installDirOnDevice` is set to a path outside of the APEX, the build system will build a boot image from the dex files and the profile extracted from the prebuilt APEX. Otherwise, it keeps the current behavior: extracting the boot image from the prebuilt APEX. This is a no-op change. Current behavior is not affected. Bug: 211973309 Test: m nothing Test: - On internal master: 1. Patch aosp/1947128. 2. Patch ag/16743847 and ag/16746804. 3. m SOONG_CONFIG_art_module_source_build=false com.google.android.art 4. See the boot image being installed in `/system/framework/<arch>`. Change-Id: I24ca525309fecaf3ab7a67960fbf118cd00ecd1d
2022-01-13Allow installing boot images outside of APEX.Jiakai Zhang
After this change, `bootImageConfig.installDirOnDevice` can be set to a path outside of the APEX, in which case, the boot image will not be installed in the APEX. Instead, it will be installed to the given path by Make. This is a no-op change. Current behavior is not affected. Bug: 211973309 Test: m nothing Test: - 1. m com.android.art 2. See the boot image still being installed in the ART APEX. Test: - 1. Change `installDirOnDevice` of the ART boot image config to `system/framework`. 2. See the boot image being installed in `/system/framework/<arch>`. Change-Id: Ib13b17cc9e94dc5754c9b51b04df3307323b8783
2021-12-14Test that `DisableGenerateProfile` takes effects for APEXes.Jiakai Zhang
Bug: 209630530 Test: m nothing Change-Id: I5953f36e219ba63f8a01fa5dc60456db35eef5ac
2021-12-07Do not allow duplicate deapexer dependencies.Martin Stjernholm
Without these errors, the last encountered deapexer would silently be used. However with PRODUCT_INSTALL_APEXES there will only be deapexer for installable APEXes, and we can assume only a single installable APEX exists for each APEX variant, so make it an error if it isn't the case. Corresponding to http://ag/15156931. Test: m nothing SOONG_CONFIG_art_module_source_build=true Test: m nothing SOONG_CONFIG_art_module_source_build=false Test: m nothing SOONG_CONFIG_art_module_source_build=false with installable:true for the com.android.art.debug prebuilt APEX - check that it fails with an "ambiguous duplicate deapexer" error Bug: 192006406 Bug: 192542393 Change-Id: I44566fd26b12f82a8a67fe4a69e56303460756d0
2021-12-03Add ART boot image profile to the ART APEX.Jiakai Zhang
We will need the profile when we generate the primary boot image on device. Bug: 203492478 Test: Run `banchan com.android.art x86_64 && m` and see `$ANDROID_PRODUCT_OUT/apex/com.android.art/etc/boot-image.prof`. Test: Run `lunch aosp_cf_x86_64_phone-userdebug && m` and see both `$ANDROID_PRODUCT_OUT/apex/com.android.art/etc/boot-image.prof` and `$ANDROID_PRODUCT_OUT/system/etc/boot-image.prof`, in different sizes. Test: Start Cuttlefish with the built image and see both `/apex/com.android.art/etc/boot-image.prof` and `/system/etc/boot-image.prof` on device. Change-Id: Id879dc49b234133dfbb9563814328661a1f4a6c0
2021-09-23Propagate the dex jar path as an OptionalPath which is either valid orMartin Stjernholm
invalid with a message. This will allow propagating any error from the deapexer module for prebuilt APEXes to the location where the dex jars get used. It's only at those points that we can raise errors about not being able to extract files from the deapexer modules if they are invalid, and this way we avoid encoding knowledge there about why they may be invalid. To keep the refactoring limited it intentionally does not change any of the existing logic for when dexJarFiles are set or not (non-nil vs nil prior to this change), although there may be opportunity to use this for more conditions when dex jars aren't available. The refactoring is also not extended to dexpreopt.ClassLoaderContextMap. Test: m nothing Bug: 192006406 Change-Id: I68986dccd9a9b3fee4d24caa1947ea17a36caedc
2021-08-10Fix tests to use correct fixtures for configuring (Apex)BootJars.satayev
This is in preparation to r.android.com/1740313 where setting correct variables would be enforced (i.e. apex and non-apex boot jars must be in config.ApexBootJars and config.BootJars correspondingly). Bug: 191369843 Test: m nothing Change-Id: Ic86680c1f7af53d229083b2cc58beb3ceccb4b6a
2021-07-26Merge "Rename UpdatableBootJars to ApexBootJars."satayev
2021-07-22Rename UpdatableBootJars to ApexBootJars.satayev
Note that ART apex boot jars and core-icu4j are exceptions here as they are not part of ApexBootJars. ART apex boot jars are defined in their own variable, while core-icu4j is treated as a regular non-updatable boot jar. Bug: 191127295 Test: atest CtsClasspathsTestCases Change-Id: I3cea3d82ef521655a1a5ffa8cae2258ab9d08bfc
2021-07-20Require prebuilt_bootclasspath_fragment to provide hidden API filesPaul Duffin
Previously, the prebuilt_bootclasspath_fragment was not required to provide hidden API files as not all usages of that module provided them. That should no longer be the case so this change makes the prebuilt_bootclasspath_fragment stricter and so now always require them. Bug: 194063708 Test: m out/soong/hiddenapi/hiddenapi-flags.csv - check that this does not change the contents. Change-Id: I3f19a1b4246f09a927c0f6b0f41b8678150d6cc2
2021-06-28Calculate widest stub dex jars per modulePaul Duffin
Previously, the stub dex jars for each HiddenAPIScope was created by merging the stub dex jars provided by each module for that scope. Then the widest stub dex jars were chosen. So, if module A provided public, system and test stub dex jars and module B provided only public then the stub dex jars for each scope would be: * public -> A,B * system -> A * test -> A So, the widest API scope for which there are stub dex jars is "test" and so the widest stub dex jars would just come from module A and not module B. So, when "hiddenapi list" is run for module C which depends on modules A and B it only gets given stub dex jars for module A which means that it cannot resolve all the types that C may use which can lead to incorrect flags being generated. This change does not merge the stub dex jars from each module together and instead keeps them separate by module. The widest stub dex jars list is constructed by asking each module in turn for their widest stub dex jars. e.g. Given the above example we would have: Module A: * public * system * test <- widest Module B: * public <- widest So, the widest stub dex jars will be A's test and B's public stub dex jars. Bug: 179354495 Test: m out/soong/hiddenapi-flags.csv - make sure that this does not change the file. Change-Id: Ib137825ebffe94b2bf220732bae6077f7b7ac6db
2021-06-25Support hidden API processing for modules that use platform APIsPaul Duffin
Previously, hidden API processing could only be done by those bootclasspath_fragment modules that either did not depend on any other fragments (e.g. art-bootclasspath-fragment) or only depended on APIs provided by other fragments (e.g. i18n-bootclasspath-fragment). That meant that modules like com.android.os.statsd-bootclasspath-fragment that depended on APIs provided by parts of the platform which are not yet part of another bootclasspath_fragment could not perform hidden API processing. This change adds support for a bootclasspath_fragment to specify the additional stubs needed to perform hidden API processing. It adds a new additional_stubs property that can be used to specify the additional stub libraries. Most bootclasspath_fragments that need to use the property will need access to the APIs provided by the android-non-updatable.* libraries. Rather than have each fragment explicitly specify the correct module for each scope it treats "android-non-updatable" as if it was a java_sdk_library that can provide different jars for each scope. Soong will handle mapping that to the correct android-non-updatable.* module. Bug: 179354495 Test: m out/soong/hiddenapi/hiddenapi-flags.csv \ out/soong/hiddenapi/hiddenapi-index.csv \ out/soong/hiddenapi/hiddenapi-stub-flags.txt \ out/soong/hiddenapi/hiddenapi-unsupported.csv - make sure that this change does not change the contents. m TARGET_BUILD_APPS=Calendar nothing Change-Id: Ia8b79830ed0e6d42100de03d76b0c51b7f6c8ade
2021-06-24Add ModuleLibHiddenAPIScope for hidden API processingPaul Duffin
Although the hidden API runtime does not support a module-lib API flag the hidden API processing does need to used them as they are needed by the "hiddenapi list" tool for any bootclasspath_fragment module whose contents builds against an sdk_version of "module_current". Without it the "hiddenapi list" tool could fail to resolve references to classes provided by other modules which would break the build. Bug: 179354495 Test: m out/soong/hiddenapi/hiddenapi-flags.csv - make sure that this change has no effect on the generated flags. Change-Id: I3ecb80fdaeba0e66d1ee25cb57152ab546d9bfe0
2021-06-24Add test for modular hiddenapi list rulePaul Duffin
Adds a test to establish a baseline for a follow up change that adds module_lib support to hidden API processing. Bug: 179354495 Test: m nothing Change-Id: I5630075825c674b2e4f38bd459c7b061c01fc362
2021-06-24Add HiddenAPIScope to replace use of SdkKindPaul Duffin
Previously, the hidden API processing used SdkKind to identify the API scopes, e.g. public, system, etc. that are of interest for hidden API processing. Unfortunately, there is a mismatch between the SdkKind and what hidden API processing needs. e.g. SdkKind includes values that are not used by hidden API processing and hidden API processing needs additional API scope specific information not provided by SdkKind. The apiScope struct used in sdk_library.go is also not a suitable representation for similar reasons. This change adds the HiddenAPIScope (following a similar approach as apiScope) that rectifies that and uses it as a replacement for SdkKind in most parts of the hidden API processing. The SdkKind is still used for retrieving information from java_sdk_library[_import] modules. Follow up changes will extend the HiddenAPIScope with more information. Bug: 179354495 Test: m out/soong/hiddenapi/hiddenapi-flags.csv - make sure that this change has no effect on the generated flags. Change-Id: I97968f58535121652852b8d25217aa288afd2bfd
2021-06-17Export boot image files from prebuilt_apex/apex_setPaul Duffin
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
2021-06-17Copy boot dex jars from prebuilt art-bootclasspath-fragment if preferredPaul Duffin
Previously, the boot dex jars were only copied to the predefined locations used by the build from the source art-bootclasspath-fragment if it was preferred, otherwise no files were copied. That caused build failures when attempting to build with ART prebuilts. This change copies the files from prebuilts too. 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: I35b37355170546daf6ecac2134d1ca9a73d0e3bc
2021-06-17Combine hidden API encoding with flag generationPaul Duffin
Previously, the rules to perform hidden API encoding were generated separately to the rules to perform hidden API flag generation. This change combines them within the (renamed) produceHiddenAPIOutput() method and makes the paths to the encoded dex files an output of the generateHiddenAPIBuildActions method alongside the paths to the generated flag files. As encoded dex jars are now an output of the produceHiddenAPIOutput() method which is implemented for both prebuilts and source bootclasspath_fragment modules that necessitated the prebuilt also providing paths to encoded dex files. That in turn required updates to some of the tests to provide dex files from prebuilt_apex modules. Similarly, as the produceHiddenAPIOutput() method may not be called for some bootclasspath_fragment modules as they do not yet provide all the information needed to perform hidden API encoding then it is necessary to extract the encoded dex files produced by the modules themselves. That also required a few changes to tests that did not previously provide dex files. Bug: 177892522 Test: m com.android.art - check that this change does not change the contents of the apex file, i.e. is byte-for-byte identical. Change-Id: I60996a34d06ed1c87ed244ab3509621999ad86ec
2021-06-16Create APEX variant for prebuilt_apex/apex_setPaul Duffin
Previously, the prebuilt_apex/apex_set did not have an apex specific variant created which meant that they depended upon the platform variant of the modules it depended upon. This change creates an apex variant for them just as is done for the apex module type which causes it to depend upon the apex specific variant of the modules it depends upon. Test: m droid Bug: 179354495 Change-Id: I7d6f3609c267b3e90b90b9befe7d76f351a0c2bd
2021-05-25Merge "Rename generate proto config file to match classpath type."satayev
2021-05-24Only export boot image files to APEX if they are actually createdPaul Duffin
Previously, the generation of the rules to create the boot image files was separate from the code to provide those files to the APEX which meant that it was possible for the APEX to try and use files that had no rules to create them. This changes avoids that by only exporting the files once the rules have been created. This necessitated a few changes to tests that were relying on the previous behavior. Including removing completely the test that used an image_name: "boot" as that is no longer a valid configuration name as its functionality has been replaced by platform_bootclasspath. A follow up change will make the validation of the properties of bootclasspath_fragment stricter to prevent "boot" being used as the image_name. Bug: 177892522 Bug: 188680624 Test: lunch qemu_trusty_arm64-userdebug m droid dist - verify that before this change it fails and after this change it works. m com.android.art - verify that this change does not change the APEX contents with either qemu_trusty_arm64-userdebug or aosp_arm64-userdebug Change-Id: I0497a151eb0731cbe6a1a7e7bbbb1e4dda75898f
2021-05-24Support hidden API processing for fragments with dependenciesPaul Duffin
Previously, a bootclasspath_fragment that depended on classes provided by another bootclasspath_fragment did not support hidden API processing as it would not supply information about those dependencies. This change adds support for that as follows. Each fragment: 1. Exports the transitive sets of stub dex jars for each of the public, system, test and core_platform APIs (where relevant). 2. Adds dependencies onto its dependent fragments. 3. Retrieves the API stubs dex jars from its dependent fragments and passes them to the "hiddenapi list" tool which will use them to resolve dependencies but will not output them to the generated flags. Once the flags are generated the existing encoding functionality encodes the flags into the dex files of the bootclasspath_fragment's content modules which are then packaged into the apex. Bug: 179354495 Test: m com.android.sdkext - verify that this does not change the contents of the apex files Change-Id: I3e82a6dbb437f1e417e5d7e25aeb212e378603d0
2021-05-24Rename generate proto config file to match classpath type.satayev
There is no need to leak soong module names. Bug: 180105615 Test: m && launch_cvd; atest CtsClasspathsTestCases Change-Id: I04f4e181d2f42b9d71641980a2c7c4e8cbc8e426
2021-05-23Perform hidden API encoding in bootclasspath_fragmentPaul Duffin
Previously, the apex content info was populated with hidden API encoded dex jars retrieved directly from the java module. This change retrieves the unencoded dex jars from the java module, encodes them and then stores the result in the apex content info. Bug: 179354495 Test: m com.android.art com.android.ipsec com.android.os.statsd com.android.conscrypt - verify that this does not change the contents of the apex files Change-Id: Ib1b6eb8b62ac50e03b9e0d07c877ca70bb6f6d25
2021-05-19Store dex jar paths in bootclasspath_fragment's apex content infoPaul Duffin
Previously, the DexBootJarPathForContentModule(module) simply called directly through to the module to retrieve the dex jar path. This change changes it so the bootclasspath_fragment retrieves the dex jars from the module and stores them in the info structure for this method to retrieve directly. This makes it easier for the bootclasspath_fragment to stop retrieving hidden API encoded dex jars from the module and perform the encoding itself. Bug: 179354495 Test: m com.android.art com.android.ipsec com.android.os.statsd com.android.conscrypt - verify that this does not change the contents of the apex files Change-Id: Ic79dea080f10f4017f1a75d6d1fb5a3bfe04c2ce
2021-05-19Test dex jar paths provided to apex by bootclasspath_fragmentPaul Duffin
This change adds a test to verify the existing behavior to provide a baseline against which following changes can be compared. Bug: 179354495 Test: m nothing Change-Id: Ib7dadf3e65151f4e925251f7b1a9c099e824ea63
2021-05-11Generate empty classpaths.proto for bootclasspath_fragment.go.satayev
- Adds all required details for bootclasspath_fragment to implement classpath_fragment. - Keeps the actual boot jars in platform-bootclasspath to begin with. - Makes sure to put the file in apex/etc/classpath on device. Note that for platform versions of classpath fragment AndroidMkEntries perform the installation, while for APEXes it must be plumbed via apex.go. Bug: 180105615 Test: m && launch_cvd; atest CtsClasspathsTestCases Change-Id: I6101ebdf5b8bcbe95c0b7ce21f3f67a2685aef50
2021-04-30Move configuration checks from getBootImageJarPaul Duffin
The getBootImageJar function will be removed once the boot image creation has been moved to the platform_bootclasspath and bootclasspath_fragment module types. However, the consistency checks that it performs are still useful so this change moves them out first. The ART boot image related checks are now performed in the bootclasspath_fragment module type. A previous change accidentally disabled the checks when the contents property was not empty which has been fixed. Also, the error messages have been tweaked to make it clear that the art-bootclasspath-fragment is now the source of truth as to its contents not the configuration. The framework boot image related checks are now performed in the platform_bootclasspath module type. Initially, this change included an extra check to make sure that UpdatableBootJars comes from updatable APEXes but that broke because framework-wifi and framework-tethering are not currently marked as updatable in AOSP. Bug: 177892522 Test: m nothing Change-Id: I80fb600fa2c7cec4566b3461c6a33c4c6f0743f4
2021-04-26Allow contents and image_name to be specified togetherPaul Duffin
Previously, only one of the contents or image_name properties could be specified at once which meant that there was no way to create a prebuilt which lists its fixed contents while at the same time allowing it to check that that the contents matched what the build configuration required. e.g. a prebuilt_bootclasspath_fragment that had image_name: "art", could not list its contents and also check that those contents matched the ART_APEX_JARS which the build configuration required. This change allows contents and image_name to be specified together and adds a check to make sure that the contents are consistent with the configuration appropriate to the image_name. The check is only performed for modules that are active so that a prebuilt_bootclasspath_fragment which was created without coverage enabled (the default) would not cause a build failure in a coverage build unless it was preferred. Bug: 177892522 Test: m nothing Change-Id: Ie601f29f707b3f6030fa7d252afa2c4826cc9f8e
2021-04-26Rename BootImageInfo to BootclasspathFragmentApexContentInfoPaul Duffin
Currently, it only contains ART boot image related information, i.e. .art, .oat and .vdex files. However, follow up changes will extend that to include other information from bootclasspath_fragment. Bug: 177892522 Test: m nothing Change-Id: I2b226131c0eccff0c739a18f265f90caa10a91d9
2021-04-23Rename BootImageModule to BootclasspathFragmentModulePaul Duffin
Also renames files, tests, module types in a similar fashion. There are still some references to image and boot image. They are kept for the following reasons: * image_name - this is the name of an ART boot image, i.e. the collection of .art/.oat/.vdex files. * BootImageInfo - again this is related to the ART boot image. * .../art_boot_images/... paths - ditto. Bug: 177892522 Test: m nothing Change-Id: Ie1f4738061d131fee75de48bc26a7601481bad4d