summaryrefslogtreecommitdiff
path: root/java/testing.go
AgeCommit message (Collapse)Author
2025-03-04Always allow mixing old and new SDK version formats Mårten Kongstad
The SDK is changing its versioning scheme from the old single integer API level to the new major.minor format. Remove the now obsolete allow_incremental_platform_api property of prebuilt_apis. Update soong to allow a mix of the old and new formats. Bug: 397644338 Test: croot build/soong && go test ./java Test: lunch sdk-next-eng && m sdk dist Ignore-AOSP-First: minor SDK development takes place on internal main Change-Id: Ie169addb97bb1c45fb254f9a7922a623cda94289
2025-02-20Merge "Remove RELEASE_USE_TRANSITIVE_JARS_IN_CLASSPATH" into main am: ↵ Colin Cross
646e843e91 am: dc95088864 Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3502196 Change-Id: I823974fc71fdf574bb677296d358d11c4cbd7d7c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2025-02-20Remove RELEASE_USE_TRANSITIVE_JARS_IN_CLASSPATH Colin Cross
RELEASE_USE_TRANSITIVE_JARS_IN_CLASSPATH is set to true in all release configs in main, Soong can stop checking the value. This implicitly enables the flag for all of the tests in Soong, which requires updating paths in many of them. Test: builds Change-Id: I2e0d6cd109e1aa7a1163116fa1210e3f42f57878
2025-02-12Merge "Don't panic in ModuleForTests and friends" into main am: 4a80748e09 ↵ Colin Cross
am: 8ea2abcb0f Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3490133 Change-Id: If401bc7e4ed94f982391e49aa059015cbaecca5f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2025-02-12Don't panic in ModuleForTests and friends Colin Cross
Panicking in ModuleForTests and similar test helper functions was a mistake. Go's test runner stops running tests as soon as any test panics, which means debugging multiple tests panicking requires rerunning all the tests after fixing each panic to find the next one. Pass the *testing.T into ModuleForTests and friends so that it can call t.Fatalf instead. Test: all soong tests pass Change-Id: I5d0f2424eaf04fb795079e6d1e4b9469d8c7033c
2025-02-11Merge changes from topics "apex_transition_info", ↵ Colin Cross
"bcp_dependency_through_apex" into main am: 5c846d8349 am: 6db3e6ffd9 Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3470502 Change-Id: I9557fe50d5bdae792487fbc06e64c4b9473c65a9 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2025-02-11Add extra dependency from apex to bootclasspath fragments to modules am: ↵ Colin Cross
bdd344b91a am: 49740c9176 Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3452159 Change-Id: I890e59fa7ecbef6522d380dd3486ba9a84b52c7a Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2025-02-11Move prebuilt mutators earlier am: d8d8b85c56 am: a48d8684b2 Colin Cross
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3446419 Change-Id: I3fd66ec3c8a59fc7d190dd41f4774887dc9939f8 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2025-02-10Convert android.TransitionMutator to TransitionInfo Colin Cross
Use the ApexInfo instead of a string as the TransitionInfo for apex variations. This removes the need for apexInfoMutator, which is the last remaining top down mutator. This has a variety of ramifications. One is that it is no longer possible to add a dependency onto the apex variation of a module, as that would require constructing a matching ApexInfo. Instead, anything that wants to add a dependency on the apex variation has to depend on the apex instead, and get to the module by walking its transistive dependencies. Another ramification is that modules in apexes can no longer determine which apexes they are in (unless they set UniqueApexVariations so that each variation is in exactly one apex). This prevents some of the existing container violation checks from working after this CL, tracked in b/394955484. It also requires using unique variation names for the prebuilt and source dependencies of apexes, so the apex variations for dependencies of prebuilts now have a prebuilt_ prefix. Bug: 372543712 Bug: 394955484 Test: go test ./... Change-Id: I3d08aca1ac956ab0e343ec3f235a736cd93be0e1
2025-02-07Add extra dependency from apex to bootclasspath fragments to modules Colin Cross
An extra dependency from apex modules to their bootclasspath fragments and from bootclasspath fragments to their contents is necessary, as the existing one with bcpfTag return false from ReplaceSourceWithPrebuilt to never rewrite the dependency to the prebuilt fragment, and we'll need a dependency to the prebuilt fragment in the next CL. Bug: 372543712 Test: all soong tests pass Change-Id: I87ff3afa0d5c90936664dd493654f1d64230b8a9
2025-02-07Move prebuilt mutators earlier Colin Cross
Move the prebuilt mutators from postdeps to predeps mutators. This ensures that the decisions on whether the source or prebuilt will be used can be made earlier, which simplifies the apex and dexpreopt code, allowing it to directly depend on the correct module. This requires some mutators that previously ran before the prebuilt mutator and now run after the prebuilt mutator be aware of prebuilts. In particular, the cc.linkageTransitionMutator and rust.libraryTransitionMutator now have to manually disable prebuilts when they don't produce a static or shared variant that the source module produces, and some mutators have to ignore PrebuiltDepTag dependencies when propagating transitions. The apexTransitionMutator also needs to temporarily use an interface on the dependency tag to correctly resolve some dependencies that exist before the apex variation is created onto the correct variation. This will shortly be replaced with depending on the apex itself instead, and then walking the dependencies of the apex to find the necessary module. Bug: 372543712 Test: go test ./... Change-Id: If125ea981be87673bae3bd0a7e3b2c16c337e8f7
2024-11-22Merge "replace aconfig_storage_reader_java to aconfig_storage_stub" into ↵ Zhi Dou
main am: eea1ab3a49 am: a4bb698dfa Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3365727 Change-Id: I902273b8718c14fafe211783f616f6066dfe4dc0 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-11-21replace aconfig_storage_reader_java to aconfig_storage_stub zhidou
This change replace aconfig_storage_reader_jave to aconfig_storage_stub. The former library is a normal java library, while the later is a stub library. Since we only need to provide the symbols here, the stub library is safer. Test: presubmit Change-Id: I1c098cf7ad4c0ec0d5f0b13089f04598b8f81fc3
2024-11-18Merge "Don't use DirectlyInAnyApex to enable dex and coverage" into main am: ↵ Colin Cross
e99f07cec9 am: 5d93123de0 Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3349536 Change-Id: I7787fd8fdc624e1ee8f5d2e5a1994ed5c8c3b740 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-11-16Don't use DirectlyInAnyApex to enable dex and coverage Colin Cross
DirectlyInAnyApex was being used to automatically enable dexing and to enable coverage. There is only one module in an apex that isn't already being dexed, so set compile_dex in that module and remove the automatic dexing. Coverage is only useful on device modules if they are dexed, so convert the shouldInstrumentInApex test to check if it is dexed instead. This reomves the last usages of DirectlyInAnyApex from the java package. Bug: 372543712 Test: No change to build.ninja Change-Id: I1d1738305ed97d85669945def75e9916c2b41f3c
2024-10-01Merge "Set version code of apex and apk based on ↵ Alyssa Ketpreechasawat
RELEASE_DEFAULT_UPDATABLE_MODULE_VERSION." into main am: 130da8b89a am: c8e68e749a Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3284514 Change-Id: I8fd70f88e11e5a90581e5bb14e36b99e81b08aed Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-10-01Merge "Set version code of apex and apk based on ↵ Alyssa Ketpreechasawat
RELEASE_DEFAULT_UPDATABLE_MODULE_VERSION." into main
2024-09-27Merge "Remove top down strict updatability checks" into main am: b16bd5dbe2 ↵ Colin Cross
am: 38e8149223 Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3283080 Change-Id: I80040207e6d3e724c156b3d73bdf7fe75afb9771 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-09-27Set version code of apex and apk based on ↵ Alyssa Ketpreechasawat
RELEASE_DEFAULT_UPDATABLE_MODULE_VERSION. The build flag RELEASE_DEFAULT_UPDATABLE_MODULE_VERSION is set up to allow the default version code of updatable apk and apex to be configurable per release config. Use the value from flag and remove old constant value (DefaultUpdatableModuleVersion). Bug: 369531931 Test: presubmit Test: flash cf and check version Change-Id: Ia0a8634360cbe83501cdafee888678836005620f
2024-09-26Remove top down strict updatability checks Colin Cross
The enforce_strict_updatability_linting and apex_strict_updatability_lint are some of the last top down mutators, and removing them will help with incremental analysis. Both mutators are used to propagate a flag to transitive java dependencies that causes them to add extra checks to their lint rules to require that baselines not include any skipped NewApi checks. Instead of modifying dependencies to check the baselines, propagate the baselines up to the modules that are requesting the checks, and perform the checks on all transitive baselines there. Bug: 367784740 Test: TestJavaLintStrictUpdatabilityLinting Test: TestApexStrictUpdtabilityLint Flag: EXEMPT refactor Change-Id: Ief2e3b26d745da61f13e621d635a5879d9c56779
2024-09-26Revert^2 "pass read new storage parameter to java codegen" Zhi Dou
This reverts commit df1c59a657e4c45f7452ab8b608aea155b8931aa. Reason for revert: Issue is not with this change. Change-Id: I488c10758c3b6d4cb62ff462902576221cff83b0 Merged-In: Id12816206a16b17c23e3a53832d268f1600107b3
2024-09-23Revert "pass read new storage parameter to java codegen" Liana Kazanova
This reverts commit 9cf2e8e1403b5e057aca10870080adbe3e621f83. Reason for revert:DroidMonitor - Potential culprit for http://b/369200837 - Verifying through ABTD before submission. Change-Id: I635ba732fba40b7c73b5c419ef204fb14e857cb2
2024-09-23pass 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 (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:c98032785339de11e34ee3d4f94b3ec3ed70d324) Merged-In: Id12816206a16b17c23e3a53832d268f1600107b3 Change-Id: I95ad9457e6d9c07a5a5b3074045a383f004113a9
2024-09-06Merge "Make the java static_libs property configurable" into main am: ↵ Cole Faust
219009f606 am: ace2d9884a Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3254302 Change-Id: I9e691f10c574e768392532e22f55ccafbcc3cd34 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-09-06Merge "Make the java static_libs property configurable" into main Cole Faust
2024-09-06Merge "Use transitive header jars in classpaths" into main am: 399ff4019d ↵ Colin Cross
am: f6c08dba54 Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3214782 Change-Id: Ia95c786776fdfba7b1e0144febce6f0ecd5984dc Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-09-05Make the java static_libs property configurable Cole Faust
Bug: 362579941 Test: m nothing --no-skip-soong-tests Change-Id: Iccc93cf14753aae1adb26c6eedd00aabf1c2f6a6
2024-09-04Use transitive header jars in classpaths Colin Cross
Skip combining jars into turbine-combined, combined, and withres jars and instead collect transitive jars to use in the classpath and to produce the final dexed jar. This reduces the size of a `m checkbuild` in git_main by 11%, from 1300 KiB to 1154 KiB. It may also improve caching and reduce uplink network bandwidth when building with RBE, as now the classpath inputs to rules are themselves outputs of previous rules and so already in the RBE CAS. The downside is that the classpath inputs to each rule are now much longer, increasing the Soong ninja file size 11%, from 4.6 GiB to 5.1 GiB. This could be mitigated in the future by supporting something like depsets in the generated ninja file to reduce duplication. Bug: 308016794 Test: TestSimple, TestKotlin, TestClasspath Flag: build.RELEASE_USE_TRANSITIVE_JARS_IN_CLASSPATH Change-Id: I2b7b4261375494370da70f98597c8719f1d561cf
2024-08-30Merge "Revert^4 "Implement detecting container violations."" into main am: ↵ Jihoon Kang
7344482ff3 am: 9e40f8f9b4 Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3248019 Change-Id: I77818bede2be74dc6755a55c5a8e69a1c6a7f64c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-29Revert^4 "Implement detecting container violations." Jihoon Kang
This change introduces a method to detect violating inter-container dependencies between modules. The method is run in `ModuleBase.GenerateBuildActions`, after the container info provider is set. Given that the provider of the direct dependencies would have been set at this time, the method utilizes this information to determine the violations, which are introduced in https://r.android.com/3141104. Note that this enforcement does not turn all inter-container dependencies as errors. Instead, it will only turn dependencies that matches the pre-defined violations into errors. Even if the dependency matches the violation, an error will not be thrown if the dependency satisfies any of the exception functions (e.g. the dependent module is stubs, or the two modules belong to the same apexes). Test: m nothing --no-skip-soong-tests Bug: 338660802 Change-Id: Ib9ddc0761fa46f1309b1a1a4f759d9a4e04fd70e
2024-08-28Merge "Revert^3 "Implement detecting container violations."" into main am: ↵ Priyanka Advani (xWF)
88a8daf8ca am: c2ba6683c5 Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3248525 Change-Id: I81f89cb4da10d34d2de5c48093bf43a76b81d769 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-28Revert^3 "Implement detecting container violations." Priyanka Advani (xWF)
2a88491afc72707c21a125b81f7dcd252d2fc5f1 Change-Id: Iba4527f391a093703978fe01177b56fec4604b28
2024-08-28Merge changes Ia693c4a5,I8e5620d2 into main am: c14be38f1a am: 4e373a7904 Jihoon Kang
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3247222 Change-Id: Ic901c1d2deef5f61e661cd07aa620b8ffdaf39df Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-28Revert^2 "Implement detecting container violations." Jihoon Kang
This change introduces a method to detect violating inter-container dependencies between modules. The method is run in `ModuleBase.GenerateBuildActions`, after the container info provider is set. Given that the provider of the direct dependencies would have been set at this time, the method utilizes this information to determine the violations, which are introduced in https://r.android.com/3141104. Note that this enforcement does not turn all inter-container dependencies as errors. Instead, it will only turn dependencies that matches the pre-defined violations into errors. Even if the dependency matches the violation, an error will not be thrown if the dependency satisfies any of the exception functions (e.g. the dependent module is stubs, or the two modules belong to the same apexes). Test: m nothing --no-skip-soong-tests Bug: 338660802 Change-Id: Ia693c4a53369c757a3e96656a769405c759b111c
2024-08-28Merge "Revert "Implement detecting container violations."" into main am: ↵ Satish Yalla
f2d6e5004f am: b2407feae1 Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3244001 Change-Id: Iddc3110928d6d237de002dc65e033e7940e2b11e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-28Revert "Implement detecting container violations." Satish Yalla
This reverts commit bb678f82d6bb5cd89bf282e88a879123d9763d61. Reason for revert: Droidmonitor created revert due to b/362639013. Will be verifying through ABTD before submission. Change-Id: I1dcb71672eeb44a17cf176d3731bcaf9aaf81edf
2024-08-28Merge "Implement detecting container violations." into main am: 26f071db92 ↵ Treehugger Robot
am: 30f3795688 Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3155659 Change-Id: If66625fe313efbbf9b50ebaee77e9ab718db58e9 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-27Implement detecting container violations. Jihoon Kang
This change introduces a method to detect violating inter-container dependencies between modules. The method is run in `ModuleBase.GenerateBuildActions`, after the container info provider is set. Given that the provider of the direct dependencies would have been set at this time, the method utilizes this information to determine the violations, which are introduced in https://r.android.com/3141104. Note that this enforcement does not turn all inter-container dependencies as errors. Instead, it will only turn dependencies that matches the pre-defined violations into errors. Even if the dependency matches the violation, an error will not be thrown if the dependency satisfies any of the exception functions (e.g. the dependent module is stubs, or the two modules belong to the same apexes). Test: m nothing --no-skip-soong-tests Bug: 338660802 Change-Id: I36e9cd956c5a076a53635be0c6ff27f77725516e
2024-08-17Merge changes Ia0e1b307,I63c7c33e into main am: a5289ac9ef am: 903a500065 Treehugger Robot
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3216639 Change-Id: I21ed0479f96986058353f5942ebc1030547eab48 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-16Define unstable container Jihoon Kang
Unstable container marks modules that are static reverse dependencies of "framework-minus-apex". These modules contain unstable implementation details of the platform, and should not be accessed by the CTS tests. Test: m nothing Bug: 338660802 Change-Id: Ia0e1b3070f0f7b2c1b9c27306323e2428d9722ca
2024-08-13Merge "Merge SingletonProviderContext with OtherModuleProviderContext" into ↵ Yu Liu
main am: 246b43049c am: 73282e8129 Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3216676 Change-Id: Ic5fa82e4179f922e35479e527a392db141a973c4 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-12Merge SingletonProviderContext with OtherModuleProviderContext Yu Liu
Bug: 358425833 Test: CI Change-Id: I8e3f40dc3cfc5337008b419801f8e6bf2d48e8b2
2024-08-06Merge "Revert "Revert "Enable from-text stub generation in non-sdk java..."" ↵ Treehugger Robot
into main am: 4f18cfdd7d am: 5d2439b3b1 Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3205865 Change-Id: I163753b63bc5b3b495d70ea46a15ebb5f58d2c68 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-06Merge "Revert "Enable from-text stub generation in non-sdk ↵ Jihoon Kang
java_sdk_library"" into main am: f6d9965cc5 am: ad5e953a7d Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3207397 Change-Id: I411dc190da40073de7d794de9ad7ef8fd5da9ed3 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-06Merge "Enable from-text stub generation in non-sdk java_sdk_library" into ↵ Treehugger Robot
main am: 99417ba9ea am: 696cea31d3 Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2983176 Change-Id: I298312e534e440f607bff40cc9ceae788edba9e3 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-08-06Revert "Revert "Enable from-text stub generation in non-sdk java..." Jihoon Kang
Revert submission 3207397-revert-2982300-java_api_library_non_sdk-FIKZOSARQI Reason for revert: Post submit build breakage culprit fixed Reverted changes: /q/submissionid:3207397-revert-2982300-java_api_library_non_sdk-FIKZOSARQI Change-Id: Ic79b7fd074f02febba94183cb1479874efe044b5
2024-08-05Revert "Enable from-text stub generation in non-sdk java_sdk_library" Liana Kazanova
Revert submission 2982300-java_api_library_non_sdk Reason for revert: DroidMonitor: Potential culprit for b/357648959 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted. Reverted changes: /q/submissionid:2982300-java_api_library_non_sdk Change-Id: I5ef7afd9ec3e10ea99f82d02172843ad9b2cfda9
2024-07-30Enable from-text stub generation in non-sdk java_sdk_library Jihoon Kang
This change allows from-text stubs to be generated for all java_sdk_library modules, unlike how it is currently limited to the modules that contribute to the api surfaces (i.e. the SDK). This change accomplish this by modifying the dependency of the from-text stubs generation, so that the sdk_library generated from-text stubs generating java_api_library modules no longer depend on the full api surface stubs, but generate the stubs in the module level, and combined later to generate the full api surface stubs. This change also removes the java_api_library modules defined in core-libraries/Android.bp, which are passed to generate the system modules. Given that the from-text vs from-source toggle is done within the java_sdk_library stubs level, these modules no longer need to exist. Implementation details: - Allow sdk_version to be specified in java_api_library modules. For java_sdk_library-generated java_api_library modules, they inherit that of the sdk_library module. Some java_sdk_library modules that do not contribute to the api surface are allowed to set sdk_version to something other than "none" or "core". - Implement java_api_library to implement `SdkContext`. This allows java_api_library to collect required deps from sdk_version (classpath, bootclasspath, system modules), and pass the collected jars when generating the stubs srcjar in metalava and compiling the stubs srcjar in javac. - Remove hardcoded list of sdk_library modules that are allowed to genereate stubs from the api signature files, and allow from-text stubs generation by default. Modules that are not able to generate stubs from the api signature files are specified by setting the newly introduced `Build_from_text_stubs` property to `false`. Test: ENABLE_HIDDENAPI_FLAGS=true m Bug: 327507877 Change-Id: Ia35d2f3cf9fae48fc8c4bd99a84ae18d7c0e7bee
2024-07-30Revert^2 "pass read new storage parameter to java codegen" Zhi Dou
This reverts commit 848c6c939c90196e0294a1f126c890b434bc8050. Reason for revert: The real issue is fixed in another cl, not related to this one Change-Id: Id12816206a16b17c23e3a53832d268f1600107b3
2024-07-30Revert "pass read new storage parameter to java codegen" Satish Yalla
This reverts commit c98032785339de11e34ee3d4f94b3ec3ed70d324. Reason for revert: Droidmonitor created revert due to b/356193768. Will be verifying through ABTD before submission. Change-Id: Ifaaa33b07333683492bc54270b840df21bcd00ca