Commit graph

8017 commits

Author SHA1 Message Date
Colin Cross
4b6a3ae65c Merge "Use R.txt files from aar files directly" into main 2024-02-29 18:55:17 +00:00
Colin Cross
5d55b66861 Merge changes I8d060594,I2b6a57ae into main
* changes:
  Put extraCombinedJars after the compiled jars
  Use RSP file for long classpaths
2024-02-29 18:46:46 +00:00
Spandan Das
85437f2901 Add a source_module_name to android_app am: efa146577f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2982635

Change-Id: I86d01156c103b3fc08f105d2890c9882f5fdeb57
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-29 17:45:16 +00:00
Spandan Das
efa146577f Add a source_module_name to android_app
For multiple mainline prebuilts, we will have multiple versioned
prebuilt apps in the tree. The soong name of these prebuilts will have a
version prefix to prevent name collisions (e.g. MyGoogleApp.v2).

This CL introduces a source_module_name property in android_app_imoprt.
This property will be used for the following
1. Determining installation path. This should be
/system/app/MyGoogleApp/MyGoogleApp.apk
and not
/system/app/MyGoogleApp.v2/MyGoogleApp.apk
(filename prop determines the filename and not the dir name)

2. Preventing duplicate installation rules: This property will be used
   to create a dependency to the source app, and call HideFromMake on
   all the unflagged apps

Test: presubmits
Test: locally # Created CaptivePortalLoginGoogle.v2 and selected it
using one of the RELEASE_APEX_CONTRIBUTION_* flags

Bug: 326995930
Change-Id: If4ab9f9bd295117c96eb062cf3b3d2efc8bfed12
2024-02-29 14:33:16 +00:00
Sorin Basca
5a2e36b755 Switch to JDK 21
Bug: 313924276
Test: n
Change-Id: Ia9682181a6ce35ed0102d60bf7df1def8f876fd0
2024-02-29 11:44:09 +00:00
Inseob Kim
224ac62ba8 Merge "Sort jarjar rename keys before using" into main am: 688f824e1a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2981731

Change-Id: I18ade8539893ac793663217f47c786e76f5a2aff
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-29 01:44:15 +00:00
Inseob Kim
688f824e1a Merge "Sort jarjar rename keys before using" into main 2024-02-29 01:04:40 +00:00
Jihoon Kang
04338c8ae2 Merge "Enable non-"everything" stubs generation in java_api_library" into main am: 641bd9daee
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2977092

Change-Id: I91772243047e96a6144134694f2038878ed7b0ea
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-28 22:50:53 +00:00
Colin Cross
bb77d8e948 Use R.txt files from aar files directly
Use the R.txt files from aar imports directly instead of recreating
one using aapt2 from the embedded resources.  Fixes an issue with
com.google.android.material where the jar was referencing
com.google.android.material.R.attr.theme, aapt2 was not producing
"int attr theme 0x0" in R.txt, but the aar's R.txt had it.

Bug: 294256649
Test: builds
Change-Id: Ibe1e5535a75eed59f3b8dbbc12eff9c07af51d37
2024-02-28 11:54:48 -08:00
Colin Cross
fd620b2b44 Put extraCombinedJars after the compiled jars
extraCombinedJars contains the R.jar generated by
ResourceProcessorBusyBox for apps.  It needs to go before any
static_libs dependencies so that the finalized R values take
precedence over any non-final R values that may have been included
in the dependencies.  Moving after the javac and kotlinc compiled
jars helps minimize differences when turning on use_resource_processor
by default by using the MANIFEST.MF generated by soong_zip instead of
the one generated by ResourceProcessorBusyBox, which contains a
different Created-By field.

Bug: 294256649
Test: m javac-check
Change-Id: I8d060594404121fd36ef650ac317f0c5d5f92b23
2024-02-28 11:54:48 -08:00
Colin Cross
c52d523327 Use RSP file for long classpaths
Setting use_resource_processor: true can increase the length of the
classpath enough to trigger "command line too long" errors.  There are
clockwork libraries with 546 transitive android_library dependencies.
Write classpaths longer than 64kB to a separate file and add them
to the javac and turbine command lines with the @file syntax.

Bug: 294256649
Test: m checkbuild
Change-Id: I2b6a57ae30de03347db3221e9c9a4b2efb490115
2024-02-28 11:54:48 -08:00
Jihoon Kang
5d701272e4 Enable non-"everything" stubs generation in java_api_library
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-02-28 07:55:32 +00:00
Inseob Kim
3c0c9d7816 Sort jarjar rename keys before using
To make it deterministic

Bug: 327302642
Test: compare build commands among different targets
Change-Id: I890dcd67c62db58938a6e6d1c4e3fbd323c72b18
2024-02-28 14:28:59 +09:00
Jihoon Kang
58551161ca Merge changes I14928b7b,Ia009df3d into main am: 60bdd05b21
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2929615

Change-Id: I6c50871814d4165f6b546edae39ca8b16ebba9fc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-28 01:15:48 +00:00
Jihoon Kang
60bdd05b21 Merge changes I14928b7b,Ia009df3d into main
* changes:
  Generate runtime stubs in droidstubs
  Additional cleanup prior to adding the runtime stubs
2024-02-28 00:29:08 +00:00
Treehugger Robot
a948adc496 Merge "Support new property "arch_dpi" for android_import" into main am: 8bf3013844
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2967069

Change-Id: I0eb96ab1d45a47c4a67d4fef7f79d813846a6441
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-27 03:26:27 +00:00
Treehugger Robot
8bf3013844 Merge "Support new property "arch_dpi" for android_import" into main 2024-02-27 02:56:45 +00:00
Jihoon Kang
ca2f9e8bf4 Generate runtime stubs in droidstubs
Similar to how the exportable stubs are generated in droidstubs, this
change adds the rule to generate the runtime stubs in droidstubs. Unlike
the exportable stubs, which the artifacts are dist'ed during the sdk
build, the runtime stubs will only used in the hiddenapi flags
generation. Therefore, only the stubs are generated and no other
artifacts are generated during the "runtime" metalava invocation. When
`aconfig_declarations` property is not defined (i.e. no flags are
enabled, thus the exportable and the runtime stubs are identical), the
runtime stubs are simple copied from the exportable stubs.

Note that the runtime stubs are not a dependency of `droid` as of now.
The dependency of the hiddenapi flags will be replaced to the runtime
stubs in the child CL.

Test: m nothing --no-skip-soong-tests && m api-stubs-docs-non-updatable
Bug: 319162970
Change-Id: I14928b7b5619522c4caab1dfc795bc9c7e929639
2024-02-27 01:51:05 +00:00
Jihoon Kang
6b93b38e34 Additional cleanup prior to adding the runtime stubs
This change performs additional cleanups in the build rules of the
droidstubs module, specifically optionalizing annotationFlags(...) and
apiLevelsAnnotationsFlags(...). This is required as "runtime" stubs
would not generate other artifacts than the stubs, and thus
`stubsArtifacts` would not be generated for "runtime".

Test: m nothing
Bug: 319162970
Change-Id: Ia009df3d01f49841d5041fb2dfdfa7ef8671bf18
2024-02-27 01:01:44 +00:00
Herbert Xue
04354ae88b Support new property "arch_dpi" for android_import
Support the feature with new property combined with architecture and dpi
resolution.

Bug: 319381869
Test: go test -run TestAndroidAppImport_ArchVariants
Change-Id: Ib43cbae8868fc35701e6666867b2325f5abbb2c7
2024-02-26 10:46:18 +08:00
Jihoon Kang
d881124481 Convert the build flag RELEASE_EXPORT_RUNTIME_APIS to a product variable am: 35349466cd
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2973435

Change-Id: If699df9c820f06564446c5fac15ad79e2bb9365f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-23 02:36:45 +00:00
Jihoon Kang
35349466cd Convert the build flag RELEASE_EXPORT_RUNTIME_APIS to a product variable
RELEASE_EXPORT_RUNTIME_APIS build flag is currently used to modify the
filter condition for the "exportable" stubs, so that it exposes wider
set of flagged apis (ENABLED && READ_ONLY vs ENABLED || READ_WRITE).
This flag was originally introduced as a build flag to be enabled in
specific release configurations, but instead this is used as a product
variable that will be enabled in the product `sdk_with_runtime_apis`,
which will be introduced in a future change.

Test: m nothing --no-skip-soong-tests
Bug: 326312949
Change-Id: Ieb3cee517dd6cedcca844a9eab270aedf8199d4e
2024-02-22 20:10:22 +00:00
Jihoon Kang
c09ef10f8d Merge "Modify sdk_library to dist exportable api files by default" into main am: 5135a0df57
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2970651

Change-Id: I75c03735713efc3d920cacc04bae33229138ac0f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-21 08:09:38 +00:00
Jihoon Kang
5135a0df57 Merge "Modify sdk_library to dist exportable api files by default" into main 2024-02-21 07:30:30 +00:00
Jihoon Kang
d1799f6835 Modify sdk_library to dist exportable api files by default
Currently, the "exportable" stubs are copied to the dist directory by
default when building the java_sdk_library module. However, "everything"
api files (current & removed) are copied to the dist directory, causing
confusion to the developers. This change modifies the default behavior
so that the "exportable" api files are copied to the dist directory and
match the behavior of the stubs.

Test: m nothing
Bug: 325639165
Change-Id: I2e3b158bb638d30629120b32aa3e88bb26231020
2024-02-20 23:06:11 +00:00
Treehugger Robot
7fd2b6f964 Merge "AOSP platform_apis violations" into main am: dcda79b5e7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2969671

Change-Id: I8e411a5390f9af312a4dd2f54abb04f41e5b5884
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-20 23:04:31 +00:00
Spandan Das
8469e939f3 AOSP platform_apis violations
This allowlist contains java_library modules which set the no-op
property `platform_apis`. This allowlist will help enforce that there
are no new violations.

This should be a no-op till
https://android-review.git.corp.google.com/c/platform/build/soong/+/2969451
is submitted

Test: presubmits
Bug: 215379393
Change-Id: I49372e1d476201f607cd717be26aa3909668ff26
2024-02-20 17:22:22 +00:00
Spandan Das
8a1033139c Merge "Disable dexpreopt if optional_uses_libs does not have an impl" into main am: 4bec95e2f6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2963583

Change-Id: I49ab495bfeb2e2d4c9a6c170ed73c47e0efe9802
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-20 08:42:37 +00:00
Spandan Das
4bec95e2f6 Merge "Disable dexpreopt if optional_uses_libs does not have an impl" into main 2024-02-20 08:08:35 +00:00
Zi Wang
2559a85af4 Merge "Add jarjar_prefix propagation support for aconfig_declarations_group module type" into main am: 0fd4bb8c70
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2967332

Change-Id: I0aedb1a1c34054269666a6f25624c68e079a73f6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-17 02:07:27 +00:00
Zi Wang
0fd4bb8c70 Merge "Add jarjar_prefix propagation support for aconfig_declarations_group module type" into main 2024-02-17 01:24:09 +00:00
Jihoon Kang
03d014ff2b Add jarjar_prefix propagation support for aconfig_declarations_group module type
jarjar_prefix propagation logic currently depends on the type of the
providers of the dependencies, thus the logic needs to be updated when a
new provider is added. Since `aconfig_declarations_group` module type
utilizes its custom provider "CodegenInfoProvider", this change adds
jarjar_prefix propagation support for this provider.

Test: Set aconfig_declaration module's exportable property to true && m framework-minus-apex and inspect if "repackaged-jarjar" subdir exists in outdir
Bug: 310504781
Change-Id: I1689027d7810687a53ec34b9cfda479806f2ec87
2024-02-16 22:22:18 +00:00
Spandan Das
0727ba76b1 Disable dexpreopt if optional_uses_libs does not have an impl
At ToT, an optional_uses_libs is not added to the build time CLC if it
does not exist in the tree. One edge case here is
java_sdk_library_import, which might exist in the tree, but without an
implementation. This cause issues during analysis when we try to verify
the correctness of the build time CLC.

This CL disables dexpreopt if a dependency does not have an
implementation. To limit inadvertent side effects, this is restricted to
java_sdk_library(_import) module types. (more precisely, it is restricted
to java_sdk_library_import, since the source module type will always
have an impl)

Bug: 315802285
Test: Added a unit test
Test: m nothing
Test: printf debugging in internal main, verified that this CL does not
disable dexpreopt on any android app inadvertently

Change-Id: I173fc2f3ff654fe4091e9a43322164afd3222ee7
2024-02-16 18:00:27 +00:00
Inseob Kim
aab9ab67ad Merge "Fix characteristic rro for overridden packages" into main am: f617e18741
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2963742

Change-Id: Iada941f7badf0686bf0352fe8a74ea030cfd21cc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-16 02:23:48 +00:00
Inseob Kim
f617e18741 Merge "Fix characteristic rro for overridden packages" into main 2024-02-16 01:41:48 +00:00
Treehugger Robot
ade9e28515 Merge changes I42eb64d3,I93d73757 into main am: e4c98ae235
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2962842

Change-Id: Ifdb4658032d8c4ef35a6bdf207843cf69de03973
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-14 22:59:14 +00:00
Treehugger Robot
e4c98ae235 Merge changes I42eb64d3,I93d73757 into main
* changes:
  Enable droidstubs to depend on aconfig_declarations_group module type
  Introduce module type aconfig_declarations_group
2024-02-14 22:14:30 +00:00
LaMont Jones
3b885b43ec Merge changes from topic "is_stubs_module" into main am: b45200bd0b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2962046

Change-Id: I0f169223082b697ec370cee91d1e3ed041bbe584
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-14 21:59:36 +00:00
Jihoon Kang
d60be87b3c Introduce library property is_stubs_module am: fe914ed17f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2959347

Change-Id: I4bad4dfcdefa6bf118ffee2bafc206cb8d3bf23c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-14 21:59:29 +00:00
LaMont Jones
b45200bd0b Merge changes from topic "is_stubs_module" into main
* changes:
  Improve determination whether to propagate JarJarProvider
  Introduce library property is_stubs_module
2024-02-14 21:38:20 +00:00
Colin Cross
8113101892 Merge "Always use aapt2 --no-static-lib-packages" into main am: 308d64ed72
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2962085

Change-Id: Ida814c476605753b7e43cd90ba5a8e52b9bad0a1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-14 20:33:57 +00:00
Colin Cross
308d64ed72 Merge "Always use aapt2 --no-static-lib-packages" into main 2024-02-14 20:01:25 +00:00
Jihoon Kang
38e4f258f7 Enable droidstubs to depend on aconfig_declarations_group module type
This change enabled aconfig_declarations_group module type to be added
as `aconfig_declarations` property of droidstubs module. Similar to
aconfig_declrations module, the aconfig_declarations_group module
provides the intermediate cache files of the aconfig_declarations
modules of the listed codegen modules to droidstubs module.

Test: m nothing --no-skip-soong-tests
Change-Id: I42eb64d3ab65e679ea733c5bb98833971e49a8e8
2024-02-14 18:52:51 +00:00
Inseob Kim
5b90d3a703 Fix characteristic rro for overridden packages
Overridden packages can have different package names. This change reads
output APKs to parse package name, instead of manifest xml.

Bug: 325011777
Test: boot and idmap2 dump
Change-Id: I748b9db8bd6282d7f3a1478cf94b21580c7683e7
2024-02-14 16:55:33 +09:00
Treehugger Robot
4532d929bf Merge "Skip passing "--product default" to aapt2" into main am: d8bab3758b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2960503

Change-Id: If075e7b1fa924b2c7e72b1deb3a0cc465d1e39c2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-14 01:52:58 +00:00
Treehugger Robot
d8bab3758b Merge "Skip passing "--product default" to aapt2" into main 2024-02-14 01:20:52 +00:00
LaMont Jones
63683e40c4 Improve determination whether to propagate JarJarProvider
Add more explicit checks to not propagate JarJarProvider when we will be
linking against stubs.

Bug: b/310504781
Test: treehugger
Merged-In: I3219d0bf7e84a386b16b248314f11b4e9edcd0fa
Change-Id: I3219d0bf7e84a386b16b248314f11b4e9edcd0fa
2024-02-13 17:04:17 -08:00
Jihoon Kang
fe914ed17f Introduce library property is_stubs_module
is_stubs_module property signifies whether the module compiles stubs or
not. The information is propagated to the reverse dependencies of the
java_library/java_sdk_library modules via JavaInfoProvider as
StubsLinkType, a ternary state that provides information about whether
the provided jars are compilation of stubs or implementation, or
unknown.

When java_sdk_library sets StubsLinkType, its state is Unknown as the
decision of providing stubs vs implementation jar differs by the reverse
dependency.

Note that this CL does NOT propagate the property up to its reverse
dependencies. This will be done in follow up CLs.

Test: m nothing
Bug: 310504781
Merged-In: Ic81488dbd1c9af1b5d31a33e5e9441d9f1416dbe
Change-Id: Ic81488dbd1c9af1b5d31a33e5e9441d9f1416dbe
2024-02-13 16:56:38 -08:00
Colin Cross
7c4dc5d185 Always use aapt2 --no-static-lib-packages
--no-static-lib-packages was removed when compiling libraries with
use_resource_processor: true enabled, but that caused problems resolving
attributes of styleables.  androidx.preference declares the "icon"
attribute inside a <declare-styleable>, but doesn't give it a format.
aapt2 refuses to create a new attribute for this case (b/131100106),
but without --no-static-lib-packages aapt2 can resolve the attribute
from the one defined in androidx.appcompat.

Bug: 294256649
Test: builds
Change-Id: I13661be83ba6501b0c2b1af8e632f260f405a370
2024-02-13 14:29:45 -08:00
Spandan Das
59bb373c64 Merge "Restrict verify_overlaps to pre S modules" into main am: 2dc86ebd3e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2958292

Change-Id: I350dea6abb51cb96bcfe8b093570ed809d8ccc62
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-13 13:58:59 +00:00
Jihoon Kang
4e0e9d3108 Merge "Add environment variable UNBUNDLED_BUILD_TARGET_SDK_WITH_DESSERT_SHA" into main am: a0ccab683b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2952892

Change-Id: I311062919b44a6d6e469f831008d9952d0c8a6aa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-13 13:56:46 +00:00
Spandan Das
2dc86ebd3e Merge "Restrict verify_overlaps to pre S modules" into main 2024-02-13 10:53:23 +00:00
Jihoon Kang
a0ccab683b Merge "Add environment variable UNBUNDLED_BUILD_TARGET_SDK_WITH_DESSERT_SHA" into main 2024-02-13 04:27:21 +00:00
Inseob Kim
10af6edc52 Skip passing "--product default" to aapt2
Because
1) it has no effect.
2) it will simplify build commands, which will minimize differences
   among targets using generate_product_characteristics_rro

Bug: 322932641
Test: TH
Change-Id: I16afae597038da7489989483f8c926916d207df5
2024-02-13 12:56:46 +09:00
Spandan Das
38c64f62cf Restrict verify_overlaps to pre S modules
The runtime in S and above does not have the same constraints that
require the hiddenapi flags to be generated in a monolithic manner.
This CL restricts the verify_overlaps to pre S modules. This will
filter out hiddenapi signature discrepancies that do not require
any action.

Test: verify_overlaps diff with this change https://diff.googleplex.com/#key=xxB0ky93hZRn
Test: presubmits
Bug: 313672880

Change-Id: Ie626a6779fc924563bec90b6c1ab0c7e8b4b23c2
2024-02-13 02:33:12 +00:00
Treehugger Robot
485ca86b31 Merge "[Ravenwood] Install transitive JNI libraries too" into main am: c521446153
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2956237

Change-Id: Ic47b8d8812223fca5bfd45871a586b8b39af9b89
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-12 23:20:56 +00:00
Jihoon Kang
842b999a53 Add environment variable UNBUNDLED_BUILD_TARGET_SDK_WITH_DESSERT_SHA
UNBUNDLED_BUILD_TARGET_SDK_WITH_DESSERT_SHA enables user to specify
${codename}.${sha} as min_sdk_version and target_sdk_version in order to
support mainline train building into android build.

Test: TH
Bug: 295905124
Change-Id: I032d464aaa7314520f98b8eafa53d962940075ce
2024-02-12 21:12:58 +00:00
Makoto Onuki
2ca8427124 [Ravenwood] Install transitive JNI libraries too
Ignore-AOSP-First: Will cherry-pick later.
Bug: 318393625
Bug: 323931246

Test: run-ravenwood-tests.sh
Test: (with local change) atest RavenwoodBivalentTest_device RavenwoodMockitoTest_device
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:55c035761c8b7b758d710ed5eeb9192525677057)
Merged-In: Ie0f6bbf1aa6252d415c53cfc19178f0986cc57f1

Change-Id: Ie0f6bbf1aa6252d415c53cfc19178f0986cc57f1
2024-02-09 16:45:43 -08:00
Jared Duke
a561efb13c Use uncompressed dex for all preopted system targets
Extend default use of uncompressed dex for non-privileged system apps
that are preopted. This avoids unnecessary disk usage on the
/system_other/ partition, as well as the marginal overhead of
extraction after mainline updates.

In total, this saves ~5-15MB cumulatively across partitions.

Bug: 318730708
Test: m + compare image sizes
Change-Id: Id0a06965e61763f59c53cbe2b327cdcf1e5d422b
2024-02-09 18:52:53 +00:00
Jihoon Kang
5c1baf9627 Merge "Enable exportable stubs to include READ_WRITE aconfig flagged apis" into main am: 63f4cb6ed5
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2952680

Change-Id: Ib2713f22f0046c989d30cd5feca95fc72f464a39
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-09 00:41:26 +00:00
Jihoon Kang
63f4cb6ed5 Merge "Enable exportable stubs to include READ_WRITE aconfig flagged apis" into main 2024-02-08 23:52:47 +00:00
Yu Liu
ca23de78ab Merge "Add dedup flag to aconfig dump-cache calls." into main am: 01beacee28
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2955616

Change-Id: I31221f46e38b6a60ccb956af9208780e123b6a86
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-08 21:33:25 +00:00
Makoto Onuki
c2e3e73deb Support native SOs in ravenwood runtime am: 68676578b1
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2952952

Change-Id: I8dc233fe93227af458fe2c0fa2c6e4d9f5cf6c56
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-08 21:33:10 +00:00
Yu Liu
01beacee28 Merge "Add dedup flag to aconfig dump-cache calls." into main 2024-02-08 20:58:55 +00:00
Yu Liu
748ade2f85 Add dedup flag to aconfig dump-cache calls.
Bug: None
Test: CI
Change-Id: I34a73576a7a7ea43178895049a0f7dbcd9e329bc
2024-02-08 19:11:39 +00:00
Makoto Onuki
68676578b1 Support native SOs in ravenwood runtime
Bug: 323931246
Test: m nothing --no-skip-soong-tests
Test: Manual test using a locally created build rule

Merged-in: Icd15d63c29560dc219dba07cc9db2a5e1b883532
Change-Id: Icd15d63c29560dc219dba07cc9db2a5e1b883532
2024-02-08 09:25:41 -08:00
Jeff Sharkey
4bbf86f4f0 Include Ravenwood tests in general-tests.
EngProd has indicated that we need to be included in that suite to
support TEST_MAPPING files in their infrastructure.

Bug: 308854804
Test: TH
Merged-in: I763b033f0f5f275091db45ab62df6af48dcddc66
Change-Id: I763b033f0f5f275091db45ab62df6af48dcddc66
2024-02-08 09:25:41 -08:00
Jeff Sharkey
ddb5152a9f Fix tests that are broken on darwin builds.
Bug: 292141694
Test: m nothing --no-skip-soong-tests
Merged-in: Ie9a2f8961a8c43bbe1388471fc0d7aadc1456c57
Change-Id: Ie9a2f8961a8c43bbe1388471fc0d7aadc1456c57
2024-02-08 09:25:41 -08:00
Makoto Onuki
4a9869d066 Add android_ravenwood_test build rule
Modeled after android_robolectric_test.

Bug: 292141694
Test: m nothing --no-skip-soong-tests
Test: m hoststubgen ravenwood-runtime tradefed atest && atest-dev HostStubGenTest-framework-test
Merged-in: Ibef8953db45b86264c8a827868793b42f8f2d6ab
Change-Id: Ibef8953db45b86264c8a827868793b42f8f2d6ab
2024-02-08 09:25:35 -08:00
Zi Wang
0a8522286e Merge "Ignore proguardRaiseTag in jarjar repackage" into main am: 5eab6d0a31
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2955307

Change-Id: I204ca7b679c250dd7617c18556d6dc5fde04f8e0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-08 00:33:44 +00:00
Zi Wang
bacee38680 Ignore proguardRaiseTag in jarjar repackage
Test: CI

Bug: 310504781

Ignore-AOSP-First: Will cp to aosp
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:ffd200a12546237b1ac0f615c73cb3c9614a8237)
Merged-In: I1c926f374cc6e0f963c32d049ea120b8fbf18eb1
Change-Id: I1c926f374cc6e0f963c32d049ea120b8fbf18eb1
2024-02-07 19:57:14 +00:00
Spandan Das
715a3892e1 Merge changes Ia899d75e,I9f885ffa into main am: f8c004263a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2951496

Change-Id: I53d240f6e28a95ec60fa43f3c68814f16841dee6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-07 01:44:15 +00:00
Jihoon Kang
5919815f80 Enable exportable stubs to include READ_WRITE aconfig flagged apis
Currently in SDK build, "exportable" stubs are used to generate the
android.jar and the corresponding build artifacts, as well as the
hiddenapi flags. "exportable" stubs only include the flagged apis that
are "enabled" and "read only", and exclude all other flagged apis. This
will be replaced with "runtime" stubs in the long run, which include
"read_write" flagged apis on top of the "enabled" and "read only" flags.

Prior to Trunk Stable, the SDK build did not distinguish the target
audience of the SDK. That is, the identical build target was used to
generate the SDK targeted toward the Google3 developers (i.e. Google3
SDK drop) and the SDK targeted toward the public (i.e. Developer
Preview). However, given that we now have "experimental" apis with Trunk
Stable, there are demands to differentiate the SDK based on the target
audience, so that the "experimental" APIs are included in the SDK
targeted toward Google3 while they are excluded in the public facing
SDK.

The long term solution to achieve this is to generate the hiddenapi
flags and (conditionally) the SDKs using the runtime stubs. However, as
this is high priority, this change resolves the problem by modifying the
filter condition of the "exportable" stubs to include the "read_write"
flagged apis on top of the "enabled" and "read only" flagged apis when
the value of the default-false build flag "RELEASE_EXPORT_RUNTIME_APIS"
is set to true.

Note that this is a temporary solution; However, we might need to keep
the "RELEASE_EXPORT_RUNTIME_APIS" build flag even in the long run to
determine what set of apis are included in the generated SDK, based on
the target audience of the SDK.

Test: m nothing --no-skip-soong-tests
Bug: 323188988
Change-Id: If0d5fa74b3ba6f4a57c86aade8d340f149a657a2
2024-02-07 01:17:59 +00:00
Spandan Das
161e468774 Use source_module_name to determine the contents of prebuilt apexes
There are a couple of instances in apex/ and java/ that rely on the naming
convention that the jars exported by prebuilt apexes follow the name of
the java_sdk_library_import, minus the prebuilt_ prefix. With muliple
module sdk prebuilts in trunk stable, this naming convention might not
be valid. Use `source_module_name` instead.

```
prebuilt_sscp_fragment {name: "", contents: ["service-foo.v2"]}
java_import {name: "service-foo.v2", source_module_name: "service-foo"},
```

We should use service-foo and not service-foo.v2 because
1. The prebuilt apex contains service-foo.dex
2. PRODUCT_*JARS will contain service-foo and not service-foo.v2

For clarity, this CL does not drop the current mechanism where prebuilt bcp
fragments create a dependency edge to prebuilt java or java_sdk_library
imports. There is still some discussion around whether we can remove
that completely (b/320711431). If we were to do that, then the
Android.bp files will become

```
prebuilt_sscp_fragment {name: "", contents: ["service-foo"]}
```

Bug: 322175508

Test: Added a unit test

Test: In internal, lunch cf_x86_64_only_phone-next-userdebug && m
nothing # .ninja files identical

Test: In internal, created a parallel set of v2 prebuilts of
java_sdk_library_import and prebuilt_bcp_fragments for adservices && m
nothing # build passes

Change-Id: Ia899d75e826fa1a559368d706eaa65835f748d40
2024-02-06 21:56:05 +00:00
Spandan Das
cc53063b07 Support mechanism to select a specific version of module sdk prebuilt
This CL is the java_system_modules_import equivalent of aosp/2928483.

With trunk stable, we will have multiple versions of art prebuilt apex
in the tree. Each art apex will contribute its own module sdk, i.e. its
own prebuilt system_modules to the build. This CL introduces a mechanism
to selelect a specific version of prebuilt system modules using
apex_contributions.

Implementation details: Create a new source_module_name property to
identify the root module. rdeps referring to the root module will get
redirected if necessary.

Bug: 322175508

Test: Added a unit test
Change-Id: I9f885ffa5afea96d2e6ce077264d3b207ed7e80d
2024-02-06 21:55:50 +00:00
Spandan Das
a75bd883f4 Merge "Mechanism to select a specific version of java_sdk_library_import" into main am: 7870d329a5
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2938840

Change-Id: Ida9a55976952aa264763cde8acd813e7a3154f83
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-06 18:38:56 +00:00
Spandan Das
7870d329a5 Merge "Mechanism to select a specific version of java_sdk_library_import" into main 2024-02-06 17:54:58 +00:00
Spandan Das
23956d12ab Mechanism to select a specific version of java_sdk_library_import
This CL is the java_sdk_library_import equivalent of aosp/2928483.

With trunk stable, we will have multiple apex prebuilts in the tree.
Each apex prebuilt will have its own module sdk. This means that it is
possible to have mutliple versions of `framework-foo` in the tree. This
CL introduces a mechanism to select a specific versioned
java_sdk_library prebuilt.

Implementation details
- Add a `source_module_name` property to java_sdk_library_import. This
  will identify the source equivalent of the jsl in packages/modules.
  This used to be implicit - i.e. the name without the prebuilt_ prefix.
  With multiple prebuilts, this has to become explicit.
- Set appropriate `source_module_name`(s) in the dynamically created
  child modules. e.g. the source_module_name on sdklib.v1.stubs and
  sdklib.v2.stubs will both be sdklib.stubs, assuming
  `source_module_name` on the top-level jsl_import is sdklib
- Add a private Created_by_java_sdk_library_name property to java_import
  and prebuilt_stubs_sources modules. This will be used to idenfity the
  top level java_sdk_library_import that was used to create these child
  modules. This is necessary because java_sdk_library_imoprt is a macro
  that creates 1:many modules. However, to avoid toil, only the
  top-level java_sdk_library_import will be listed in
  `apex_contributions`. This new property will be used for
  source/prebuilt selection in android/prebuuilt.go
- Rename BaseModuleName in commonSdkLibraryAndImportModule to
  RootLibraryName. This is necesssary because the former is now reserved
  to identify the source equivalent of a prebuilt module (maybe we
  should rename it?)

Bug: 322175508

Test: Added a unit test
Change-Id: If6aa6b0e939a07f8263874941413908383c81a78
2024-02-06 04:14:59 +00:00
Zi Wang
292c21ee68 Merge "Automatically propagate jarjar rules for aconfig libraries" into main am: 4f0b9b4289
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2951493

Change-Id: I4a7ffbda0c6326bbb64bedeee4bb8f652cd79243
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-06 00:13:36 +00:00
Joe Onorato
349ae8dd6b Automatically propagate jarjar rules for aconfig libraries
Test: treehugger
Bug: 310504781
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:97c03a6dc659102ff40793759fb3f0f18164a85b)
Merged-In: I639d12ff33175b7bed7e7d0595a40dd9b0d99367
Change-Id: I639d12ff33175b7bed7e7d0595a40dd9b0d99367
2024-02-05 22:46:00 +00:00
Spandan Das
7f606c16ef Merge "Do not replace the direct edge between rdeps and java_sdk_library" into main am: b01db714e3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2944724

Change-Id: Idba2adcc019825991b35da9c5da6b7b7556cba4d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-05 18:51:26 +00:00
Spandan Das
b01db714e3 Merge "Do not replace the direct edge between rdeps and java_sdk_library" into main 2024-02-05 17:04:55 +00:00
Spandan Das
81d95c5824 Do not replace the direct edge between rdeps and java_sdk_library
android/prebuilt.go#isSelected has a special-case inside it to ignore
apex_contributions contents for the top-level java_sdk_library hook.
This was necessary because even though we might want source stubs in
next builds, we still needed the top-level prebuilt hook to be active to
emit the dexpreopt rules to .mk.

This worked fine for rdeps that create a dependency edge on the child
stub modules of java_sdk_library. Notable examples include the full
android api stubs created by f/b/api.go. In postdeps mutator, these
expanded deps get rewritten to source/prebuilt if necesssry.

The exception to this are workflows which depend on the top-level hook
directly via `libs`. We resolve these rdeps to an appropriate provider
during GenerateAndroidBuildActions stage. This meant that rdeps were
getting prebuilt stubs of these even in next builds.

Bug: 323454855

Test: Added a unit test

Test: lunch cf_x86_64_only_phone-next-userdebug
Test: aninja -t query
out/soong/.intermediates/packages/modules/Permission/SafetyCenter/Config/safety-center-config/android_common/javac/safety-center-config.jar
| grep prebilts/module_sdk # empty now

Change-Id: Id91333d88055519f3c58ab40466f9628085f5180
2024-02-03 00:17:16 +00:00
Jihoon Kang
094cc9a9aa Merge "Modify LOCAL_DROIDDOC_* to export the exportable artifacts" into main am: 7dacb0e872
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2944801

Change-Id: I34ae89dd0a07180db9ad776a71b2711d0e4523f7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-02 20:38:00 +00:00
Jihoon Kang
7dacb0e872 Merge "Modify LOCAL_DROIDDOC_* to export the exportable artifacts" into main 2024-02-02 19:51:14 +00:00
Jihoon Kang
246690a400 Modify LOCAL_DROIDDOC_* to export the exportable artifacts
LOCAL_DROIDDOC_STUBS_SRCJAR is used to copy entries to OUT_DOCS in
build/make/core/soong_droiddoc_prebuilt.mk, which defines the copy rules
to generate the docs. When generating the documentation, the exportable
stubs should be set as dependencies, so that disabled flagged apis are
not exposed. Thus, this change modifies the entries passed to
LOCAL_DROIDDOC_STUBS_SRCJAR from the everything stubs to the exportable
stubs.

Likewise, all other LOCAL_DROIDDOC_* entries are copied to dist during
sdk builds. Therefore, this change replaces the everything artifacts to
the exportable artifacts.

This change also config-guards the exportable stubs generation, so that
the exportable stubs are not generated when the droidstubs module does
not generate the stubs.

Test: m docs dist && inspect ninja file to verify that everything stubs are not exported
Bug: 323261972
Change-Id: Ic04fb47ad311aefafc2f1a7b8bb15525050ecd2e
2024-02-02 18:21:27 +00:00
Treehugger Robot
caf3676945 Merge "Determine GC type based on BUILT_KERNEL_VERSION_FILE." into main am: d8cb9505f8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2919746

Change-Id: I8f5460e206ecfb91af61346b7e2a15f78fced4fa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-02 03:26:26 +00:00
Jihoon Kang
f10ad16f31 Merge "Fix api versions xml file handling in droidstubs" into main am: c240996829
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2929610

Change-Id: I336764a515a61ac7565e85760bfb56d7c2253824
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-02 03:25:45 +00:00
Treehugger Robot
d8cb9505f8 Merge "Determine GC type based on BUILT_KERNEL_VERSION_FILE." into main 2024-02-02 03:01:57 +00:00
Jihoon Kang
c240996829 Merge "Fix api versions xml file handling in droidstubs" into main 2024-02-02 02:31:17 +00:00
Jiakai Zhang
7d292228c1 Determine GC type based on BUILT_KERNEL_VERSION_FILE.
How it works:
1. build/make/core/Makefile generates a txt file with the kernel
   version, which is taken from an explicit BOARD_KERNEL_VERSION value,
   or extracted from the kernel image on the source tree, or extracted
   from the kernel image extracted from the prebuilt boot.img.
   The file is saved at
   $ANDROID_PRODUCT_OUT/obj/PACKAGING/check_vintf_all_intermediates/kernel_version.txt.
2. If PRODUCT_ENABLE_UFFD_GC is "default", meaning the GC type needs to
   be determined by the kernel version, build/make/core/Makefile copies
   kernel_version.txt to
   out/soong/dexpreopt/kernel_version_for_uffd_gc.txt.
3. build/soong/dexpreopt/config.go writes the the UFFD GC flag to
   out/soong/dexpreopt/uffd_gc_flag.txt. The flag is determined by an
   explicit PRODUCT_ENABLE_UFFD_GC value or by contruct_uffd_gc_flag.py,
   which reads kernel_version_for_uffd_gc.txt and determines the flag
   accordingly.
4. dex2oat takes the UFFD GC flag from uffd_gc_flag.txt.
5. post_process_props.py mangles ro.dalvik.vm.enable_uffd_gc based on
   the same logic.

Bug: 321751629
Bug: 319554951
Bug: 318763448
Bug: 319648491
Test: m --no-skip-soong-tests nothing
Test: atest uffd_gc_utils_test
Test: Build with `OVERRIDE_ENABLE_UFFD_GC=default m` for device with no
  UFFD support -
  1. Check the existence of `-Xgc:CMC` in
     out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm64/boot.invocation
     (dex2oat invocation for a boot image)
  2. Check the existence of `-Xgc:CMC` in
     out/soong/.intermediates/packages/apps/Settings/Settings/android_common/dexpreopt/Settings/oat/arm64/package.invocation
     (dex2oat invocation for an app defined in .bp)
  3. Check the existence of `-Xgc:CMC` in
     $ANDROID_PRODUCT_OUT/obj/APPS/Dialer_intermediates/oat/arm64/package.invocation
     (dex2oat invocation for an app defined in .mk)
  4. Check the value of ro.dalvik.vm.enable_uffd_gc in
     $ANDROID_PRODUCT_OUT/product/etc/build.prop
Test: Build with `OVERRIDE_ENABLE_UFFD_GC=default m` for device with
  UFFD support, and do the steps above.
Test: Build with `OVERRIDE_ENABLE_UFFD_GC=true m`, and do the steps
  above.
Test: Build with `OVERRIDE_ENABLE_UFFD_GC=false m`, and do the steps
  above.

Change-Id: I035ad32233e49e2a30ce11f6c7c318a648511ef8
2024-02-02 09:23:37 +08:00
Jihoon Kang
d9a0694ac3 Fix api versions xml file handling in droidstubs
Api levels annotations flags should respect the stubs type, but the
everything api versions xml file was being passed to the metalava
invocation for both everything and exportable metalava invocation.

This change fixes such issue by setting api versions xml file (passed to
metalava as --apply-api-levels argument) to respect the stubs type.

Test: m nothing --no-skip-soong-tests
Bug: 319162970
Change-Id: If7155b3701b32fb4cd81dc918648b449de090201
2024-02-02 00:36:04 +00:00
Spandan Das
e0d8cb2569 Merge "Propagate profile_guided requirement of imports to top-level apex" into main am: f3c63e6743
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2929189

Change-Id: I8f2014dd08b273f0fc3f3c3bff849078abf7914f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-30 22:56:21 +00:00
Spandan Das
6a830dc530 Merge "Support mechanism to select a specific version of module sdk prebuilt" into main am: 5809f65748
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2935330

Change-Id: I300fa14f92d53d87c6fa51517974e3450bd1c836
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-30 22:56:10 +00:00
Treehugger Robot
3691588436 Merge "Disable stub validation when WITHOUT_CHECK_API=true" into main am: e288043ee7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2935430

Change-Id: Ia0a4e03608b56eef00eb1585da26213bee949e27
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-30 22:54:59 +00:00
Spandan Das
f3c63e6743 Merge "Propagate profile_guided requirement of imports to top-level apex" into main 2024-01-30 22:50:38 +00:00
Spandan Das
5809f65748 Merge "Support mechanism to select a specific version of module sdk prebuilt" into main 2024-01-30 22:43:33 +00:00
Treehugger Robot
e288043ee7 Merge "Disable stub validation when WITHOUT_CHECK_API=true" into main 2024-01-30 22:20:21 +00:00
Xin Li
14a55a9b82 Merge Android 24Q1 Release (ab/11220357)
Bug: 319669529
Merged-In: I763b033f0f5f275091db45ab62df6af48dcddc66
Change-Id: I65077e51b4a073f2628fb0995e80ad64368def26
2024-01-30 10:34:06 -08:00
Spandan Das
2ea84dd0dc Propagate profile_guided requirement of imports to top-level apex
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
2024-01-30 18:04:52 +00:00
Jihoon Kang
4f04df9f50 Disable stub validation when WITHOUT_CHECK_API=true
Even when building stubs from source, the rules for the
java_api_library modules are generated although they are not
executed. This leads to NPE, as setting `WITHOUT_CHECK_API=true`
prevents `checkCurrentApiTimestamp`, which the java_api_library modules
depend on, from being generated.

To prevent the NPE, this change prevents the `checkCurrentApiTimestamp`
from being registered as the dependency of the java_api_library modules
when `WITHOUT_CHECK_API=true` is set.

Test: BUILD_FROM_SOURCE_STUB=true WITHOUT_CHECK_API=true m nothing
Bug: 320601440
Change-Id: I4f19e30d9cd74bdc20dde0d14884fb03ff223ccb
2024-01-30 02:40:20 +00:00
Spandan Das
3cf0463a47 Support mechanism to select a specific version of module sdk prebuilt
This CL is the java_(test_)_import equivalent of aosp/2928483.

With trunk stable, we will have
multiple prebuilts of the prebuilt java .jars in
prebuilts/module_sdk/art/<v>/test-exports/, and this CL introduces a
mechanism to use apex_contributions to select a specific versioned
prebuilt when building.

Implementation details: Create a new source_module_name property to
identify the root module. rdeps referring to the root module will get
redirected if necessary. This property also
becomes the stem, if `stem` is not set explicitly.

Bug: 322175508

Test: Added a unit test
Change-Id: I2dff38acdf2002355586dbb2be8c1f98af4741f7
2024-01-30 01:59:51 +00:00
Treehugger Robot
59739666e6 Merge "Prevent disabling checks via flags property" into main 2024-01-30 00:14:17 +00:00
Cole Faust
5d0aaf42db Prevent disabling checks via flags property
strict_updatability_linting currently only checks that updatability
checks aren't disabled via disabled_checks / warning_checks, you could
get around it using the `flags` property. Only allow controlling checks
via the *_checks properties.

Bug: 322802379
Test: m nothing --no-skip-soong-tests
Change-Id: Ia311622e1409f9cc201ab55f8749f2d13fccf551
2024-01-29 14:48:23 -08:00
Treehugger Robot
5a48d4fe3d Merge "Fix the args used to dexpreopt system server jars in prebuilt apexes" into main 2024-01-26 21:55:59 +00:00
Treehugger Robot
99ed03f4fe Merge "Add build flag to enable ResourceProcessorBusyBox by default" into main 2024-01-26 19:07:25 +00:00
Spandan Das
e21a8d4dc6 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
2024-01-26 18:06:41 +00:00
Colin Cross
8f1b033cf7 Add build flag to enable ResourceProcessorBusyBox by default
Setting the RELEASE_USE_RESOURCE_PROCESSOR_BY_DEFAULT build flag will
change the default for use_resource_processor from false to true.

Bug: 294256649
Test: builds
Change-Id: If643bf8db9e2e039200f63f4aac226ed5b44d9e0
2024-01-26 09:09:42 -08:00
Colin Cross
e28cdf362e Merge "Convert coverageMutator to a TransitionMutator" into main 2024-01-25 23:19:29 +00:00
Cole Faust
1627236844 Merge "Make hiddenAPIFlagFileCategory an int" into main 2024-01-25 22:42:39 +00:00
Asmita Poddar
1f4475cee1 Merge "Revert "Ensure sscp jars get copied to $OUT/soong/system_server_dexjars"" into main 2024-01-25 10:08:11 +00:00
Spandan Das
b2fd4ff43f Revert "Ensure sscp jars get copied to $OUT/soong/system_server_dexjars"
This reverts commit 0b7089f134.

Reason for revert: Breaks auto builds https://groups.google.com/a/google.com/g/android-build-police/c/DfXeyxkyfYk/m/4SvZa-jkAAAJ

Change-Id: Ia6ebdf64d03284d2318978c35cb87fd4f0b79531
2024-01-25 04:25:38 +00:00
Spandan Das
9d4ad66a93 Merge "Ensure sscp jars get copied to $OUT/soong/system_server_dexjars" into main 2024-01-25 01:27:18 +00:00
Jihoon Kang
dbc88dc4d0 Merge "Prepare to generate "runtime" stubs in droidstubs" into main 2024-01-24 21:30:38 +00:00
Colin Cross
f5f4ad3db6 Convert coverageMutator to a TransitionMutator
Convert coverageMutator to a TransitionMutator as a step towards
variants-on-demand.

Bug: 319288033
Test: coverage_test.go
Test: treehugger coverage builds
Change-Id: Ic50c0040dea8b42c36b5d784221daa00b7b0d379
2024-01-24 10:17:10 -08:00
Jihoon Kang
5373efc1c7 Merge "Error when WITHOUT_CHECK_API=true in from-text stub build" into main 2024-01-24 18:06:53 +00:00
Spandan Das
0b7089f134 Ensure sscp jars get copied to $OUT/soong/system_server_dexjars
(This was missed in aosp/2876756, which copied only the bcp jars)

This hardcoded location is used by dex2oat to compile the dexpreopt
artifacts. The copy rules are currently generated by java_(sdk)_library
for source builds, and their prebuilt counterparts in prebuilt builds.

After this change, the copy rule will be bifurcated between source and
prebuilt builds
1. For source builds, it will come from java_(sdk)_library
2. For prebuilt builds, it will come from the top-level prebuilt apex.
   Since there can be multiple prebuilt apexes in trunk stable,
   HideFromMake will be used to determine which deapexed jar to copy.

The bifurfaction is expected to be temporary. It is needed for now since
the `apex_contributions` which will be used for source vs prebuilt
selection have not been populated completely.

Test: Added a unit test
Test: Presubmits
Test: git_master-art-host:
art-gtest (https://android-build.corp.google.com/builds/abtd/run/L40800030001459791)
Test: git_main:art_standalone_tests
(https://android-build.corp.google.com/builds/abtd/run/L09000030001463855)

Bug: 308790457

Change-Id: I3105d3b3a7e5c41cb601d07806f4ea483a61b50a
2024-01-24 05:14:40 +00:00
Cole Faust
22e8abcaa6 Make hiddenAPIFlagFileCategory an int
hiddenAPIFlagFileCategory used to contain function pointers, and is
used in a provider. Providers must be serializable for incremental
soong support, so the function pointers must be removed.

Refactor hiddenAPIFlagFileCategory into a simple int.

Bug: 322069292
Test: m nothing --no-skip-soong-tests
Change-Id: I2bd50fa1b59979f30869b405314cbef16ee345f1
2024-01-23 18:01:47 -08:00
Jihoon Kang
91bf3dd4ac Error when WITHOUT_CHECK_API=true in from-text stub build
Given that WITHOUT_CHECK_API=true is incompatible with from-text stub
build, this change makes the module raise an error when the two
conflicting configurations are set.

This change also modifies the checkapi error message, that
DISABLE_STUB_VALIDATION does not bypass checkapi.

Test: m nothing --no-skip-soong-tests && WITHOUT_CHECK_API=true m nothing
Bug: 322060779
Change-Id: I597309baa8fcfbefa05863c7b392bfb8b6774cea
2024-01-24 01:21:47 +00:00
Jihoon Kang
fbe572b064 Merge "Rename apiScope.stubsTag" into main 2024-01-23 01:43:55 +00:00
Jihoon Kang
ee11328709 Prepare to generate "runtime" stubs in droidstubs
In order to prepare generating "runtime" stubs in droidstubs, this
change performs some cleanups, which are:

- Modify droidstubs providers methods to take a StubsType enum as an
  input, in order to remove exportable-specific providers. The methods
  are also modifed to return an error when the artifact is not provided
  for the input StubsType.

- Wrap droidstubs artifact to a struct. This removes artifacts common to
  all stubs types from being written out as a individual module property
  (e.g. exportableAnnotationsZip -> exportableArtifacts.annotationsZip)

Test: m nothing --no-skip-soong-tests
Bug: 319162970
Change-Id: I6d6c57c5417ca71eab5ddda7981b71fd84fa6ee1
2024-01-23 00:29:25 +00:00
Jihoon Kang
b743155a26 Rename apiScope.stubsTag
The different roles of stubs (e.g. dependency to java modules,
hiddenapi, dist to sdk snapshot) are now split to different set of stubs
(everything, exportable and eventually runtime), while a single set of
stubs are responsible for all roles for the prebuilt stubs. Thus, the
stubs from source are depending different stubs tag (e.g.
everythingStubsTag, exportableStubsTag), while the prebuilt stubs
utilize stubsTag. Given that this tag is only used for the prebuilt
stubs, it can be renamed to `stubsTag`.

Test: m nothing --no-skip-soong-tests
Bug: 319162970
Change-Id: Iacdf434fab6a403482fd2f1de24e6f260ad80756
2024-01-22 19:40:08 +00:00
Colin Cross
1b1b9a937b Merge changes from topic "soong-tests-presubmit" into main
* changes:
  Add script to run Soong tests with go tools
  Disable TestVariantSingletonModule when go test -short is used
  Fix data race in propagateRROEnforcementMutator
  Fix data race in finder_test.go
  Fix data race in dex_bootjars
  Fix race CommonGlobalCflags when running tests in parallel.
  Fix data race in snapshot singletons when running parallel tests
2024-01-18 23:58:45 +00:00
Colin Cross
7e6a9012c0 Fix data race in propagateRROEnforcementMutator
propagateRROEnforcementMutator walks dependencies of each module and
modifies them via SetRROEnforcedForDependent.  That is unsafe in a
parallel mutator, as the same dependency could be being visited by
two parent modules at the same time.  Don't mark it as a parallel
mutator.

Test: go test -race ./...
Change-Id: I9870aaa7d165bf72b751e3ceff5a2a3eb4d74ec4
2024-01-18 13:23:06 -08:00
Treehugger Robot
193bb8c317 Merge "Add better error handling to bootDexJar function" into main 2024-01-18 20:38:13 +00:00
Colin Cross
84ed511ceb Fix data race in dex_bootjars
Move fields in bootImageConfig that are written during
GenerateAndroidBuildActions into a provider to avoid a data race.

Test: go test -race ./...
Change-Id: I0d6783530843889b96f32d748bda7824493d2e32
2024-01-17 16:10:37 -08:00
Spandan Das
3a3920129d Add better error handling to bootDexJar function
aosp/2876754 missed adding error handling to one of the places which
consumes the dex jar deapexed from prebuilt apexes. This CL ensures that
when we have multiple prebuilt apexes _without_ flagging, the hiddenapi
processing code emits a more descriptive error "Multiple deapxers..."
rather than a cryptic error "<module> does not provide a dex jar"

Test: m nothing --no-skip-soong-tests

Change-Id: I80849fa7cca17d724ac53c94bb353b169175ee28
2024-01-17 20:59:43 +00:00
Treehugger Robot
c0412f5d31 Merge "Remove HideFlaggedApi() related logic and the related product variables" into main 2024-01-17 00:20:54 +00:00
Jihoon Kang
78b6b30aec Remove HideFlaggedApi() related logic and the related product variables
With the recent build changes to support generating mainlin module sdk
with flagged apis, the build no longer depends on the values of these
product variables in exposing the flagged apis, but these are determined
by the aconfig flags. Given that these variables are no longer used,
this change removes these variables and the variables dependent code.

Test: m nothing --no-skip-soong-tests
Bug: 320515715
Change-Id: I6af94da73cc7fc7ffce670928aad81cec5d383b4
2024-01-16 20:20:27 +00:00
Treehugger Robot
535f739153 Merge "Disable prebuilt apps without an apk later" into main 2024-01-16 18:25:30 +00:00
Treehugger Robot
ce8d254149 Merge "Implicitly bump up Java target to 1.8" into main 2024-01-16 18:09:41 +00:00
Sorin Basca
d567a514ee Implicitly bump up Java target to 1.8
Bug: 320294595
Test: m
Change-Id: I693e564c67d17254d68f3a9c16664c1da93b9488
2024-01-15 16:38:46 +00:00
David Srbecky
cf33b025d9 Merge "Revert^7 "Enable dex container (DEX v41) for the whole system"" into main 2024-01-15 11:10:45 +00:00
Yanning Jia
43668c6f13 Revert^7 "Enable dex container (DEX v41) for the whole system"
This reverts commit 7022550d0e.

Reason for revert: Breaks app's DRM

Bug: 317744117
Change-Id: I539e6ec037db1c297fe7cf85d294bebe963ab214
2024-01-15 11:09:32 +00:00
Cole Faust
97494b197e Disable prebuilt apps without an apk later
Currently, android_app_import modules get disabled during their load
hook if they don't have a set `apk` property. This causes them to be
disabled before soong config variables can be applied, which would've
set the apk property.

Move the disabling into a DefaultableHook, which will run after the
soong config variables.

Bug: 319897584
Test: m nothing --no-skip-soong-tests
Change-Id: Ia0f6a39c35b3b11249bfa74ad532858189be24b1
2024-01-12 17:02:58 -08:00
Jihoon Kang
7e9343b889 Merge changes from topic "hiddenapi_exportable" into main
* changes:
  Copy exportable artifacts to module sdk snapshot
  Enable hiddenapi check for exportable stubs
  Add defaults support for bootclasspath_fragment module type
2024-01-12 23:50:37 +00:00
Jihoon Kang
f55a5f7b37 Copy exportable artifacts to module sdk snapshot
This change modifies the copy rules of the sdk_library when generating
the module sdk snapshots so that the exportable artifacts (annotations
zip, api file, removed api file, srcjar file) are copied instead of the
everything artifacts.

In order to satisfy the prebuilts compatibility, this feature is flag
guarded by the build flag "RELEASE_HIDDEN_API_EXPORTABLE_STUBS"

Test: m --no-skip-soong-tests
Bug: 315027929
Change-Id: I8bf5bb1f196aa9b5db78ba4677caa5f4337e3021
2024-01-12 01:50:19 +00:00
Jihoon Kang
bd093457e2 Enable hiddenapi check for exportable stubs
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
2024-01-12 01:03:10 +00:00
Jihoon Kang
9272dccb1e Add defaults support for bootclasspath_fragment module type
This change transforms the bootclsspath_fragment module into a
defaultable module, in order to modify the "art-bootclasspath-fragment"
module definition based on the build flag in
https://r.android.com/2897389

Test: m nothing
Bug: 315027929
Change-Id: I01ba7b15e4fcdea9bd31c369110a3c9ee38bc9f6
2024-01-12 01:02:45 +00:00
LaMont Jones
afe7baf47d Propagate aconfig providers for more modules.
Bug: 308625757
Test: manual
Change-Id: Iaf6d45a4259f1c6c34476c34c431344283ae2830
2024-01-10 14:03:30 +00:00
LaMont Jones
acae2d7656 move SetAconfigFileMkEntries to android
This will need to be called by some modules handled in android.

Bug: 308625757
Test: manual
Change-Id: Ic56e8ef3a453c59866aab6d39a21108cf8536b56
2024-01-10 14:03:29 +00:00
Dennis Shen
2127887e32 Merge "Enforce one aconfig_declaration per aconfig package" into main 2024-01-10 12:46:06 +00:00
Treehugger Robot
d06bdb0310 Merge "Update released flagged apis rule" into main 2024-01-10 02:00:54 +00:00
Dennis Shen
4e7773d81e Enforce one aconfig_declaration per aconfig package
Bug: b/319121098
Change-Id: Ibe3f1587ed7754f00f464cf385ce51ee9a142412
2024-01-10 01:53:49 +00:00
Jihoon Kang
125b0a7639 Update released flagged apis rule
The aconfig command has been recently updated to fully specify the
output format instead of passing the keyword format (e.g., bool). This
change reflects the change in the aconfig tool.

Test: m art.module.public.api && inspect the generate released-flagged-apis-exportable.txt output
Change-Id: I620b7f34c346288ca87342448f50a0e90813304f
2024-01-10 00:59:12 +00:00
Treehugger Robot
ec3887ad2f Merge "Replace panic with ModuleErrorf" into main 2024-01-10 00:16:52 +00:00
Spandan Das
59a4a2b8d2 Replace panic with ModuleErrorf
This is a followup cleanup for aosp/2876754 and replaces panic with
ctx.ModuleErrorf. The latter creates a more expressive build error.

Implementation details
- export moduleErrorf interface from build/soong/android. This minimal
  interface will be used as a parameter for `DexJarBuildPath`
- Add ModuleErrorf to the function signature of DexJarBuildPath. This
  parameter only gets used for Import and SdkLibraryImport structs.
  These two can have duplicate deapexer definitions, and ModuleErrorf
  will be used to report that error
- Create a minimal implementation of `ModuleErrorf` in tests of java and
  apex

Test: m nothing --no-skip-soong-tests
Change-Id: I0febec651f40c3f04deb957e64133c94b80fbd78
2024-01-09 22:53:52 +00:00
Jihoon Kang
150d87fce0 Fix the static rule for generating the revert annotations
While the static rule depends on the keep-flagged-apis binary, the
command deps was mistakenly not specified. This change fixes the rule.

Test: m
Change-Id: I4875ac516e0e03389eb6a09d720c94f28710fbc9
2024-01-09 19:23:36 +00:00
Jihoon Kang
539b46b6bd Merge "Generate "exportable" stubs library in java_sdk_library" into main 2024-01-09 06:02:12 +00:00
Jihoon Kang
0d2afbbfc0 Merge "Enable droidstubs to export "exportable" artifacts" into main 2024-01-09 06:01:51 +00:00