summaryrefslogtreecommitdiff
path: root/java/testing.go
AgeCommit message (Collapse)Author
2024-07-26pass read new storage parameter to java codegen Zhi Dou
When RELEASE_READ_FROM_NEW_STORAGE is true, enable reading from new storage. So that we can ensure nextfood is not impacted. Test: m and check cf Bug: 349874828 Ignore-AOSP-First: the previous change ag/26821089 submitted internally this one depends on that change. The added code will be removed after test mission Change-Id: I95ad9457e6d9c07a5a5b3074045a383f004113a9
2024-07-23Pass config files to metalava Paul Duffin
Adds a filegroup "metalava-config-files" whose contents are passed to Metalava using the `--config-file` option. Bug: 354699349 Test: m checkapi Change-Id: I1e246517c2ef678e41214c975aecee97f9faca67
2024-04-18Convert apex mutator to a TransitionMutator Colin Cross
Replace the apex mutator with a TransitionMutator. Requires moving the base.apexInfo value into a provider so that it is still present for the Mutate pass. Test: go test ./... Test: no change to out/soong/build-${TARGET_PRODUCT}.ninja Change-Id: I1c898eaf30b4021f0f96f439cc0b3b3173710fc7
2024-02-28Enable non-"everything" stubs generation in java_api_library Jihoon Kang
This change adds support to generate non-"everything" (i.e. "runtime" and "exportable") stubs in java_api_library, which generates the stubs from the api signature files. Unlike droidstubs module that generates "everything", "exportable" and "runtime" stubs in a single module, java_api_library generates a single set of stubs per module, which is set by the default-"everything" property `stubs_type`. This is because java_api_library is responsible for both generation and the compilation of the stubs srcjar, and compilation of the stubs srcjar are done in separate java_library modules for from-source stubs. Utilization of this feature will be done in a follow up change that generates the "exportable" java_api_library modules in java_sdk_library. Test: m nothing --no-skip-soong-tests Bug: 318009570 Change-Id: I1051544ac3bcdb3ba1f78bfec28eba4e9fad9c2d
2024-01-12Enable hiddenapi check for exportable stubs Jihoon Kang
This change modifies the dependencies of the hiddenapi to always depend on the exportable stubs, instead of the currently utilized everything stubs. To support this, the full api surface exportable stubs are defined in a separate change at the `frameworks/base` project. Note that the full api surface exportable stubs are only used for the hiddenapi purpose, and `sdk_version` continues to utilize the currently existing everything stubs. Currently, this feature is hidden behind the build flag "RELEASE_HIDDEN_API_EXPORTABLE_STUBS". This feature will be fully enabled once metalava fully supports handling of the flagged apis. Test: ENABLE_HIDDENAPI_FLAGS=true m Bug: 317426356 Change-Id: I109b7cd27b20ceffcdf1766ab8106b0c276be2b3
2023-12-19Use the correct prof file when multiple prebuilt apexes exist Spandan Das
Generating boot image requires a .prof file provided by the ART apex. When building with prebuilts, this comes via the prebuilt_bootclasspath_fragment module, which acts as a shim for prebuilt_apex/apex_set. If we have multiple prebuilt apexes in the tree, this shim becomes 1:many. This CL prepares dex_bootjars to select the right .prof file when multiple prebuilts exist. Implementation details - Update deps mutator of dex_bootjars to create a dep on all_apex_contributions. The latter contains information about which apex is selected in a specific release configuration. dex_bootjars will create a dependency on the selected apex in a postdeps phase mutator. - All apex module types (apex, prebuilt_apex and apex_set) will set a provider that contains info about the location of the .prof file on host - dex_bootjars will access the provider of the selected apex to get the location of the .prof file This CL does not drop the old mechanism to get the .prof file (i.e. by creating a dep on {prebuilt_}bootclasspath_fragment). Once all mainline modules have been flagged using apex_contributions, the old mechanism will be dropped Bug: 308790457 Test: Added a unit test that checks that the right .prof is selected when multiple prebuilts exists Change-Id: I40fdb21416c46bed32f6ff187ce5153711ec2c69
2023-12-14Convert ModuleProvder to generic providers API Colin Cross
Convert all of the callers of ModuleProvider/ModuleHasProvider to use the type-safe android.SingletonModuleProvider API. Bug: 316410648 Test: builds Change-Id: I6f11638546b64749e451cebbf33140248dc1d193
2023-11-01Remove sdkPreSingleton and overlaySingleton Cole Faust
These were the only 2 pre-singletons in soong. sdkPreSingleton is totally unused. overlaySingleton can be done during GenerateAndroidBuildActions instead. Test: m nothing --no-skip-soong-tests Change-Id: Ieb5ab92f18cb56be4049c0842f61df8aa02dc52c
2023-10-11Utilize module lib and test api superset module in hiddenapi Jihoon Kang
Hiddenapi takes a single widest api scope stub dex jar as an input, as the tool does not support handling duplicate classes passed as inputs. A problem regarding this is that the test and module lib api surfaces do not strictly have a subset/superset relationship, unlike other api surfaces. This has not become a problem for stubs generated from source files as the stubs contain all methods in the source files, but became a problem for stubs genereated from text files as the stubs only contain the methods that are essential for compilation of the stubs and its reverse dependencies, and there were cases where the hiddenapi flags are not properly propagated to the subclasses. To resolve this problem, a java_api_library module that provides the union of the test and the module lib api surfaces was introcudes. Since hiddenapi_modular currently defines the module lib api surface to be a wider api scope over the test api scope, the new module can be passed as input to hiddenapi over the module lib non updatable stub module to resolve the problem. Test: enable hiddenapi for from-text stub build && ENABLE_HIDDENAPI_FLAGS=true m --build-from-text-stub Bug: 191644675 Bug: 275570206 Change-Id: I9a230ec5082c52ed866f29b0748814f2cf10279b
2023-10-11Add module dependency checking testing method Jihoon Kang
Currently in Soong testing suite, the only method for testing module dependency is CheckModuleDependencies(...), which comapares for the exact module dependencies. This change adds the method CheckModuleDependency(...) which enables checking the dependency between two modules, instead of comparing for all dependencies of an interested module. Test: m nothing Bug: 288624417 Change-Id: I804d35979ddc24b0134671e326c1d37615ec4190
2023-10-11Add droidstub modules for Soong java testing Jihoon Kang
Previously, only the essential java_api_library and java_api_contribution modules were being added to the template bp file for testing purpose. However, since the child change aosp/2640275 adds droidstubs that generates the java_api_contribution as the dependency of the java_api_library modules, not adding the droidstubs modules to the template bp file will lead to missing dependency errors in Soong test cases that tests the from-text generation & java_api_library functionality. To prevent this, this change adds the droidstubs modules instead of the auto generated java_api_contribution modules to the template bp file to more closely align with the real life behavior. Test: m nothing Bug: 288624417 Change-Id: I6a25e2f6c5f1281e96eca15aa5eec7417635df3f
2023-10-10Add UnsupportedAppUsage to java_aconfig_library dependency Zhi Dou
Generated flag requires UnsupportedAppUsage annotation to expose the flag to CTS tests. Bug: 301272559 Test: presubit (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5e2c96a93b4c16b224c090570a10697400a42c0a) Merged-In: I90c87596ca80766ece429ddee1b45723b01d2760 Change-Id: I90c87596ca80766ece429ddee1b45723b01d2760
2023-09-21Remove api_files property from java_api_library Jihoon Kang
java_api_contribution provides api_surface information, but files directly passed to java_api_library do not possess such information. Currently, the api surface is assumed via naming convention for api files passed via api_files property, but this is fragile. This change removes the api_files property from java_api_library and enforce all api files to be passed via java_api_contribution Test: m nothing --build-from-text-stub Bug: 300964421 Change-Id: If01d9ed978fe469d4ee0d685582a51629ebecc56
2023-08-28Merge "Support for incremetal platform prebuilt APIs" into main Todd Lee
2023-08-26Add aconfig annotations for java_aconfig_library Joe Onorato
Test: m Bug: 289087078 Change-Id: I860b91f984b2f2c596360490337fb25a4df7a988
2023-08-25Support for incremetal platform prebuilt APIs Todd Lee
This change provides support for prebuilt incremental platform API (i.e. API changes associated with a QPR, as opposed to a major dessert releas). This feature is provided via the existing prebuilt_apis module with the introduction of a new attribute: allow_incremental_platform_api While typical platform prebuilt APIs are presumed to be under a directory structure that follows the pattern: <version>/<scope>/<module>.jar <version>/<scope>/api/<module>.txt Where <version> is limited to a single integer signifying the API level. For modules where allow_incremental_platform_api is set to 'true' (false by default) the pattern is the same, however <version> is presumed to be of the form MM.m, where MM aligns with the existing API level and m signifies the incremental release (e.g. QPR). Bug: b/280790094 Test: platform build check with both incremental & non-incremental API cd build/soong && go test ./java (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:eee6995093485497bc29cdce01c2a86765ffb4eb) Change-Id: I67e293006ccfa210d0dcc0a294db894632f1b6cb
2023-05-22Add additional java_api_library testing modules Jihoon Kang
This change adds android-non-updatable.stub.* java_api_library modules to java testing. Test: none Change-Id: I10110a21cc61905995803dfc1d27484358019807
2023-05-17Disallow missing api source files for java_api_library module Jihoon Kang
The purpose of this change is to enable filegroups to be taken as inputs for `java_api_library` module `api_files` property. However, since android.MaybeExistentPathForSource() does not support this, it needs to be replaced with android.PathForModuleSrc(), which checks for the files' existence. Bug: 283006953 Test: go test ./java Change-Id: I8a7d7f200f900219cc17243194a4c26071329ee6
2023-05-11Unify installDirOnHost and installDirOnDevice. Jiakai Zhang
These two fields never do what they are described to do. This CL unifies them to avoid the confusion. Bug: 280440941 Test: m Change-Id: I3652d73a50832a2e494d9f5cae750f5fc38293b4
2023-05-11Prepare tests for dexpreopt changes. Jiakai Zhang
After this change, there is a clear separation between tests that are related to dexpreopt and tests that are not. The former uses PrepareForTestWithDexpreopt, while the latter uses PrepareForTestWithJavaDefaultModules. The benefit is that the latter will no longer affected by any dexpreopt changes. Bug: 280776428 Test: m nothing Change-Id: Ib957765b9287d51c082e0a33cee17a6bb56daeef
2023-04-17Add additional java_api_library module to java testing Jihoon Kang
Module lib surface is comprised of contributions from art, conscrypt, and i18n api domains. On top of this, the module lib api surface generates an additional stub library containing the contributions of the non-updatable api domains. Adding this additional module to the testing module enables more thorough testing of module lib api scope java_api_library modules. Test: m Change-Id: Ia648651fb9e6cba2642de7e8d39047d888bf49ce
2023-04-04Update java_api_library in testing modules Jihoon Kang
The full api surface java_api_library modules are currently defined as java_library modules instead of java_api_library modules. This change corrects this and modifies the DepsInfo of java_api_library so that it can be compatible in tests. Test: go ./java Change-Id: I540b5a930f506ce5f7663ab6e07c6df49af15cf9
2023-03-30add *.from-text modules to the java test fixture Spandan Das
Test: go build ./java Change-Id: Ib9ff4eb59ff63dc208b7a28626d42b53153c86d6
2023-02-28Replace SortedStringKeys with SortedKeys Cole Faust
Now that we have generics. Bug: 193460475 Test: presubmits Change-Id: I1594fd8feb505175d5c09c03ef397e5ffd5b09cb
2022-12-10Always run AndroidGlobalLintChecker.jar with lint invocations mattgilbride
AndroidGlobalLintChecker.jar provides a set of lint checks that should be run across the entire tree. Bug: 236558918 Test: manually tested, treehugger Change-Id: I2a868f1d78c969eefa2c29477fc8ecab1043df39
2022-12-01Merge "Support testing for resource shrinking" Treehugger Robot
2022-10-06Test bootImageConfig/Variant fields Paul Duffin
Most of the fields in the bootImageConfig/Variant structs are assigned inside a Once func so are guaranteed to be only set once. However, some are assigned outside. This change adds comprehensive tests for those structs and verifies that the constant fields are preserved and the mutated fields have the correct value. The check for the constant fields is added in a new TestBootImageConfig test. The check for the mutated fields is added into TestSnapshotWithBootclasspathFragment_ImageName as that test checks an art bootclasspath_fragment in the following configurations: * source on its own * prebuilt on its own * source and prebuilt with source preferred * source and prebuilt with prebuilt It reveals a couple of interesting facts: * All the *installs fields are set to the same value irrespective of whether the source or prebuilt is preferred. The information is constructed solely from information already within the bootImageConfig/Variant and so can be moved within Once. * The licenseMetadataFile is incorrect when prebuilt is preferred. That is due to both the source and prebuilt modules setting it and the source module always wins as the source module depends on the prebuilt so always runs its GenerateAndroidBuildActions after it. Those issues will be cleaned up in following changes. Bug: 245956352 Test: m nothing Change-Id: If917cfbcb3b1c842a8682d51cc1ee1fed1c51add
2022-09-28Support testing for resource shrinking Jared Duke
Add a simple test and add necessary mock dependencies to allow future resoure shrinking use with platform targets. Test: m Bug: 202959019 Change-Id: Id2dd44d52ce5ea62c06784caab0af6276248cb3f
2022-09-09add jacocoagent by default to Java modules Sam Delmerico
On coverage builds, R8 will fail to properly optimize and fail the build if ignore_warnings: false, because jacoco injects dependencies on jacocoagent classes, but the jacocoagent library is not part of the classpath libraries passed in to R8 in its arguments. Instead we can add jacocoagent as a libs dependency for these modules so that it will get pulled into the r8 flags. Bug: 243903417 Test: m Change-Id: Icc24cc260b896fc800125a0318308d823ccf7a83
2022-04-12Merge changes I046d75db,Ie13817dc am: d2aa190bdc am: f2c86c8c76 am: 1a3ea67458 Colin Cross
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2058908 Change-Id: I9ab91976903abbb4e3ec17b3d26db15447f074d6 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-11Move proguard test files to java package Colin Cross
The proguard test files are duplicated in apex and sysprop and will be needed by app tests, move them to the java package. Test: run all soong tests Change-Id: Ie13817dcda8d98801d16a97ffceef1100c7d5380
2022-04-05Surface Java APIs Used By APK-only Modules. Matt Banda
Previously we were only generating used-by API-coverage for APEX modules. This change adds support for APK-only modules such as NetworkStack and DocumentsUI. Bug: b/216313756 Forrest Run: https://android-build.googleplex.com/builds/abtd/run/L10800000953846781 Test: TARGET_BUILD_VARIANT=userdebug PRODUCT=mainline_modules_x86 ./vendor/google/build/build_unbundled_coverage_mainline_module.sh -j16 Change-Id: Id17e4a55c2a52e9903632a654e778f8d54982dfc Merged-In: Id17e4a55c2a52e9903632a654e778f8d54982dfc (cherry picked from commit 56d75785bd52c8a8f684935eed67fceb2c0e6850)
2022-02-21Add support for sdk extensions in prebuilt_apis Anton Hansson
This makes it possible to pass an extensions_dir containing finalized module APIs to prebuilt_apis. The extension versions are compared to the api level versions to figure out what the "latest" finalized API is for each module. This is done using the base_sdk_extension_version, such that any extension higher than than base_sdk_extension_version is assumed to be finalized after any of the existing api level versions. Bug: 220086085 Test: prebuilt_apis_test.go Test: existing module in prebuilts/sdk Change-Id: Ib792f84202d436f594ba5e8716c6a187f9cd60dc
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-11-03Rename core-current-stubs-system-modules to be more consistent Paul Duffin
Renames to core-public-stubs-system-modules so that it is of the format core-<sdk-kind>-stubs-system-modules. Bug: 204189791 Test: m nothing Change-Id: Iac565c940c2ef92be9cc64c0c6b8102a26afe0dd
2021-11-01Use module-lib system modules when building from prebuilts Paul Duffin
When building from source the build uses the java system modules for the public or module APIs as needed. However, previously when building from prebuilts it would always use the public API. That difference lead to build failures when building from prebuilts. This change makes the selection of java system modules when building from prebuilts consistent with the selection when building from sources. As API levels 30 and 31 (which are the only previous releases to provide system modules) did not provide separate java system modules for the module-lib API those levels always use the public APIs. Bug: 204189791 Test: - before applying these change m TARGET_BUILD_APPS=framework-connectivity - build fails with compilation error due to missing module APIs m sdk dist cp out/dist/system-modules/module-lib/core-for-system-modules.jar prebuilts/sdk/current/module-lib/core-for-system-modules.jar - apply these changes m TARGET_BUILD_APPS=framework-connectivity - build passes as expected Change-Id: Id113ff014e7892b1009fbcaad89b1ae23a7c3b79
2021-11-01Make prebuilt_api test environment realistic Paul Duffin
Previously, the fixture preparer for prebuilt_apis would add a core-for-system-modules.jar file in every API directory even though currently they only exist in the public API directories. This change makes the test environment more realistic by only creating them for the public API. Rather than hard code that into the test code (which would duplicate the hard coding in the decodeSdkDep func) this extracts a function that is used by both. That ensures that any changes to that func will be reflected in both the test and runtime behavior. Bug: 204189791 Test: m nothing Change-Id: I346ac9c0dcf407c61de16b6027663a05821bcf62
2021-10-29Run TestClasspath test cases with Always_use_prebuilt_sdks=true/false Paul Duffin
Previously, the TestClasspath test cases were only run with the default setting of Always_use_prebuilt_sdks=false. That meant that some of the code under test that depended on the setting of that variable was not tested properly. This change runs the test cases m with Always_use_prebuilt_sdks=true as well. Those test cases whose behavior depends on the setting of that variable are split into two separate test cases, each of which only runs with the appropriate setting of that variable. All other test cases are run for both settings of the variable. That revealed a slight issue with the test setup (a missing prebuilts/sdk/public/core/android.jar file) which broke the core_current test when run with Always_use_prebuilt_sdks=true which has also been fixed. Bug: 204189791 Test: m nothing Change-Id: If2ea3fde40c7573262e93691af0b5a57e4d54469
2021-09-22Add annotations.zip support to java_sdk_library Anton Hansson
The annotations zip file is produced by the "main" sdk build and is primarily consumed by android studio. In order to support building the main SDK without requiring the sources of all modules, we are adding module SDK artifacts that allows reconstructing these outputs. The annotations zip contains XML files which should be fairly easy to merge from all the individual parts. Bug: 187397779 Test: unit tests in this CL Test: m sdkextensions-sdk and inspect output Change-Id: I955cae720e6f1382936836ee1d8fb11003f51b7d
2021-09-20Merge "Add test to TestJavaStableSdkVersion for legacy core platform" Treehugger Robot
2021-09-16Add test to TestJavaStableSdkVersion for legacy core platform Paul Duffin
Adds a test case to TestJavaStableSdkVersion for the case where a module uses sdk_version: "core_platform" but is in the list of modules that can use the legacy version. This required storing the lookup map in the Config to allow it to be customized for the test. Bug: 180399951 Test: m nothing Change-Id: I404705c3fd8a559649c6ab2624856cf78f49f85c
2021-09-16Revert^2 "Preopt APEX system server jars." Jiakai Zhang
This reverts commit 92346c483249726164f4bd140413d60391121763. Reason for revert: Fixed build error. The build error is fixed by ag/15841934. This CL remains unchanged. This CL will be submitted AFTER ag/15841934 is submitted. Bug: 200024131 Test: 1. Patch this CL and ag/15841934 into internal master. 2. sudo vendor/google/build/build_test.bash Change-Id: I5f2b8357846fc7dda56e25ebe6ffb095e8047ec8
2021-09-15Revert "Preopt APEX system server jars." Adrian Roos
This reverts commit ca9bc98e0cfe9a519cfdd13450a68f1ed7ad5b02. Reason for revert: breaks build Bug: 200024131 Change-Id: Ide07b4c4d267370ae31107b1598b2f878c701282
2021-09-15Preopt APEX system server jars. Jiakai Zhang
The path to the artifacts will in the form of /system/framework/oat/<arch>/<encoded-jar-path>@classes.{odex,vdex,art}, where <encoded-jar-path> is the path to the jar file with "/" replaced by "@". For example, /system/framework/oat/x86_64/apex@com.android.art@javalib@service-art.jar@classes.odex There will be a follow-up CL to update ART runtime to recognize artifacts in that path. Test: m com.android.art Bug: 194150908 Change-Id: Ic89fd63c4b1cd565684cead83fc91dae3bc97a4c
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-06-29"module_current" and "system_server_current" should contain ART's ↵ Victor Chang
@SystemApi(MODULE_LIBRARIES) Before this fix, compiling a java_library against sdk_version: "module_current" can't use the @SystemApi(MODULE_LIBRARIES) provided by the ART module because the system module "core-current-stubs-system-modules" contains only the public APIs. Use the new system module with module lib APIs. Bug: 183097033 Test: m droid Change-Id: I274e2710d1ff34e896aa620bfafb4481180c53b5
2021-06-22Append platform classpath proto configs with missing apex jars. satayev
Any apex classpath fragment that doesn't generate its own classpaths proto, must still propagate it's boot jars for the platform classpath fragment to include for complete CLASSPATH variables on device. Bug: 191127295 Test: atest CtsClasspathsTestCases derive_classpath_test Change-Id: I93687f69006741fcd66eb6e04891a4b4bbcc3b47
2021-06-20Make CheckHiddenAPIRuleInputs more reusable Paul Duffin
Adds a message parameter and allows leading spaces in the expected file string to allow them to be nicely indented. Bug: 177892522 Test: m nothing Change-Id: I33df26610738c48879fa0b8250dc377dd04bb07d
2021-05-20Merge changes I4e7a7ac5,I0c73361b Jiyong Park
* changes: Record the actual APEXes that a module is part of. Rename InApexes -> InApexVariants
2021-05-18Don't fail if the target module is disabled in dex2oat tool Martin Stjernholm
dependencies. dexpreopt.RegisterToolDeps runs late after prebuilt dependencies have been resolved, and there's special code in dex2oatPathFromDep to resolve the prebuilt from the source module. However, if the source module is disabled then the dependencies check in validateAndroidModule will complain, so we need to disable that check in this particular situation. Also add a comment to explain why dexpreopt.RegisterToolDeps needs to run so late. Test: m nothing Bug: 145934348 Bug: 172480615 Change-Id: Ibc673303d0336768fa23261a2068e91a08f46a30