Commit graph

702 commits

Author SHA1 Message Date
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
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
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
LaMont Jones
aa005ae080 move CollectDependencyAconfigFiles to android
This needs to be called by some modules in android.

Bug: 308625757
Test: manual
Change-Id: I389fcfd88a3f4bd85a9218fdd4dd66d8a239bb67
2023-12-19 19:34:00 +00: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
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
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
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
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
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
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
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
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
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
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
Michael Stokes
2e09e68e56 Merge "Revert "Use R8 for resource shrinking"" into main 2023-11-03 12:12:40 +00:00
Rico Wind
a9fd59a7f2 Revert "Use R8 for resource shrinking"
Revert submission 2816534-r8resourceshrinking

Reason for revert: b/309075997

Reverted changes: /q/submissionid:2816534-r8resourceshrinking

Change-Id: Ic173491eaf22967fbad14fbcc85f6ddb2cf54d23
2023-11-03 10:26:38 +00:00
Rico Wind
4ea88503e4 Merge "Use R8 for resource shrinking" into main 2023-11-03 07:29:45 +00:00
Rico Wind
b56fe2825d Use R8 for resource shrinking
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

Bug: 308710394

Test: Existing, validated that resource table on SystemUI was byte<>byte equal.
Change-Id: Ia36b5e5970cbdcff519a5f05d672b44dc145ea32
2023-11-02 20:35:20 +01:00
Alix
96ea8845c5 add manifest_values application id property to soong
Bug:278905106
Test: go test ./java --run TestManifestValuesApplicationIdSetsPackageName
	and locally built a module and checked manifest pacakge_name
Change-Id: I5c8fd27c177b9e255dce197706f62580894008cb
2023-10-23 18:26:53 +00:00
Colin Cross
95b53b83eb Export resource processor R.jar files to ASfP
Export the R.jar files generated by ResourceProcessorBusyBox to
module_bp_java_deps.json for use by Android Studio for Platform.

Bug: 305997998
Test: examine module_bp_java_deps.json
Change-Id: I48e3e28b45219646765de7848ec9dbe77d14c662
2023-10-17 13:21:02 -07:00
Alix
f7a1027c6b Use an option struct in aapt.buildActions & manifestMerger
Change-Id: Ia056ab321e1fd146ed0cdb98fc2d4455601f648c
Test: Treehugger
2023-10-10 14:31:03 +00:00
Romain Jobredeaux
9c06ef353b bp2build support for framework-res
Change-Id: I5b32a702e02b5f1ec08d5608d766a8a0c08d845c
Bug: 276928228
Bug: 297356405
2023-09-26 15:06:50 -04:00
Jingwen Chen
256c389608 Improve optimize bp2build conditional.
Follow up from https://android-review.git.corp.google.com/c/platform/build/soong/+/2757255/comment/fdcf5795_943a04d5/

Test: soong unit tests
Change-Id: I63334bfd19469060673e9a9a239050590934b089
2023-09-26 05:56:54 +00:00
Jingwen Chen
65229207d1 Enable/disable optimize for android_test and android_test_helper_app by default.
Follow up to https://android-review.git.corp.google.com/c/platform/build/bazel/+/2727853/comment/f2c5802e_245fd302/

Test: New unit tests, presubmits
Test: `atest-dev HelloWorldTests --roboleaf-mode=dev`

Change-Id: I88efcf72fbcb717d05e71ba50ba7802c3bece816
2023-09-25 15:27:33 +00:00
Alix Espino
c62b27a7ea Merge "Mark android_* modules with java_resources as unconvertible" into main 2023-09-22 14:56:18 +00:00
Romain Jobredeaux
2c11851598 Merge "Use raw {min,target}_sdk_version properties in android_app converter" into main 2023-09-21 20:58:16 +00:00
Jingwen Chen
6528999872 Revert^2 "bp2build converter for android_test_helper_app."
2395286cda

Change-Id: I698c1e62b87f3d8338d8d207d06f62ec680d71c9
2023-09-21 15:16:59 +00:00
Jingwen Chen
38b7be9d29 Merge "Revert "bp2build converter for android_test_helper_app."" into main 2023-09-21 15:14:29 +00:00
Jingwen Chen
2395286cda Revert "bp2build converter for android_test_helper_app."
Revert submission 2757525-android_test_helper_app

Reason for revert: broke builds

Reverted changes: /q/submissionid:2757525-android_test_helper_app

Change-Id: I0e5f55078221d7f2151f1bbaa55bebdf5051c03c
2023-09-21 15:12:19 +00:00
Jingwen Chen
72e22018c3 Merge "bp2build converter for android_test_helper_app." into main 2023-09-21 15:09:06 +00:00
Romain Jobredeaux
1c4048e08d Merge "Bp2build support for JNI deps of android_app." into main 2023-09-21 14:36:02 +00:00
Alix
ee51bd6588 Mark android_* modules with java_resources as unconvertible
Change-Id: I9da921feaf9edb5fe7d1b1cb733494f90d8c64b3
BUG: 300470246
2023-09-21 03:58:24 +00:00
Romain Jobredeaux
947dfa760b Bp2build support for JNI deps of android_app.
Change-Id: I3f934ecb0323129e1bb1eb75527395e39467380d
Bug: 297405812
2023-09-20 16:09:13 -04:00
Spandan Das
0e0a880fdd Mark android apps with jni_uses_*_apis as unconvertible
These properties are used to determine if the app should include the sdk
variant of jni libs. Till we support this, mark androi_app/android_test
that set this property as uncovertible in allowlist v2

Bug: 299360988
Test: created a test app in an android.bp and verified that an
equivalent target is not created if either of these props are set

Change-Id: I925745d2667866a12b71788dc8f1bb1e1f3472cc
2023-09-20 19:53:30 +00:00
Chris Parsons
637458d326 Have ConvertWBp2build use Bp2buildMutatorContext
This no-op refactoring facilitates some upcoming functional changes for
"bp2build allowlist v2". The work requires that the bp2build conversion
mutator be changed from a TopDown mutator to a BottomUp mutator.
Refactoring all bp2build-related methods so that they use Bp2buildMutatorContext
makes it easier to make this functional change without touching tens of
files and multiple projects.

Bug: 285631638
Test: m bp2build
Change-Id: I3d1ef3064146e959c6f0dc315350fc9764bf2bd2
2023-09-20 14:49:35 +00:00
Jingwen Chen
2848be4236 bp2build converter for android_test_helper_app.
This module converts simply to an android_binary, but with testonly = True.

Test: new unit tests
Test: new example app
Fixes: 283518652
Change-Id: If6b7661c32caa7dada6d492cce106d96236f6205
2023-09-20 14:31:17 +00:00
Romain Jobredeaux
3132f843f1 Use raw {min,target}_sdk_version properties in android_app converter
The logic of EffectiveVersionString is product-variable dependent and
is being implemented bazel-side in order to produce product agnostic
BUILD files. A required additional product variable is added to the
export list, and the "updatable" property of android_app is also bp2build-converted.
Handling of max sdk version was not correct (it does not affect
manifest values in Soong), so removing it for now.

Bug: 274474008
Bug: 274474002
Test: CI
Change-Id: I7a10bfabf914c8e86064b7ce61926701f87517e3
2023-09-18 10:02:35 -04:00
Jingwen Chen
e12c083198 [bp2build] android_test bp2build.
android_test is just an android_app, but the test bits are handled
purely in Starlark (tradefed_test_impl).

This enables building HelloWorldTests (android_test) with Bazel.

Bug: 297030120
Bug: 297029612
Test: WIP
Change-Id: I6d287c94b31698ea247da48e4cd6b5a75bc71e11
2023-09-18 12:39:06 +00:00
Romain Jobredeaux
d2cc5037c2 Re-order android_app bp2build converter logic.
This change is a no-op but makes it easier to single out framework-res
for conversion in subsequent CL aosp/2720593.

Bug: 276928228
Test: CI
Change-Id: I7c7338add1857697912dec3c34b7c43e06d2d12d
2023-09-11 16:37:50 -04:00
Treehugger Robot
8763530dff Merge "android_app APEX_GLOBAL_MIN_SDK_VERSION_OVERRIDE" into main 2023-09-07 16:55:45 +00:00