Commit graph

7412 commits

Author SHA1 Message Date
Chris Antol
6482cb97cd Merge "Revert^5 "Enable dex container (DEX v41) for the whole system"" into main 2023-12-15 19:01:34 +00:00
Chris Antol
a33691288e Revert^5 "Enable dex container (DEX v41) for the whole system"
This reverts commit d45836eb38.

Reason for revert: Still breaks tests

Bug: 314212435
Change-Id: I35867878c9a8b2aa3d64092a5326c42191569adc
2023-12-15 18:15:51 +00:00
David Srbecky
a6bc7c87bd Merge "Revert^4 "Enable dex container (DEX v41) for the whole system"" into main 2023-12-15 13:05:51 +00:00
Colin Cross
5a37718c95 Convert ModuleProvder to generic providers API
Convert all of the callers of ModuleProvider/ModuleHasProvider to use the
type-safe android.SingletonModuleProvider API.

Bug: 316410648
Test: builds
Change-Id: I6f11638546b64749e451cebbf33140248dc1d193
2023-12-14 16:12:22 -08:00
Colin Cross
313aa5475f Convert OtherModuleProvider to generic providers API
Convert all of the callers of OtherModuleProvider/OtherModuleHasProvider
to use the type-safe android.OtherModuleProvider API.

Bug: 316410648
Test: builds
Change-Id: Id77f514d68761a262d9ea830a601dbed804bbbe5
2023-12-14 16:12:22 -08:00
Colin Cross
ff694a8c88 Convert Provider to generic providers API
Convert all of the callers of Provider/HasProvider to use the type-safe
android.ModuleProvider API.

Bug: 316410648
Test: builds

Change-Id: I73479de1625fa2865b6c73444cd477e50d56dc5a
2023-12-14 16:12:21 -08:00
Colin Cross
402130276c Convert SetProvider to generic providers API
Convert all of the callers of SetProvider to use the type-safe
android.SetProvider API.

Bug: 316410648
Test: builds
Change-Id: If58f4b5355264ddab2045bc3591a4eac19cd58fc
2023-12-14 16:12:20 -08:00
Colin Cross
bc7d76cca2 Convert NewProvider/NewMutatorProvider to generic providers API
Convert all of the callers to NewProvider and NewMutatorProvider
to use a generic type parameter instead of an example object.

Bug: 316410648
Test: builds
Change-Id: Ic9cdafc87336e26730d3fd596df05de0e7267542
2023-12-14 16:12:20 -08:00
Colin Cross
3c0a83d19f Use generics for providers API
Using generics for the providers API allows a type to be associated
with a ProviderKey, resulting in a type-safe API without that doesn't
require runtime type assertions by every caller.

Unfortunately, Go does not allow generic types in methods, only in
functions [1].  This prevents a type-safe API on ModuleContext, and
requires moving the API to be functions that take a ModuleContext as
a parameter.

This CL creates the new API, but doesn't convert all of the callers.

[1] https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md#no-parameterized-methods)

Bug: 316410648
Test: builds
Change-Id: I3e30d68b966b730efd968166a38a25cc144bd6de
2023-12-14 16:12:20 -08:00
Colin Cross
e8eeec913f Fix TestAarImportProducesJniPackages/aar-no-jni
TestAarImportProducesJniPackages was attempting to assert that an
aar_import module always had a JniPackageProvider, but was instead
asserting that the return type was always a JniPackageInfo.  Since
ModuleProvider returned the zero value of JniPackageInfo even when
there was no provider that was always true.

Fix aar_import to always set JniPackageProvider.

Test: TestAarImportProducesJniPackages
Change-Id: Idaf106e14373490d4eb807892e174aaaf094bbcf
2023-12-14 16:12:20 -08:00
Cole Faust
c01104234e Merge "Allow compile_data on all java modules" into main 2023-12-14 21:44:46 +00:00
Cole Faust
2b64af861a Allow compile_data on all java modules
art java_test modules need to specify compile_data, make it common
to all java modules.

Bug: 307824623
Test: m lint-check
Change-Id: I68640f14137f9cadaf0c454d3b5abc9e2d1d9b4b
2023-12-13 18:22:18 -08:00
Yu Liu
6dc93f9a09 Properly package aconfig files for vendor partition
Bug: 311173471
Test: Unit tests
Change-Id: Ibb857b69c3f83326a9ff5732e11dd09887e4ba6e
2023-12-14 01:19:35 +00:00
Paul Duffin
7ac943f7e1 Use --revert-annotation instead of --hide-annotation
Use of `--hide-annotation android.annotation.FlaggedApi` was always an
intermediate solution until the required semantics for `@FlaggedApi`
was determined. The `--revert-annotation` option provides those
semantics. When the `@FlaggedApi` is applied to an existing API, e.g.
because it has moved from system to public, or because it has changed
in some way, e.g. modifiers, then the correct semantics for when that
API is not required is not to hide the API but to revert it to what it
was before the change necessitating the `@FlaggedApi` annotation was
made.

Use --revert-annotation instead of --hide-annotation

Use of `--hide-annotation android.annotation.FlaggedApi` was always an
intermediate solution until the required semantics for `@FlaggedApi`
was determined. The `--revert-annotation` option provides those
semantics. When the `@FlaggedApi` is applied to an existing API, e.g.
because it has moved from system to public, or because it has changed
in some way, e.g. modifiers, then the correct semantics for when that
API is not required is not to hide the API but to revert it to what it
was before the change necessitating the `@FlaggedApi` annotation was
made.
Use --revert-annotation instead of --hide-annotation

Use of `--hide-annotation android.annotation.FlaggedApi` was always an
intermediate solution until the required semantics for `@FlaggedApi`
was determined. The `--revert-annotation` option provides those
semantics. When the `@FlaggedApi` is applied to an existing API, e.g.
because it has moved from system to public, or because it has changed
in some way, e.g. modifiers, then the correct semantics for when that
API is not required is not to hide the API but to revert it to what it
was before the change necessitating the `@FlaggedApi` annotation was
made.

Bug: 314196587
Test: ./gradlew
Change-Id: Ic97f29dd2b9f598ba0851f5f622c2a2724f18037
2023-12-13 00:33:25 +00:00
Colin Cross
a72573a727 Merge "Remove ConvertWithBp2build implementations" into main 2023-12-11 23:12:53 +00:00
Treehugger Robot
b49f038231 Merge "Add compile_data for android apps" into main 2023-12-11 19:25:20 +00:00
Tor Norbye
2624653aa9 Merge "303434307: Enable flagged API checking" into main 2023-12-11 18:14:56 +00:00
Colin Cross
8ff105860d Remove ConvertWithBp2build implementations
Remove the ConvertWithBp2build implementations from all the module
types, along with the related code.

Bug: 315353489
Test: m blueprint_tests
Change-Id: I212672286686a318893bc7348ddd5a5ec51e77a7
2023-12-08 13:51:05 -08:00
Cole Faust
df1efd7251 Add compile_data for android apps
Compile_data is a property on rust rules to declare extra files
that are used by the compiler. In rust's case this happens commonly
with `include_str!()`.

Other compilers like javac or aapt2 don't often reach out to other
files, so it's not as neccessary. But they will follow symlinks.
We're making a change to only include symlinks themselves in sbox
sandboxes, and the targets of the symlinks must be listed
explicitly. For this, we need compile_data to list the targets
of symlinks.

Bug: 307824623
Test: m out/soong/.intermediates/frameworks/base/tools/aapt2/integration-tests/SymlinkTest/AaptSymlinkTest/android_common/lint/lint-baseline.xml with the symlink change
Change-Id: I33eb9cbe4b6eb25e3f33ea0ac9dade88c3d4a624
2023-12-08 12:34:42 -08:00
Cole Faust
558e2bd19c Merge "Fix typo in the comment" into main am: 2237d24894
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2865414

Change-Id: I6ecf98ae6cd00dc10518716673acea89f7114f2c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-08 18:09:10 +00:00
Cole Faust
2237d24894 Merge "Fix typo in the comment" into main 2023-12-08 17:32:43 +00:00
Tor Norbye
cabafdeee0 303434307: Enable flagged API checking
Also downgrade the new UseSdkSuppress check from error to warning.
And temporarily downgrades FlaggedApi from error to warning until
existing violations are resolved.

Test: The build
Bug: 303434307
Change-Id: Id7802621d567815470dee1aeb815abe214f098cd
2023-12-08 15:44:20 +00:00
Jihoon Kang
1ed5d5ca20 Merge changes from topic "aconfig_dump_map" into main am: 25c187cc7d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2854663

Change-Id: I0d9212e36959c7964e6cbff7228b5ff5dabad32a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-08 10:27:20 +00:00
Yuichiro Hanada
e42ac1c79b Fix typo in the comment
Bug: None
Test: m soong_docs and check the generated soong_build.html

Change-Id: I72dd87915f8f5225600365d8ef3f6b9c337a5dbc
2023-12-08 12:23:15 +09:00
Jihoon Kang
84b2589e6d Add aconfig flag support for android_app
This change adds an overrideable property flags_packages to android_app,
which is used to list the aconfig_declarations module names that the app
depends on. The build action of android_app is modified to pass all
flags text file provided by the aconfig_declarations to aapt2 link as
--feature-flags arguments.

Test: m nothing --no-skip-soong-tests
Bug: 306024510
Change-Id: I4924f88b9954950cc1936a472cd7ac70f41add5d
2023-12-07 23:01:26 +00:00
Colin Cross
4c803a0355 Merge aconfig files per-module am: d788b3e6cb
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2860765

Change-Id: Ie43ca8826156ff580618cdeda0337db270a82e62
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-07 22:37:13 +00:00
Colin Cross
d788b3e6cb Merge aconfig files per-module
Passing the list of all transitive aconfig files to Make causes extra
Kati analysis runs when dependencies are changed in Android.bp files.
Since Make is going to merge them anyways, merge them per-module and
pass a single aconfig file to Make for each module.

Fixes: 313698230
Test: m out/target/product/vsoc_x86_64/system/etc/aconfig_flags.pb
Change-Id: Ifde4826bc93bc06e40338f72b4cb39eed26ca08d
2023-12-07 04:17:37 +00:00
Aditya Choudhary
d798f5c879 Merge changes from topic "code_metadata" into main am: 4c3e2df157
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2852607

Change-Id: Icc9c1eda9b93e1ec897425b98cb8f16f83431409
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-06 08:11:06 +00:00
Aditya Choudhary
7d37796d24 Add Code Metadata rule to soong/testing. am: 8094b6bf9d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2786121

Change-Id: I40154b3f9d2c170cb7aacbf6f0b9383b2e87f444
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-06 08:11:01 +00:00
Aditya Choudhary
26df39fe44 Add source file provider for genrule/srcs, python libraries and rust libraries.
Change-Id: I2d7d4684a10c15aeecc27b8db800ab27a807d2e2
2023-12-05 19:56:26 +00:00
Aditya Choudhary
8094b6bf9d Add Code Metadata rule to soong/testing.
This Cl adds a new rule to Soong to generate code ownership metadata. Also, this CL adds a provider in the Java SDK library to provide generated source files to the Code_metadata rule. Will add providers to other libraries in the future changes.

Bug: 296873595
Change-Id: Ic2e43aa9b161231fea4416d1f0d36b778361d7c5
2023-12-05 18:10:03 +00:00
David Srbecky
d45836eb38 Revert^4 "Enable dex container (DEX v41) for the whole system"
This reverts commit 0968a93679.

Reason for revert: Reland

Change-Id: I78a0097b9bea6da83dbab2fd507670bbf2edab35
2023-12-05 12:01:40 +00:00
Colin Cross
078254139c Merge "Add TestContext parameter to ContentFromFileRuleForTests" into main am: 2998c33d43
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2817720

Change-Id: Iaf65c68d8c427a5d991401f85bd1c220b2303a9b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-05 01:37:56 +00:00
Colin Cross
2998c33d43 Merge "Add TestContext parameter to ContentFromFileRuleForTests" into main 2023-12-05 00:29:10 +00:00
Colin Cross
f61d03d241 Add TestContext parameter to ContentFromFileRuleForTests
The next CL will need a TestContext parameter in
ContentFromFileRuleForTests in order to retrieve the file rule contents
from the Config.  Add it and update all the tests that use it in order
to simply review of the next CL.

Bug: 306029038
Test: go test ./...
Change-Id: Ia4b4c9854017ea3472fa2f8ba42cf7f72720496e
2023-12-03 17:22:56 -08:00
Serdar Kocdemir
96e84f84ac Merge "Revert^3 "Enable dex container (DEX v41) for the whole system"" into main am: 3d11d51733
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2852551

Change-Id: Ideb430cdb884fde634ff497108ba63228e3bc3f6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-01 16:22:21 +00:00
Serdar Kocdemir
3d11d51733 Merge "Revert^3 "Enable dex container (DEX v41) for the whole system"" into main 2023-12-01 15:39:47 +00:00
Serdar Kocdemir
0968a93679 Revert^3 "Enable dex container (DEX v41) for the whole system"
This reverts commit e4d0e949ce.

Reason for revert: test monitor b/314212435 

Change-Id: I53cd60d82f432d4eff132b5ee28227ece1ded7af
2023-12-01 13:33:11 +00:00
David Srbecky
0cc9d2673f Merge "Revert^2 "Enable dex container (DEX v41) for the whole system"" into main am: 8e1efb7fc5
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2853426

Change-Id: I9f247846eb500eeee8cadae6e8f6b2cd9dc58aa8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-30 23:42:04 +00:00
David Srbecky
8e1efb7fc5 Merge "Revert^2 "Enable dex container (DEX v41) for the whole system"" into main 2023-11-30 22:50:55 +00:00
Yu Liu
4d6d371aee Merge "Add container property to aconfig_declarations." into main am: 9dc6b1025d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2835990

Change-Id: I462e13fb5ca1132dce4751afdd91d9b144f6a283
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-30 22:14:19 +00:00
Yu Liu
9dc6b1025d Merge "Add container property to aconfig_declarations." into main 2023-11-30 21:33:34 +00:00
David Srbecky
e4d0e949ce Revert^2 "Enable dex container (DEX v41) for the whole system"
This reverts commit 432fbfa848.

Reason for revert: Reland

Test: device boots
Change-Id: I95e2ae124c6d4a74ca5303f898583de992b15cbd
2023-11-30 15:07:01 +00:00
Colin Cross
c65780626c Merge "Don't write transitive dependencies to Android-${TARGET_PRODUCT}.mk" into main am: 556ba81849
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2842060

Change-Id: I854bc7c67d7d4525fef42b031ad0b9a9c9080643
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-30 01:26:48 +00:00
Colin Cross
556ba81849 Merge "Don't write transitive dependencies to Android-${TARGET_PRODUCT}.mk" into main 2023-11-30 00:41:43 +00:00
Treehugger Robot
26539fd5e8 Merge "Support experimental building with OpenJDK 21" into main am: 8f7ee30d21
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2853425

Change-Id: I9bcd13d2b770982a638b41cd82284c96e8293186
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-29 21:19:28 +00:00
Treehugger Robot
8f7ee30d21 Merge "Support experimental building with OpenJDK 21" into main 2023-11-29 20:25:25 +00:00
Ramya Subramanian
ff5cf349f5 Merge "Revert "Enable dex container (DEX v41) for the whole system"" into main am: 29e05d1007
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2853365

Change-Id: Iecfcf43f2809a8249c59adeb8092902152f61b51
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-29 19:54:32 +00:00
Ramya Subramanian
29e05d1007 Merge "Revert "Enable dex container (DEX v41) for the whole system"" into main 2023-11-29 19:38:50 +00:00
Sorin Basca
0760c89882 Support experimental building with OpenJDK 21
Use EXPERIMENTAL_USE_OPENJDK21_TOOLCHAIN=true to build with OpenJDK 21
while still targeting java language version 17.

Bug: 313924276
Test: m EXPERIMENTAL_USE_OPENJDK21_TOOLCHAIN=true
Change-Id: Idc892bb7519e597f1e280ca0765c1a281bb29955
2023-11-29 19:13:55 +00:00
Ramya Subramanian
432fbfa848 Revert "Enable dex container (DEX v41) for the whole system"
This reverts commit b82a2a278b.

Reason for revert: DroidMonitor: Potential culprit for multiple Module failures on ATH. verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.”.

Change-Id: I3899a45cce259c4ee38572e76f4735eccb3ca66a
2023-11-29 18:34:31 +00:00
Colin Cross
312634eb0f Don't write transitive dependencies to Android-${TARGET_PRODUCT}.mk
Java libraries were writing lists of files that changed whenever
transitive dependencies changed to Android-${TARGET_PRODUCT}.mk, causing
Kati analysis to rerun whenever a dependency was changed in Soong.
In both cases, Make would immediately use the list to write a single
output file.  Write the files in Soong and pass the path to the file
to Make instead, which will both reduce the size of
Android-${TARGET_PRODUCT}.mk and skip Kati analysis more often.

Bug: 309006256
Test: m checkbuild
Change-Id: I5dff16c6fb7cca8c6da927b37c612c7b1d0954e6
2023-11-29 10:31:13 -08:00
Anas Sulaiman
7eb74575b5 Merge "allow specifying remote caching opt for rewrapper" into main am: 80117e6c4f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2838517

Change-Id: I3d3a9a4a05d364ac88277e6a0e2e9904c21e467d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-29 18:07:57 +00:00
Anas Sulaiman
80117e6c4f Merge "allow specifying remote caching opt for rewrapper" into main 2023-11-29 16:36:21 +00:00
Jiakai Zhang
36c8b1d229 Merge "Remove PreoptExtractedApk." into main am: ba45ba5763
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2848255

Change-Id: I627974d669b4e978ff555553fa94fd5bfc63f7c8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-29 10:50:42 +00:00
Rico Wind
77379a479f Merge "Reapply "Use R8 for resource shrinking"" into main am: 2f6b403ccd
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2846953

Change-Id: I787623b4073f8c550f6d94ff0855fda873167d0b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-29 10:50:13 +00:00
Jiakai Zhang
ba45ba5763 Merge "Remove PreoptExtractedApk." into main 2023-11-29 10:17:29 +00:00
Rico Wind
98e7fa8db1 Reapply "Use R8 for resource shrinking"
This reverts commit a9fd59a7f2.

We are moving the resource shinking pipeline into r8 (gennerally, not just for platform)

This disables the usage of the resource shrinker cli from cmd-line tools

There are no changes in this cl compared to the original land, the fix
was done in R8 (to use the same compression for res folder entries as
in the original)

Bug: 308710394
Bug: 309078004
Test: Existing, validated that resource table on SystemUI was byte<>byte equal, validated uncompression

Merged-In: Ib8a6fb128084e994325b975c46a036cb41494654

Change-Id: Id45b170dd50f75bc87e21ad03b2d0679efb7adc2
2023-11-29 05:07:50 +00:00
Treehugger Robot
66dd52b74d Merge "Enable dex container (DEX v41) for the whole system" into main am: 7d813e0dba
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2238838

Change-Id: I166e8dfcb9e7ad9bfd4c4edfae56beb9215d8680
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-29 01:07:05 +00:00
Anas Sulaiman
9d7a36d17f allow specifying remote caching opt for rewrapper
This is needed to enable local execution via reproxy for metalava
actions for developer builds without causing permissions errors
and without disabling it for other actions.

Bug: b/308154125
Tested: ran a local build and verified all metalava actions were
executed locally without attempting to write to the remote cache.

Change-Id: Ia6f616e1ff5d0c71597ebf688765925ac81d19c3
2023-11-29 00:42:08 +00:00
Yu Liu
eae7b36699 Add container property to aconfig_declarations.
Bug: 311155208
Test: Unit test
Change-Id: I7b187138856d0144203961e82b6dad5e2f8eed9d
2023-11-28 12:37:02 -08:00
Jiakai Zhang
db93553b02 Remove PreoptExtractedApk.
This was added by r.android.com/513843 to force dexpreopt some GMS core
modules even if dexpreopt is disabled, to avoid some memory usage
regression. We no longer need it because dexpreopt is never disabled on
production builds.

Bug: 313505540
Test: m
Change-Id: I605b7569c17ee715cd4df167768e25aaf51bcd37
2023-11-28 13:40:58 +00:00
Søren Gjesse
b82a2a278b Enable dex container (DEX v41) for the whole system
Bug: b/249922554
Test: device boots
Change-Id: Idc63034cc7d5f4bc4533d1f580eeffe1494b56a6
2023-11-28 13:24:21 +00:00
David Srbecky
efb785c929 Merge "Change position of R8/D8 flags on the command line." into main am: ea5bb25378
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2845918

Change-Id: Ib2480ac6ccc8ac459cbc9f38bc8c909bf8dfc109
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-27 16:28:40 +00:00
Jamie Garside
b5429e879e Add the ability for a java_sdk_library to depend on another. am: e570ace2e4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2844082

Change-Id: Iac17dd61875b799fbf6d399401beffc89d463e9c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-27 16:15:50 +00:00
David Srbecky
ea5bb25378 Merge "Change position of R8/D8 flags on the command line." into main 2023-11-27 15:44:04 +00:00
David Srbecky
bda964cf90 Change position of R8/D8 flags on the command line.
The wrapper script requires that all -J* options are passed first.

Test: m
Change-Id: Idd1da394c8a46db3485a1b31284eb6f398e3ba27
2023-11-27 14:27:45 +00:00
Jamie Garside
e570ace2e4 Add the ability for a java_sdk_library to depend on another.
This simply exports all of the uses_libs: [] libraries into a
"dependency=''" statement in the generated XML file (with the <library>
stanza in it).

Test: `go test` in java/
Bug: 184396657

NOTE FOR REVIEWERS - original patch and result patch are not identical.
PLEASE REVIEW CAREFULLY.
Diffs between the patches:
 func formattedDependenciesAttribute(dependencies []string) string {
> +	if dependencies == nil {
> +		return ""
> +	}
> +	return fmt.Sprintf(`        dependency=\"%s\"\n`, strings.Join(dependencies, ":"))
> +}
> +
> +	dependenciesAttr := formattedDependenciesAttribute(module.properties.Uses_libs_dependencies)
> +		dependenciesAttr,
> --- java/sdk_library_test.go
> +++ java/sdk_library_test.go
> +
> +func TestSdkLibraryDependency(t *testing.T) {
> +	result := android.GroupFixturePreparers(
> +		prepareForJavaTest,
> +		PrepareForTestWithJavaSdkLibraryFiles,
> +		FixtureWithPrebuiltApis(map[string][]string{
> +			"30": {"bar", "foo"},
> +		}),
> +	).RunTestWithBp(t,
> +		`
> +		java_sdk_library {
> +			name: "foo",
> +			srcs: ["a.java", "b.java"],
> +			api_packages: ["foo"],
> +		}
> +		
> +		java_sdk_library {
> +			name: "bar",
> +			srcs: ["c.java", "b.java"],
> +			libs: [
> +				"foo",
> +			],
> +			uses_libs: [
> +				"foo",
> +			],
> +		}
> +`)
> +	
> +	barPermissions := result.ModuleForTests("bar.xml", "android_common").Rule("java_sdk_xml")
> +	
> +	android.AssertStringDoesContain(t, "bar.xml java_sdk_xml command", barPermissions.RuleParams.Command, `dependency=\"foo\"`)
> +}

Original patch:
 diff --git a/java/sdk_library.go b/java/sdk_library.go
old mode 100644
new mode 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -1993,6 +1993,7 @@
 		Min_device_sdk            *string
 		Max_device_sdk            *string
 		Sdk_library_min_api_level *string
+		Uses_libs_dependencies    []string
 	}{
 		Name:                      proptools.StringPtr(module.xmlPermissionsModuleName()),
 		Lib_name:                  proptools.StringPtr(module.BaseModuleName()),
@@ -2002,6 +2003,7 @@
 		Min_device_sdk:            module.commonSdkLibraryProperties.Min_device_sdk,
 		Max_device_sdk:            module.commonSdkLibraryProperties.Max_device_sdk,
 		Sdk_library_min_api_level: &moduleMinApiLevelStr,
+		Uses_libs_dependencies:    module.usesLibraryProperties.Uses_libs,
 	}
 
 	mctx.CreateModule(sdkLibraryXmlFactory, &props)
@@ -2968,6 +2970,11 @@
 	//
 	// This value comes from the ApiLevel of the MinSdkVersion property.
 	Sdk_library_min_api_level *string
+
+	// Uses-libs dependencies that the shared libra
[[[Original patch trimmed due to size. Decoded string size: 3559. Decoded string SHA1: 67fbd040aa818732a686514c4556850c8c36dc8d.]]]

Result patch:
 diff --git a/java/sdk_library.go b/java/sdk_library.go
index fb27812..fbfe509 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -1993,6 +1993,7 @@
 		Min_device_sdk            *string
 		Max_device_sdk            *string
 		Sdk_library_min_api_level *string
+		Uses_libs_dependencies    []string
 	}{
 		Name:                      proptools.StringPtr(module.xmlPermissionsModuleName()),
 		Lib_name:                  proptools.StringPtr(module.BaseModuleName()),
@@ -2002,6 +2003,7 @@
 		Min_device_sdk:            module.commonSdkLibraryProperties.Min_device_sdk,
 		Max_device_sdk:            module.commonSdkLibraryProperties.Max_device_sdk,
 		Sdk_library_min_api_level: &moduleMinApiLevelStr,
+		Uses_libs_dependencies:    module.usesLibraryProperties.Uses_libs,
 	}
 
 	mctx.CreateModule(sdkLibraryXmlFactory, &props)
@@ -2968,6 +2970,11 @@
 	//
 	// This value comes from the ApiLevel of the MinSdkVersion property.
 	Sdk_library_min_api_level *string
+
+	// Uses-libs dependencies that the shared library
[[[Result patch trimmed due to size. Decoded string size: 3614. Decoded string SHA1: b5730ecbeeaad420439ddb67eaaa9150ede94585.]]]

Change-Id: I73f69e2a4573e416492f68e083fe739f3f75b721
2023-11-27 12:07:36 +00:00
Treehugger Robot
baed9d5a57 Merge "Use result.Config.PrebuiltOS() to get prebuiltHost in test_spec_test" into main am: 9be9a126d1
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2841420

Change-Id: I5b7d56846f7bac5b4a77745e8638ce2412aaa935
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-22 02:06:49 +00:00
Aditya Choudhary
356296240e Use result.Config.PrebuiltOS() to get prebuiltHost in test_spec_test
Bug: 312536783
Bug: 312536905
Test: m nothing --no-skip-soong-tests -j96

Change-Id: I1e12281927269d42ae796348b223030acfd6ecfa
2023-11-21 23:14:01 +00:00
Aditya Choudhary
64b6c645e8 Add test for soong/testing/test_spec. am: b7b3de8307
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2836072

Change-Id: Iec9eeceadbd2e86055a4f2e6eecd77443f7eb05a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-21 19:44:34 +00:00
Aditya Choudhary
b7b3de8307 Add test for soong/testing/test_spec.
This CL adds test for test_spec.go and all_test_specs.go (singleton).

Bug: 296873595
Test: m nothing --no-skip-soong-tests -j96

Change-Id: I5010c68512e75d1b9a337c02da86faac15e376fe
2023-11-21 17:31:07 +00:00
David Srbecky
918285adce Merge "resourceshrinker: Add dexContainerExperiment flag" into main am: 3f7d0f6797
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2828314

Change-Id: I18e530107a0fe3c9185f86f7c69d37b49dd4e64f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-21 08:43:33 +00:00
David Srbecky
3f7d0f6797 Merge "resourceshrinker: Add dexContainerExperiment flag" into main 2023-11-21 08:30:23 +00:00
Colin Cross
7dcb26f327 Change deps of ctx.Install* from Paths to InstallPaths am: 09ad3a6505
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2834991

Change-Id: I63828eebd77e8e88592107a6e5cee9c291cacb42
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-20 20:20:36 +00:00
Colin Cross
09ad3a6505 Change deps of ctx.Install* from Paths to InstallPaths
Installed files should only depend on other installed files, change
the deps arguments of the ctx.Install* methods from Paths to
InstallPaths.

Bug: 311428265
Test: builds
Change-Id: I1ebef60a943bdbe907744cc43aa985371ac56d32
Merged-In: I1ebef60a943bdbe907744cc43aa985371ac56d32
2023-11-17 19:06:43 -08:00
Inseob Kim
99913d4e59 Merge "Add support for auto-generated characteristics RRO" into main am: b5d713f2cb
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2817177

Change-Id: Ie4a539f9001bdbd2fc91fedbfc9869a1c35b15d3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-17 05:43:44 +00:00
Inseob Kim
b5d713f2cb Merge "Add support for auto-generated characteristics RRO" into main 2023-11-17 05:02:28 +00:00
Inseob Kim
34dc4cd738 Add support for auto-generated characteristics RRO
Setting Generate_product_characteristics_rro will automatically generate
an RRO package which contains resources with
'product="{PRODUCT_CHARACTERISTICS}"'. The RRO package will be installed
to /product partition. The app will be compiled with '--product
default', making the app identical to all targets.

Motivation for this change is to minimize divergence of system.img.

Bug: 294799593
Test: boot and idmap2 dump
Change-Id: I1371f7410a1ecf337e1f73214b024af39aa6d57a
2023-11-17 11:15:32 +09:00
Treehugger Robot
5c8f4f446d Merge "Add contribute_to_android_api property in java_sdk_library" into main am: 7fcb470251
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2832851

Change-Id: I9be66305f8b2da9ea8026bf197f578961e088ec7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-15 22:45:50 +00:00
Treehugger Robot
7fcb470251 Merge "Add contribute_to_android_api property in java_sdk_library" into main 2023-11-15 22:25:22 +00:00
Colin Cross
d50b463e66 Merge "Stop collecting path entry for module_bp_java_deps.json from each module type" into main am: d7812415c3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2831928

Change-Id: I13c077e58d39a86ce14d3b89551b369d6a9cc5fb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-15 21:19:28 +00:00
Colin Cross
d7812415c3 Merge "Stop collecting path entry for module_bp_java_deps.json from each module type" into main 2023-11-15 21:01:38 +00:00
Jihoon Kang
80456fdec4 Add contribute_to_android_api property in java_sdk_library
The default-false bool property `contribute_to_android_api` will be used to signify whether the java_sdk_library module contributes to an api
surface (i.e. listed in frameworks-base-api.bootclasspath or not).
If the property is set to true, the module's stub jar can be
generated from .txt files.

Currently, the property is a no-op. The property will be utilized in the
child changes.

Test: m nothing
Bug: 276958307
Change-Id: I617802ec352c7055579ce92ea3de43f10cac1da4
2023-11-15 20:40:37 +00:00
Colin Cross
a644c263dd Stop collecting path entry for module_bp_java_deps.json from each module type
The jdepsGeneratorSingleton can get the module path directly, it doesn't
need to be collected by each module type that implements IDEInfo.  Fixes
module types (like android_library) that didn't reach the code that
collected the path.

Bug: 309835196
Test: out/soong/module_bp_java_deps.json contains path for ExtServices.core
Change-Id: If8cb81b4f708e0367f156ade164bee253bf53492
2023-11-15 11:40:48 -08:00
Aditya Choudhary
beff7f2a0a Merge "Add proto for Test ownership metadata." into main am: d97bf36469
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2774872

Change-Id: Idae0ffe939cb25b9c8626a39d036535691ee38f5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-15 11:19:37 +00:00
Aditya Choudhary
d97bf36469 Merge "Add proto for Test ownership metadata." into main 2023-11-15 10:30:50 +00:00
Aditya Choudhary
9b59352a82 Add proto for Test ownership metadata.
This Cl adds a new rule to Soong to generate test spec metadata. Also, this CL adds a provider in various test module to provide test spec related data to the Soong rule.
Will add providers and test code to other Module in the future changes.
Provider added for the following test modules in this change: android_robolectric_test, android_test, bootclasspath_fragment_test, java_test, java_test_host, python_test, python_test_host, sh_test,and sh_test_host.

Bug: 296873595

Change-Id: I5f89f72d5874bb7838ae357efdb8c6ca208e18a7
2023-11-15 09:08:02 +00:00
Alyssa Ketpreechasawat
4e56c8b8ac Merge "Skip unknown check in bootclasspath_fragment (source version) if prebuilt version is in use." into main am: 378c7a3953
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2822393

Change-Id: Ie94799e955a6dc3d4a31c2ea0376945a2982e8fc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-14 19:44:58 +00:00
Alyssa Ketpreechasawat
378c7a3953 Merge "Skip unknown check in bootclasspath_fragment (source version) if prebuilt version is in use." into main 2023-11-14 19:13:32 +00:00
David Srbecky
8f354780e6 resourceshrinker: Add dexContainerExperiment flag
Bug: 249922554
Test: build with CL/2238838
Change-Id: I369ebe616caa9ae880b71abb0bafa3f909ebcdae
2023-11-14 12:06:50 +00:00
Treehugger Robot
4aa0474c14 Merge "Change OnlyPreoptBootImageAndSystemServer to OnlyPreoptArtBootImage." into main am: 34778a9301
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2822402

Change-Id: I7a3d9febdd7fbef957e3f295784776985aabf9c8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-10 19:18:23 +00:00
Treehugger Robot
34778a9301 Merge "Change OnlyPreoptBootImageAndSystemServer to OnlyPreoptArtBootImage." into main 2023-11-10 18:47:19 +00:00
Jiakai Zhang
2398442ec0 Change OnlyPreoptBootImageAndSystemServer to OnlyPreoptArtBootImage.
OnlyPreoptBootImageAndSystemServer was for making the eng build faster.
This change makes it even faster.

Bug: 309011617
Test: Presubmit
Change-Id: If9001e99593b57deafa7b56f0ca6b3d4d80f56d3
2023-11-09 16:50:58 +00:00
Alyssa Ketpreechasawat
a0cf0a4a66 Skip unknown check in bootclasspath_fragment (source version) if prebuilt version is in use.
Following aosp/2822531, when MediaProvider prebuilt is enabled, framework-pdf (new jar) will be removed from PRODUCT_APEX_BOOT_JARS. Subsequently there will be an error around the inconsistency (unknown) between bootclasspath_fragment (source version of MP with framework-pdf in its content) and PRODUCT_APEX_BOOT_JARS (framework-pdf removed). Since the source version of bootclasspath_fragment is not in use, we should ignore this check. See more detail in go/stale-mainline-prebuilts (issue from changes in framework/service jars in existing apexes).

Bug: 304719212
Test: lunch cf_x86_phone-next-userdebug & m
Test: lunch cf_x86_phone-trunk-userdebug & m
Change-Id: I0f62277a9e65522bf5a4ea1ae33c166f996c37d5
2023-11-09 12:54:09 +00:00
Spandan Das
e48000d86f Merge changes from topic "apex_contributions_build_flags" into main am: c31b24977e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2808754

Change-Id: Ia7b7a22e9be58e37db8d188eff8cda2a8dc408e8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-09 01:58:15 +00:00
Spandan Das
fc12d2f494 Special-case java_sdk_library in source vs prebuilt selection
If a java_sdk_library is listed in `contents`, then restrict the source
vs prebuilt selection superseding to only the internal stub libraries.

Defer the source vs prebuilt selection mechanism of the top-level
library to the existing mechanisms for now. This is necessary because
this top-level library acts as a hook for
- hiddenapi: boot jars are deapxed from the prebuilt apex
- dexpreopt: system server jars are deapexed from the prebuilt apex and
  installed via required

If `next` uses `framework-foo` and `service-foo` as the top-level
library instead of the prebuilt equivalents, then the bootjars installed
in out/soong/dexpreopt_x86_64/apex_bootjars will come from source. And
the *.odex files of the system server jars will come from source.

Bug: 308174768
Test: Added a java_sdk_library unit test to assert that the new
mechanism supersedes the `prefer` flag

Change-Id: Ib43198a3b547c58b54f1f0966e95584215096d32
2023-11-08 18:37:24 +00:00
Jiakai Zhang
f3c1e6f8fe Merge "Use the correct mainline BCP jars for app dexpreopt." into main am: 04445d5443
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2816578

Change-Id: I533792e84af2417c260b5f9afcc6387f78eb16b0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-08 11:26:01 +00:00
Jiakai Zhang
04445d5443 Merge "Use the correct mainline BCP jars for app dexpreopt." into main 2023-11-08 10:56:58 +00:00
Anton Hansson
ca3bfaba87 Merge "Stop suppressing the ChangedDefault error" into main am: d69b5ff1b2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2818838

Change-Id: I28b3f68058d8f5e4951ef2e845906dbbe873bbfd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-08 10:49:28 +00:00