Commit graph

70 commits

Author SHA1 Message Date
Rico Wind
20c2010030 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

Ignore-AOSP-First: Merge does not apply cleanly

Change-Id: Ib8a6fb128084e994325b975c46a036cb41494654
2023-11-28 13:47:02 +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
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
Luca Stefani
813de60e00 Ensure extracted JNIs are stored properly in APKs
If the android_app has the use_embedded_native_libs flag
all its JNIs must be stored with the store compression method.

The logic to add JNIs from ARR is as follows:
1) Extract JNI libs from AAR
2) Store JNI libs with deflate
3) Merge deflated JNI libs with APK

This process produces a bogus APK that won't be loaded by the
framework if the use_embedded_native_libs is set as the resulting
APK will have all its merged entries stored as deflate.

To solve the problem in case we merge JNIs with an app requiring
uncompressed JNI we add an extra step to ensure they're compressed
using the store method.

Test: m, verify apk using jni_extract has stored libs
Change-Id: Ic31d47f15412171b5898dd0e2a554cb6bf93293b
2023-07-31 21:16:18 +02:00
Colin Cross
b3168bac7f Avoid extra copy of JNI libs zip
Don't call merge_zips if there are no prebuilt JNI libraries to
merge with.

Test: builds
Change-Id: Ife5386fbbfcff35bdea2914519a78dfd89163a25
2023-07-27 08:09:37 -07:00
Rico Wind
351bac996c Add soong support for resource shrinking
This adds a new flag to the optimize section to allow invoking the resource shrinker

Bug: 246217952
Test: m
Change-Id: I2e7851af1189db2a6adf6f9f9f444a1d7f3a8d60
2022-09-23 19:11:11 +02:00
Sam Delmerico
9276c1a4bb Merge "copy JNI from AAR files to android_app APK" am: fb845984df
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2149174

Change-Id: I8697a193bf054623dcdf67f6beded56a75c52875
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-03 13:31:01 +00:00
Sam Delmerico
82602492fc copy JNI from AAR files to android_app APK
JNI libs present in AAR files are ignored in the build. If those
libraries are necessary, they must be manually extracted and a
prebuilt_cc_library module must be created for them. Instead, we can
extract these libraries and copy them to an output APK as part of the build.

Bug: 228848794
Test: created android_app that depends on an android_library_import with
  JNI embedded, and verified that .so libs are present in APK
Test: created android_app that depends on an android_library which
  depends on android_library_import with JNI embedded, and verified
  that .so libs are present in APK
Test: verified that multiple .so's from a single architecture are copied
  to APK
Test: verified that the absence of a jni/<arch> folder or files in the
  folder will cause the Ninja action to error
Change-Id: I242a862d7bd881f7a4a8c23493924d8fe441ea25
2022-08-02 16:12:06 -04:00
Matt Banda
8c80126987 Surface Java APIs Used By APK-only Modules.
Previously we were only generating used-by API-coverage for APEX modules.
This change adds support for APK-only modules such as NetworkStack and DocumentsUI.

Bug: b/216313756
Forrest Run: https://android-build.googleplex.com/builds/abtd/run/L10800000953846781

Test: TARGET_BUILD_VARIANT=userdebug PRODUCT=mainline_modules_x86 ./vendor/google/build/build_unbundled_coverage_mainline_module.sh -j16

Change-Id: Id17e4a55c2a52e9903632a654e778f8d54982dfc
Merged-In: Id17e4a55c2a52e9903632a654e778f8d54982dfc
(cherry picked from commit 56d75785bd)
2022-04-05 21:28:29 +00:00
Rupert Shuttleworth
8eab869bfe Add ability to set --rotation-min-sdk-version for signapk via Android.bp files.
(vs via Android.mk files, done earlier in http://ag/16094391)

Bug: 197787352

Test: Added unit tests.

Change-Id: I3ccd2f2134b069fb4c4a90fe384c23c1814c2ba2
2021-11-03 10:46:15 -04:00
Colin Cross
77cdcfdeaf Move android package on top of remotexec
Remove the references to the android package in remotexec so that
the android package can reference the remoteexec package.  This
will allow RuleBuilder to integrate directly with remoteexec.

Bug: 182612695
Test: m checkbuild
Change-Id: I15be5ef126d8aacbd605518638f341daf6f31bb3
2021-03-18 16:17:34 -07:00
Ulf Adams
7e7ef56077 Soong: remove output file before running signapk
It looks like there is a bug in rewrapper/reproxy that makes it upload the
output file as an input if it still exists in the output tree. This causes
unnecessary cache misses on incremental builds, and can also cause the
action to fail remotely (depending on the service). By removing the output
file at the beginning of the action, we ensure that it can't be uploaded.

Test: ran against a remote execution server; actions no longer fail remotely
Change-Id: Iaac2b23b35d2c876c0244edbfd4a8f159df0563c
2020-11-25 23:07:23 +01:00
Kousik Kumar
f15ed4fe61 Merge "Check UseRBE is set before replacing any template with the RE version." am: 3e0b9c031c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1419252

Change-Id: I52b7a3810fdf3314ae107f4b8330e9d6f62c6302
2020-09-10 09:50:35 +00:00
Ramy Medhat
16f23a4038 Check UseRBE is set before replacing any template with the RE version.
Test: presubmit
Change-Id: I6df58b4e700f0d231367af2710672d731d20a736
2020-09-03 01:29:49 -04:00
Kousik Kumar
2b6185810a Merge "Add support for remote-execution / caching of jar/zip actions" am: c4cdba07d3 am: d996ff6a68
Change-Id: I41f544531788cfdf7a16560e24f27c9d31b186ad
2020-05-29 13:56:58 +00:00
Kousik Kumar
0f5e5c724e Merge "Add support for remote-execution / caching of signapk actions" am: 8f37ec82d9 am: f52d6420ea
Change-Id: I3c51e0ff23903ba101d2029a632f99fc8342c2d9
2020-05-28 19:06:40 +00:00
Kousik Kumar
366afc5011 Add support for remote-execution / caching of jar/zip actions
Test: Ran a build with `RBE_JAR="true" RBE_JAR_EXEC_STRATEGY="remote"
RBE_ZIP="true" RBE_ZIP_EXEC_STRATEGY="remote" ... use_rbe m` and that
succeeded.

Bug: b/156765207
Change-Id: Ia17b532fbb282be414adf879914870082dd0841b
2020-05-28 11:56:48 -07:00
Kousik Kumar
309b1c0da3 Add support for remote-execution / caching of signapk actions
Test: "RBE_SIGNAPK=true RBE_SIGNAPK_EXEC_STRATEGY=remote ... use_rbe m" on crosshatch-userdebug and
signapk targets worked
Bug: b/156765091

Change-Id: I4b8c21320c2f38914ef39d3d8f036d885fab4e72
2020-05-28 06:14:56 -07:00
Liz Kammer
a7126555c9 Add lineage file to deps for signapk.
(This is a cherry pick.)

Test: app_test.go
Bug: 153366049
Merged-In: I1481eb51d5d02674922459bdfac65c59d1130015
Change-Id: I1481eb51d5d02674922459bdfac65c59d1130015
2020-05-14 16:29:36 -07:00
Liz Kammer
e2b27f473f Add signing certificate lineage support to soong
(This is a cherry pick.)

Test: app_test
Bug: 153366049
Merged-In: I65a92d6c40057dcc01950991fb7be485de1c9080
Change-Id: I65a92d6c40057dcc01950991fb7be485de1c9080
2020-05-13 14:30:53 -07:00
Liz Kammer
9cd4f811d7 Add lineage file to deps for signapk.
Test: app_test.go
Bug: 153366049
Change-Id: I1481eb51d5d02674922459bdfac65c59d1130015
2020-05-08 17:19:26 -07:00
Liz Kammer
70dd74dde7 Add signing certificate lineage support to soong
Test: app_test
Bug: 153366049

Change-Id: I65a92d6c40057dcc01950991fb7be485de1c9080
2020-05-08 09:50:42 -07:00
Songchun Fan
4b25e319e6 Revert "[soong] new field in Android.bp to request APK signing V4"
This reverts commit 17d69e3484.

Reason for revert: This new field is not useful without dependencies in aosp

Test: builds
Change-Id: I87bd820cd6dbc5274ce3d28c4578381718aa805d
Merged-In: I70d6f7dc751510311b03e245b2189a76b395a49c
2020-05-01 11:29:36 -07:00
Songchun Fan
17d69e3484 [soong] new field in Android.bp to request APK signing V4
If "v4_signature: true" is set, the v4 signature file,
named [outputApkFile].idsig
will be generated along side the outputApkFile.

Test: m nothing
Test: atest PackageManagerShellCommandIncrementalTest
BUG: 149354175
Change-Id: Ie84725a15406f96f65042ea9909460e4eb34d57f
Merged-In: Ie84725a15406f96f65042ea9909460e4eb34d57f
2020-04-04 12:37:45 -07:00
Songchun Fan
688de9af5d [soong] new field in Android.bp to request APK signing V4
If "v4_signature: true" is set, the v4 signature file,
named [outputApkFile].idsig
will be generated along side the outputApkFile.

Test: m nothing
Test: atest PackageManagerShellCommandIncrementalTest
BUG: 149354175
Change-Id: Ie84725a15406f96f65042ea9909460e4eb34d57f
2020-03-25 17:12:20 -07:00
Peter Collingbourne
ad84f975d2 Reland "Also package recursive jni_libs deps of android_apps as well as direct deps." with bug fix.
This time, exclude NDK libraries instead of LLNDK libraries from the
package. This is necessary because there are libraries such as libvndksupport
which are LLNDK but are not accessible to apps.

Original commit message:
> Previously, android_app targets for which a.shouldEmbedJnis(ctx) = true
> (e.g. CtsSelinuxTargetSdk25TestCases) would need to specify all of their
> recursive library dependencies, including for example libc++ when depending
> on the platform libc++. This means unnecessary churn when we add a new
> dependency to libc++ (e.g. libunwind [1]). To avoid the churn and allow
> jni_libs clauses to be simplified, make the build system search for the
> recursive dependencies and automatically include them.
>
> This change allows us to remove code that was previously adding NDK libc++
> as a special case, as it is now covered by the generic code.
>
> Also fix some improper quoting that was exposed as a result of this change
> causing more files to be packaged than before.
>
> [1] https://android-review.googlesource.com/q/topic:%22libunwind-so%22

Bug: 144430859
Test: atest CtsAppOpsTestCases
Test: atest FrameworksNetSmokeTests
Change-Id: I8311ede0b44d7e50b9f272912ead8ef07e82b074
2019-12-17 16:55:20 -08:00
Lorenzo Colitti
2973c1106f Revert "Also package recursive jni_libs deps of android_apps as well as direct deps."
This reverts commit 6f907ad3dd.

Reason for revert: Broke FrameworksNetSmokeTests

Bug: 146456945
Change-Id: Ibef7bb80c532e70cfcfb974f51a99ed25437a343
2019-12-18 00:15:07 +00:00
Peter Collingbourne
6f907ad3dd Also package recursive jni_libs deps of android_apps as well as direct deps.
Previously, android_app targets for which a.shouldEmbedJnis(ctx) = true
(e.g. CtsSelinuxTargetSdk25TestCases) would need to specify all of their
recursive library dependencies, including for example libc++ when depending
on the platform libc++. This means unnecessary churn when we add a new
dependency to libc++ (e.g. libunwind [1]). To avoid the churn and allow
jni_libs clauses to be simplified, make the build system search for the
recursive dependencies and automatically include them.

This change allows us to remove code that was previously adding NDK libc++
as a special case, as it is now covered by the generic code.

Also fix some improper quoting that was exposed as a result of this change
causing more files to be packaged than before.

[1] https://android-review.googlesource.com/q/topic:%22libunwind-so%22

Bug: 144430859
Change-Id: I3d6fbcce75bc108a982eb7483992a4b202056339
2019-12-16 15:20:09 -08:00
Colin Cross
bdf9514e45 Use prebuilts for more tools in unbundled builds
Move the logic from Make that uses prebuilts for more tools for
unbundled builds, and export the values back to make.

Test: m checkbuild
Change-Id: I8c7031e0feaa9328a2b73db6dc8e63e12d1d12f7
2019-08-08 12:56:34 -07:00
Sasha Smundak
26c6d9e9fb Tune JVM, print full diagnostics on crash.
JVM occasionally (0.5% time) crashes on entering a method with SIGSEGV.
It might be due to excessive load on the host machine. Reduce the number
of the compiler threads to 6, and do not start all the GC threads
immediately. If JVM crashes, copy full diagnostics to stderr.

Bug: 132766811
Test: treehugger
Change-Id: Ib7bfd568f6d32456bf623cbb615ffc990c326a34
2019-06-11 13:30:13 -07:00
Treehugger Robot
7c9689f7b7 Merge "Revert "Revert "Revert "Print full diagnostics file when Java process crashes."""" 2019-06-05 09:53:22 +00:00
Jimmy Chen
e88eaa7db7 Revert "Revert "Revert "Print full diagnostics file when Java process crashes."""
This reverts commit b4be092855.

Reason for revert: break build

Change-Id: I11fc5eb5f635a5d99eba962f5817851629e50ab2
2019-06-05 06:47:11 +00:00
Treehugger Robot
22d3d6ba5c Merge "Revert "Revert "Print full diagnostics file when Java process crashes.""" 2019-06-04 17:16:10 +00:00
Alexander Smundak
b4be092855 Revert "Revert "Print full diagnostics file when Java process crashes.""
This reverts commit d71dc6b5e0.

Reason for revert: ag/974065 fixes the problem that caused the revert

Change-Id: I3ba9eecdab34602aaf19fa518520ac932c9b97af
2019-06-03 16:53:22 +00:00
Treehugger Robot
d5dd534465 Merge "Revert "Print full diagnostics file when Java process crashes."" 2019-05-31 09:37:36 +00:00
Alexander Smundak
d71dc6b5e0 Revert "Print full diagnostics file when Java process crashes."
This reverts commit 9d6df2246c.

Reason for revert: This change set the value of JAVA make variable to a string containing "foo bar". When soong_ui is asked to evaluate such string, it drops the quotes, causing bash to treat 'foo' and 'bar' as separate command line arguments.

Change-Id: If4e3c4c950c305bb67a572de3d86119c2da81dc1
2019-05-31 03:15:55 +00:00
Treehugger Robot
7a1fefc2de Merge "Port uses-shared library verification and dexpreopting to Soong" 2019-05-30 21:50:31 +00:00
Colin Cross
50ddcc4b69 Port uses-shared library verification and dexpreopting to Soong
Ports 09f3b97f4b488cd3a7b7d72038b173575b02c162 (Add support for
preopt with uses-libraries) from Make to Soong to support verifying
and preopting shared libraries.

This reapplies Id25f55f07a55120bebe2a9b32c094209efc85c8b with fixes
for unbundled builds and builds with ALLOW_MISSING_DEPENDENCIES=true
set.

Bug: 132357300
Test: app_test.go
Test: m checkbuild
Change-Id: I964309a68ec4ed081f3f3154879c71048ecb5455
2019-05-29 19:11:26 -07:00
Sasha Smundak
9d6df2246c Print full diagnostics file when Java process crashes.
Bug: 132766811
Test: treehugger
Change-Id: I8cca2486f2194a8643007a53e4a695d2a18abbf8
2019-05-29 17:46:22 -07:00
Colin Cross
c032498336 Revert "Port uses-shared library verification and dexpreopting to Soong"
This reverts commit b66d7b1c20.

Reason for revert: broke unbundled builds

Change-Id: I96ae287885107079de4a26e6b100ad8ed66961c0
2019-05-29 20:28:47 +00:00
Colin Cross
b66d7b1c20 Port uses-shared library verification and dexpreopting to Soong
Ports 09f3b97f4b488cd3a7b7d72038b173575b02c162 (Add support for
preopt with uses-libraries) from Make to Soong to support verifying
and preopting shared libraries.

Bug: 132357300
Test: app_test.go
Test: m checkbuild
Change-Id: Id25f55f07a55120bebe2a9b32c094209efc85c8b
2019-05-28 11:20:09 -07:00
Jaewoong Jung
ccbb393651 Add android_app_import.
This is an initial version that handles the most basic cases.

Bug: 128610294
Test: app_test.go + prebuilt webview.apk
Change-Id: Ic525559aad5612987e50aa75b326b77b23acb716
2019-05-01 10:06:47 -07:00
Dan Willemsen
c4bd8f8282 Include proper deps for signapk
Bug: 130111713
Test: run signapk remotely, action succeeds after this change
Change-Id: I1670a27341591e0762cdfb42bcf424f065837192
2019-04-09 21:26:14 -07:00
Colin Cross
e560c4aabc Support package_splits
Pass the package_splits list from the property to aapt2 as
--split arguments, sign the extra outputs, install them, and
add them as extra output files for SourceFileProducer.

Bug: 127921149
Test: TestAppSplits
Change-Id: Id94a53ae6a8a68ec81e98abba2fefc9c23feaa7a
2019-03-19 23:33:47 +00:00
Colin Cross
0b9f31fb08 Replace *Escape with *EscapeList
Follow the change to blueprint to make *Escape take and return a string
and add *EscapeList that take and return slices of strings.  Fix up
a few places that were unnecessarily converting a string to a slice
and back to a string.

Test: m nothing
Change-Id: I3fa87de175522205f36544ef76aa2f04aef1b936
2019-03-04 18:11:53 +00:00
Colin Cross
e4246abd7f Make manifest and APK agree on uncompressed native libs
Only put uncompressed native libs in an APK if the min_sdk_version
supports it (>= 23, Marshmallow), and set
android:extractNativeLibs="false" in the AndroidManifest.xml so
that the platform won't extract them anyways.

Bug: 117618214
Test: m checkbuild
Change-Id: I760017e48bf3c6b618aabde0982df45995765d48
2019-02-08 15:24:47 +00:00
Colin Cross
f57c57825e Fix aar rules
aar files should build to the module out directory, not the root of
the out directory.  Also give the rules a description so they get a
better status line.

Test: m out/soong/.intermediates/frameworks/base/packages/SystemUI/SystemUI-core/android_common/SystemUI-core.aar
Change-Id: Ie8de0421427985c466d909f83c8e0146f7e0bea8
2019-01-25 13:29:12 -08:00
Jiyong Park
bfe64a1a59 Align entries in APEX at 4K boundary
Use -a option of signapk to specify the alignment to 4K. The default is
4.

Test: m apex.test; zipalign -c -v 4096 $(OUT)/system/apex/apex.test.apex
shows ok

Change-Id: I7b1a3d442b69b89838cf09451939cd23d5646bde
2018-11-22 03:09:40 +09:00
Colin Cross
fd94c40f6f Include java resources in app bundles
The java resources are merged into the dex jar, split them back
out into the root/ directory for merging into the bundle.
Also avoid running zip2zip when dexJarFile is nil by splitting
each munge step out into its own rule.

Bug: 117295826
Test: tapas RecoveryLocalizer && m dist
Change-Id: Ia22c8768bf2c3c6884792e923caf7624b4f76664
2018-11-02 15:51:48 -07:00
Colin Cross
f623721c08 Create bundle modules suitable for bundletool
Create a bundle module in addition to creating an APK, which can
then optionally be merged with bundle modules from builds for
other architectures and then be passed to bundletool to create an
app bundle.

Bug: 117295826
Test: tapas RecoveryLocalizer && m dist
Change-Id: I98a17d7407dc56823ece9ec88c087780185a6555
2018-10-31 14:39:16 +00:00