Commit Graph

6915 Commits

Author SHA1 Message Date
Jiakai Zhang
1b7fe31831 Merge changes I0918f2fa,I3fc6ff91,I7adc97cb,I674a5fa1,I22c45cbf into main am: b898c112a2 am: 12e3b8adcc am: 2c4e719839 am: eb17813c98 am: 2730d59870 am: 6b92d74d25
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2652086

Change-Id: I95939a8358ca178fff7562dabbe6d8038adcbe22
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-12 00:52:25 +00:00
Colin Cross
fa268b116e Merge "Add tests for code that will be affected by resource processor feature" into main am: 120b55a7ca am: 27da704772 am: 9740d8fe41 am: 9332ab33f7 am: 69f550b18a am: 587538e1b8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2649208

Change-Id: Id615d02da5e0caca82cce8ade3d9cd322bc02219
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-12 00:50:59 +00:00
Jiakai Zhang
b898c112a2 Merge changes I0918f2fa,I3fc6ff91,I7adc97cb,I674a5fa1,I22c45cbf into main
* changes:
  Change the profile path on host.
  Extract duplicate code to common helper functions.
  Fix dumpOatRules.
  Remove Modules() from BootclasspathFragmentApexContentInfo.
  Fix some tests for dexpreopt and remove unnecessary tests.
2023-07-11 20:59:07 +00:00
Colin Cross
120b55a7ca Merge "Add tests for code that will be affected by resource processor feature" into main 2023-07-11 20:17:05 +00:00
Romain Jobredeaux
373a2eeef6 Merge "Support target and max sdk version in app bp2build." into main am: aa634fdbdb am: 5484ae074f am: 4e4274f597 am: 9dd8dc623f am: 47af21b8bd am: a76542f3ce
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2650657

Change-Id: Ibafdbc461d5c172a2a32766d08808b3d1f637fcd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-11 17:49:10 +00:00
Jiakai Zhang
3444e561dc Change the profile path on host.
This is to decouple profile generation from image configs. A boot image
profile is either for a mainline module or for the platform, which is
orthogonal to boot images.

Bug: 290583827
Test: m nothing
Change-Id: I0918f2fa945a2af1839f1a08ecede331c64d0317
2023-07-11 17:59:24 +01:00
Jiakai Zhang
b1639db53f Extract duplicate code to common helper functions.
Also, fall back to using a default name for the dexpreopt directory if
we are not building for Android.

Bug: 290583827
Test: m nothing
Change-Id: I3fc6ff9142a2dcdf995796f75891b242fe2848d0
2023-07-11 17:59:05 +01:00
Jiakai Zhang
da47d3c6f3 Fix dumpOatRules.
This method generates a build rule that runs oatdump for debugging
purposes.

- Pass "--runtime-arg -Xgc:CMC" to oatdump if UFFD GC is enabled.
- Build the phony name from the image name to avoid conflicts when using
  this method for multiple boot images.

Bug: 290583827
Test: m dump-oat-boot
Change-Id: I7adc97cb85b571486b78f173fb80ff7da2c4bfe4
2023-07-11 16:27:01 +01:00
Jiakai Zhang
f7f782c4f1 Remove Modules() from BootclasspathFragmentApexContentInfo.
The Modules() method was for the ART boot image in the ART APEX. It's no
longer needed because we don't install the ART boot image in the ART
APEX anymore.

Bug: 290583827
Test: m nothing
Change-Id: I674a5fa1ed18908413a64129df5947c7d26e638e
2023-07-11 15:29:17 +01:00
Jiakai Zhang
b69e89559f Fix some tests for dexpreopt and remove unnecessary tests.
This CL is to prepare for the changes in http://r.android.com/2652081.
See the description of that CL for the reasons.

Some tests were set up in a fragile way and were easy to be broken when
the implementation changes. This CL is a pure test change that fixes
them.

This CL also removes TestNoUpdatableJarsInBootImage. That test checks
what should go to the ART boot image and what should go to the
platform one, which does not apply today because boot images are not
associated with mainline modules anymore: a boot image may take jars
from multiple mainline modules and the platform, and a mainline module
can contribute to multiple boot images. In practice, we have ART jars in
the platform boot image, and we are going to add core-icu4j and
consrypt to the ART boot image, which is now for testing only.

Bug: 290583827
Test: m nothing
Change-Id: I22c45cbf6f853b030b68edb51197854e9c53a02e
2023-07-11 15:29:12 +01:00
Romain Jobredeaux
aa634fdbdb Merge "Support target and max sdk version in app bp2build." into main 2023-07-11 13:34:29 +00:00
Treehugger Robot
94c92f681a Merge "Copy imported APKs to output filename" into main am: 5af242249d am: 84d32c5b1c am: b4a858d7a0 am: 66baac045c am: 5dd8957f47 am: c873cb2da7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2652823

Change-Id: I51ab8c69b6ad17bad51ccddd1c07201d64e223d5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-11 09:12:16 +00:00
Colin Cross
5780d57a71 Copy imported APKs to output filename
android_app_import and android_test_import modules with processed: true
and skip_preprocessed_apk_checks are used directly from the source tree.
If the source file name doesn t match the module name and the file is
used as test data it can result in the wrong filename being used.  Copy
the source file to an output file with the correct name first.

Bug: 290376750
Test: m CtsAppSecurityHostTestCases
Change-Id: I4a6dd1c5e48db7085ea41035def31f0844948a46
2023-07-10 22:18:01 +00:00
Romain Jobredeaux
496660d38a Support target and max sdk version in app bp2build.
Test: Unit tests + CI
Bug: 285304294
Bug: 280465047
Change-Id: I9bb1b6f9729ad783a43837d77dcf2d02b50ca77e
2023-07-10 11:50:00 -04:00
Treehugger Robot
5665622547 Merge "Implement OutputFileProducer for android_app_import and android_test_import" into main am: b2ace8d72d am: ed7ff79589 am: 58e3067618 am: 9d12e40dec am: 3fa8e286c3 am: 14fbf01979
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2652340

Change-Id: I646dc735f7fcc19586fea43614105a57e26fcf94
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-08 04:37:36 +00:00
Colin Cross
5368d0b44a Implement OutputFileProducer for android_app_import and android_test_import
Fixes: 290376750
Test: builds
Change-Id: I5fc3a759462cfd4342b9330ac8978368feee26ca
2023-07-07 18:36:08 +00:00
Colin Cross
ff3ff7f354 Add tests for code that will be affected by resource processor feature
Add a test for the aapt2 resource processing code that will be affected
by the resource processor feature in a subsequent CL.

Test: TestAndroidResourceProcessor
Change-Id: I39712853f7bbfb7963f1b71e234d039d5ccaae53
2023-07-07 10:58:31 -07:00
Treehugger Robot
0f4d8f6866 Merge "Suppress resourceshrinker stdout in soong" am: ece97e5658 am: 1890f082a7 am: b12365df34 am: 7a67e5ca42 am: 64b4d69f9e am: f5898b3e40
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2629191

Change-Id: I7436a36ced5506e98a03eb318032ff6d5784240e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-01 03:49:14 +00:00
Treehugger Robot
ece97e5658 Merge "Suppress resourceshrinker stdout in soong" 2023-06-30 23:26:28 +00:00
Nicolas Geoffray
b37e2183a3 Merge "Don't strip oat files on host." am: 3799533b87 am: 51ba0cf62a am: 5f1a60b3ff am: 3329a4e764 am: 032c8074b1 am: b603b627a7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2640035

Change-Id: I05ce41cb4231c763f70c901919c9042e1bb76dcc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-30 14:54:34 +00:00
Treehugger Robot
ddf027b4a0 Merge "Extract class files from dep_api_srcs instead of java files" am: 043893465c am: e2be65ac9b am: c3f42dcf7b am: 52adedba36 am: c2c0f70a59 am: b87706fec2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2637669

Change-Id: I448ffec69b79a46af302bf2b6d9fe1e7469db674
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-30 13:34:46 +00:00
Nicolas Geoffray
3799533b87 Merge "Don't strip oat files on host." 2023-06-30 10:49:50 +00:00
Treehugger Robot
8359db9dc0 Merge "Fix FirstUniqueStrings after conversion to generics" am: da169a1ee3 am: e5f8e56262 am: 146391ed48 am: 987869d644 am: cd925b6d9e am: 995c8f610a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2640231

Change-Id: I4e9a477c1257278061ffceb06ef245d28c1432b6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-29 23:49:41 +00:00
Jihoon Kang
ca198c2639 Extract class files from dep_api_srcs instead of java files
Currently, stub java files are extracted from srcjar file provided from
dep_api_srcs in java_api_library module generated in java_sdk_library
per api scope. However, compiling the java files may lead to difference
in the content of the generated class files even if the stub java files
are equivalent, as javac may arbitrarily add overridden methods. Thus,
create a stub jar file instead of creating a stub srcjar file and
compiling it, in order to guarantee stub jar files content equivalence
and thus enable hiddenapi during from-text stub build.

Note that this change does not fully resolve differences between the
full api surface csv and the per sdk_library csv. Instead, it removes
the difference caused by methods arbitrarily added by javac.

This change also renames dep_api_srcs to full_api_surface_stubs to be
more intuitive.

Test: rebase on top of aosp/2617274 and `m --build-from-text-stub`
Bug: 275570206
Change-Id: I22b6d56624633681f5c3b000370b5782655c7b8d
2023-06-29 22:43:05 +00:00
Zi Wang
1604552902 Merge "Use java_library_host bp2build converter for tradefed_java_library_host" am: 187aa29056 am: 001f86f656 am: ce25aa21b9 am: 352cb1966f am: ed875a27ed am: 2cc3fb758e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2640236

Change-Id: I15795b4570424d238f687f4083f10be7c92f6269
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-29 21:09:47 +00:00
Jiakai Zhang
d953e601e5 Merge "Use per-app package list to avoid unnecessary dexpreopt." am: fbc62cfd74 am: 0f39aeae9d am: 19f78bc543 am: b75734b94f am: 81826f0140 am: c7ca76c392
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2637193

Change-Id: I0d508100d1b1187f6dcbac0a73bb86f94c3c3c67
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-29 21:05:55 +00:00
Treehugger Robot
da169a1ee3 Merge "Fix FirstUniqueStrings after conversion to generics" 2023-06-29 18:46:20 +00:00
Zi Wang
187aa29056 Merge "Use java_library_host bp2build converter for tradefed_java_library_host" 2023-06-29 18:03:22 +00:00
Nicolas Geoffray
1ad8a13e47 Don't strip oat files on host.
We need the debugging info for perf.

Test: m
Change-Id: Iceaa72d8b1c7d27ea113ca72c8af1174ce6f05ba
2023-06-29 15:45:39 +01:00
Kenneth Ford
9371cc9d72 Merge "Revert "Enable R8 full mode by default for apps"" am: 510616ca9d am: 7f3b9d34d0 am: 3029a7ebfd am: 97191c39e6 am: cea96b660b am: 9d67c9e161
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2644757

Change-Id: I43bdafba3b4c7153bc4830d92be267a858eefc0a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-29 04:43:45 +00:00
Jared Duke
a0c3f2ce1d Merge "Enable R8 full mode by default for apps" am: 4b566a978f am: f521304597 am: 990328e0df am: 6e43d9a439 am: 540b451da8 am: 615c80eb6f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2084583

Change-Id: Ia742863fa9d2ef81bc388d1552d0c3dba5a91a92
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-29 02:50:54 +00:00
Kenneth Ford
ba283992ef Revert "Enable R8 full mode by default for apps"
This reverts commit 93d0bffafe.

Reason for revert: Possible culprit for b/289285719

Change-Id: If818db9d38008ea9d8c7813b9f6fabc2975e8507
2023-06-28 23:29:21 +00:00
Jiakai Zhang
51b2a8b5eb Use per-app package list to avoid unnecessary dexpreopt.
Starting from aosp/2594905, dexpreopt depends on
`$PRODUCT_OUT/product_packages.txt`. When PRODUCT_PACKAGES changes,
dexpreopt has to rerun for all apps. This is not ideal.

After this change, dexpreopt uses a per-app product_packages.txt that is
filtered by the app's dependencies, and it uses `rsync --checksum` to
prevent the file's mtime from being changed if the contents don't change.
This avoids unnecessary dexpreopt reruns.

Bug: 288218403
Test: m
Test: Change PRODUCT_PACKAGES and see no dexpreopt reruns.
Change-Id: I5788a9ee987dfd0abfd7d91cbcef748452290004
2023-06-28 17:59:56 +01:00
Zi Wang
3096e68e64 Use java_library_host bp2build converter for tradefed_java_library_host
Test: presubmit

Bug: 285959156
Change-Id: I18cefd4bf71b674771718411887b140a5d61d3f6
2023-06-27 15:44:10 -07:00
Jared Duke
93d0bffafe Enable R8 full mode by default for apps
This provides significant size savings over the default compatibility
mode, roughly ~20MB in aggregate for a recent Pixel build. Targets can opt out using `proguard_compatibility = true`.

Future work will enable for all targets, not just apps, but this
incremental change yields the most benefit.

Bug: 215530220
Test: m + presubmit
Change-Id: I52a9b27ebe71835849e200e23ae2a250eaf1bbe1
2023-06-27 22:33:58 +00:00
Colin Cross
48016d5a2f Fix FirstUniqueStrings after conversion to generics
The conversion of FirstUniqueStrings to be implemented on top of the
generic firstUnique accidentally used a different threshold to switch
from the list implementation to the map implementation.  Modify the
threshold of firstUnique to match the old value from FirstUniqueStrings
now that it doesn't have the reflection overhead.  While we're at it,
also make firstUnique make a copy of the list, and make FirstUniqueStrings
a pure wrapper around firstUnique.

Test: BenchmarkFirstUniqueStrings
Change-Id: Icc2febea663142c508ff2e4be65a8a68121631d5
2023-06-27 11:07:55 -07:00
Treehugger Robot
67cc9c07d0 Merge "Cleanup remaining android.JavaApiLibraryName() references" am: a41c679fe1 am: e33d11c7ba am: b3aff0670c am: 19ae935ee2 am: 9edadaacdf am: 2939f1301d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2627549

Change-Id: Ifb1c04b769301c768936a9afc8decbee26fa267d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-27 00:45:17 +00:00
Treehugger Robot
a41c679fe1 Merge "Cleanup remaining android.JavaApiLibraryName() references" 2023-06-23 21:35:02 +00:00
Colin Cross
808e4865a0 Merge "Use generics for DepSets" am: 313d32f730 am: 99e192a3c6 am: 1abd6d6d58 am: 93f21b999f am: 84b55792dd am: 5a4ef5695a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2633849

Change-Id: I55351dcaafa90a550d90d2eb2c832960c0880efa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-23 00:54:04 +00:00
Colin Cross
313d32f730 Merge "Use generics for DepSets" 2023-06-22 20:57:01 +00:00
Eric Miao
1957e6eeb9 Merge "Revert "Revert "Enable compact resource entries for aapt linking""" 2023-06-22 16:49:11 +00:00
Colin Cross
c85750bfe3 Use generics for DepSets
Use Go's generics for DepSets so they don't require a type-specific
wrapper and reflection.

Test: depsets_test.go
Change-Id: I22ba0b7d680d37d2cd05230b0f560d166c4dd20b
2023-06-22 08:18:33 -07:00
Paul Duffin
c0036491cd Remove reference to the deprecated and disabled Typo issue
Metalava no longer looks for common typos. It relies on the code
analyzers that run on Gerrit to detect them.

Bug: 288072162
Test: m checkapi
Change-Id: I08eca8008af39ebe69442db419ebd3d3378aa0de
2023-06-21 15:42:49 +01:00
Jared Duke
91f32e7ae5 Suppress resourceshrinker stdout in soong
The resourceshrinker command prints an info log for successful runs,
which we don't really need to surface in build output. Suppress stdout
for such invocations; errors will surface through stderr.

Bug: 202959019
Test: m + compare log output
Change-Id: I08ed465bb7e3a0fa8d5e967d858f6739b5ef7fad
2023-06-16 23:12:33 +00:00
Christopher Parsons
df9c3441aa Merge "Provide reason for unconverted bp2build modules" 2023-06-16 13:49:49 +00:00
Chris Parsons
39a169721c Provide reason for unconverted bp2build modules
This also changes the expectation of ConvertWithBp2build. Each
implementation must either create one or more Bazel target modules, or
mark the module as unconvertible (with a specific reason).

Manually verified no runtime hit in AOSP
In AOSP, the metrics file size increases from 252K to 1.6M

This changes some effective module counts in bp2build metrics:
 - Removes "package" modules from the module count list in
metrics, as these will not be converted like regular modules.
 - Counts Handcrafted modules as being "unconverted", as bp2build is not
   responsible for them.

Bug: 285631638
Test: Verified generated BUILD.bazel files are bit-for-bit identical
with this change
Test: Manually verified one case of each implemented reasonType

Change-Id: I308dd451d8f28379b15671dae9f931bd0446f5c1
2023-06-16 13:45:17 +00:00
Treehugger Robot
0e7d0fa05c Merge "Dynamically link static libs for sdk_library created java_library" 2023-06-15 23:39:39 +00:00
Jihoon Kang
6c0df88809 Cleanup remaining android.JavaApiLibraryName() references
Since the name of the java_library generated from sdk_library per api
scope does not depend on the build configuration anymore, all
dependency switching "magic" via android.JavaApiLibraryName() can be
removed.

This change also removes from-text-build-specific test cases, as those
test cases depend on build configurations.

Test: m nothing && m nothing --build-from-text-stub
Bug: 287340610
Change-Id: I3bac35259e0cbaa16432a46cb2b128951c9bc075
2023-06-15 19:42:34 +00:00
Jihoon Kang
1147b31eb0 Dynamically link static libs for sdk_library created java_library
Rename java_library created inside sdk_library with the ".from-source"
suffix, and set it as static lib of the top level java_library, which
gets java_api_library instead as static lib during from-text stub build.

Test: m nothing && m nothing --build-from-text-stub
Bug: 286446015
Change-Id: I32e8ea264987e9f9df05e462292bd54e45074912
2023-06-15 18:18:09 +00:00
Chris Parsons
715c417ba3 Remove print statement
I suspect this was accidentally committed. We shouldn't just printf such
a statement every build analysis.

Test: Presubmits
Change-Id: If5ee66ce1b366f28254cd1bfdcaed9e085a60094
2023-06-14 16:24:37 +00:00