Commit graph

25 commits

Author SHA1 Message Date
Elliott Hughes
97ad120adb Switch from minigzip to gzip.
Bug: http://b/288169261
Test: treehugger
Change-Id: I404cbcb850734ed8291c2215a4329fb372806d63
2023-06-27 15:39:05 -07:00
Wei Li
499333616c Generate SBOM of the target product in file sbom.spdx.json in product out directory.
Original aosp/2374663 was reverted, so this change cnotains the implementation but disabled by default and SBOM will not be built by default with "m dist".

The feature will be enabled later in small CLs after running tests successfully in forrest.

Test: m sbom
Test: m dist
Test: on aosp, lunch aosp_bluejay-userdebug && m dist
Bug: 266726655
Change-Id: I926d0f97f3a0330ef61d059f12ea660005d370e6
2023-03-14 15:14:06 -07:00
Treehugger Robot
30c7aead84 Merge "Fix signapk jar not found for prebuilt splits" am: f6f6c2f8cf
Original change: https://android-review.googlesource.com/c/platform/build/+/2165007

Change-Id: I1ddf2a3db02c2a04440d6bd94b5aef4aea1f75fe
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-29 23:06:22 +00:00
Sandeep Vijayasekar
9a6d03d55e Fix signapk jar not found for prebuilt splits
Bug: 132211754
Bug: 232129462
Test: prebuild module with LOCAL_PACKAGE_SPLITS defined
Change-Id: If82f06debf092fd5bdf37558d8eea62eb3b72582
(cherry picked from commit 1e3a2c3254)
2022-07-25 14:51:24 -07:00
Rupert Shuttleworth
13f6bb4879 Fix phony target warning for LOCAL_ROTATION_MIN_SDK_VERSION.
Test: m signapk
Test: make GoogleRestorePrebuilt apksigner
Test: Add LOCAL_ROTATION_MIN_SDK_VERSION := 33 to vendor/unbundled_google/packages/GoogleRestorePrebuilt/Android.mk and run both commands above again -- no phony target warnings

Bug: 197787352

Change-Id: If106113b6557ad1ecf24e2778bd38e7cb30e39ca
2022-01-20 23:17:15 -05:00
Rupert Shuttleworth
a95ab436f6 Add ability to set --rotation-min-sdk-version for signapk.
Bug: 197787352

Test: m signapk

Change-Id: I3b5e9bb3985c2ae83381499a44b339a7b1deb05c
2021-10-27 12:53:16 +00:00
Jaewoong Jung
b34f64fc7a Do not alter presigned prebuilt apks for SDK > 29.
Bug: 185811447
Test: Manual
Change-Id: I5ea143331e1bd1885dde4e46b086f4ce811f4981
2021-05-13 16:16:19 -07:00
Jaewoong Jung
d3561eaef0 Add a missing dependency to the prebuilt app rule.
Fixes: 185197439
Test: Manual test with the CLs cherry-picked.
Change-Id: I595d02497c6504d06239bf2e3562a5448b88b346
2021-04-13 15:03:05 -07:00
Ulya Trafimovich
6ef5779c98 Don't expect all Java modules to have a manifest.
Some libraries that go through manifest_check do not have a manifest or
APK, so there is nothing to check LOCAL_USES_LIBRARIES and
LOCAL_OPTIONAL_USES_LIBRARIES against. Handle it as if the manifest had
zero <uses-library> tags: don't fail the build unless the module has
non-empty LOCAL_USES_LIBRARIES or LOCAL_OPTIONAL_USES_LIBRARIES.

Bug: 132357300
Test: lunch cf_x86_64_phone-userdebug && m
Change-Id: I4b1317cfbd93cb6129caba51b56081307a564442
2021-04-13 12:42:44 +01:00
Ulya Trafimovich
2bf587713b Consolidate manifest_check for different module types.
Move manifest_check (a.k.a. verify_uses_libraries check) from makefiles
for specific module types to common makefile dex_preopt_odex_install.mk,
which is included by all Java modules that may require dexpreopt. If a
modules locally disables dexpreopt, it still goes through manifest_check
(unless dexpreopt is globally disabled or the module has no Java code).

This CL allows to have manifest_check and dexpreopt in the same makefile
(which is needed for a follow-up CL that will reuse dexpreopt variables
for manifest_check).

Bug: 132357300
Test: lunch cf_x86_64_phone-userdebug && m
Change-Id: Ia217cfc247ae43d8fc716bfc1fe9dcce1d00aa7f
2021-03-19 11:00:51 +00:00
Ulya Trafimovich
78d96e8742 Add missing dependency on aapt.
The missing dependency on AAPT did not cause build failures in AOSP,
because the build order happens to be such that AAPT is always built by
the time it's needed. But this is accidental and needs to be fixed.

Bug: 183010666
Bug: 132357300
Test: treehugger
Change-Id: I170e878bf36aafbdb93e9ba54faffd455d3e33c2
Merged-In: I8c78e48345bee5b77de41af03bdac77c402d04a1
2021-03-18 12:36:15 +00:00
Ulya Trafimovich
a2404510af Reimplement verify_uses_libraries.sh in manifest_check.py.
Previously there were two different scripts that did similar things:
1) build/soong/scripts/manifest_check.py
2) build/make/core/verify_uses_libraries.sh

Both scripts extracted <uses-library> tags and `targetSdkVersion` from
the manifests of Java modules, but 1) worked for XML manifests, and 2)
worked for APKs. This CL reimplements the functionality from 2) in 1),
so that one script can handle both XML manifests and APKs.

Bug: 132357300

Test: lunch cf_x86_64_phone-userdebug && m && launch_cvd \
      adb wait-for-device && adb root && adb logcat \
      | grep -E 'ClassLoaderContext [a-z ]+ mismatch'
      # empty grep output, no errors

Change-Id: I386aa1a37699182cdf6f3f94ef8aa7b96a4017d3
2021-03-15 13:50:57 +00:00
Ulya Trafimovich
6f06f9ea7a Disable verify_uses_libraries check if dexpreopt is globally disabled.
Without dexpreopt the check is not necessary, and although it is good to
have, it is difficult to maintain on non-linux build platforms where
dexpreopt is generally disabled (the check may fail due to various
unrelated reasons, such as a failure to get manifest from an APK).

Bug: 181570790
Bug: 132357300

Test: Emulate the failed no-dexpreopt build in b/181570790:
  - modify verify_uses_libraries to make a subcommand fail
  - check that the build with dexpreopt fails:
    $ lunch cf_x86_64_phone-userdebug && m
  - set `WITH_DEXPREOPT := false` in make/core/board_config.mk
  - check that the build without dexpreopt succeeds (allow boot image
    and system servert dexproept to avoid unrelated build failures, this
    does not affect verify_uses_libraries):
    $ WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY=true \
      lunch cf_x86_64_phone-userdebug && m

Change-Id: Ic456be4e3047a60415a21fae658077165fb03165
2021-03-04 12:35:02 +00:00
Treehugger Robot
c66465a4b0 Merge "Add non-fatal mode for verify_uses_libraries check." 2021-02-23 20:45:42 +00:00
Ulya Trafimovich
5a09c2084d Add non-fatal mode for verify_uses_libraries check.
The new mode is enabled with environment variable
RELAX_USES_LIBRARY_CHECK. If the variable is set to true, then a
verify_uses_libraries check failure does not fail the build, instead it
sets a special compiler filter "extract" for dexpreopt, which means that
the DEX file will be extracted, but it won't be compiled to native code.
Class loader context will be set to empty in this case (not &, as it is
going to be deprecated soon).

If the variable RELAX_USES_LIBRARY_CHECK is unset or set to something
other than "true", then the old behaviour of the verify_uses_libraries
check is preserved.

The intended use case for this flag is to have a smoother migration path
for the Java modules that need to add <uses-library> information in
the build files. The flag allows to quickly silence build errors. This
flag should be used with caution and only as a temporary measure, as it
masks real errors and affects performance.

verify_uses_libraries check is reworked so that it writes the error
message to a status file (which is used instead of the former timestamp
file). Currently the stored error message is not used, but it may be
used later to produce a warning. Dexpreopt command checks if the status
file exists and is nonempty; if that is the case, then compiler filter
is set to "extract".

Bug: 132357300

Test: Manually add some mismatch between the libraries in the Android.bp
      and Android.mk files for dexpreopted apps, build with
      RELAX_USES_LIBRARY_CHECK=true and obsserve that the build doesn't
      fail and they are compiled with compiler-filter "extract".
      Unset RELAX_USES_LIBRARY_CHECK and observe that the build fails.

Change-Id: Ie1a6298c4dba2f368ca9ac8b9fee2de0a26e68e8
2021-02-22 14:49:47 +00:00
Jaewoong Jung
c18ebafcb9 Remove unwanted JNI libs outside inflating action.
Take the unwanted JNI lib removal action out of JNI uncompression
function so that they work independently when building prebuilt apks.

Fixes: 180475879
Test: Manually with a test apk.
Change-Id: I7392d0bf4ca7db76f27e883df08f7cb256162440
2021-02-18 16:09:10 -08:00
Dan Willemsen
a3f6632de9 Remove obsolete PDK build functionality
This hasn't worked for a couple years, and continues to bitrot. Just
remove it.

Test: treehugger
Change-Id: Iea6caf3c08252a560155e095135c5ddaad712991
Merged-In: Iea6caf3c08252a560155e095135c5ddaad712991
2020-08-11 01:12:01 +00:00
Jiyong Park
9314d8c77c Incorrect file names in apkcerts.txt for Make modules
This change fixes a regression that was caused by I56bc55e2231eb946617a9d6f97d55c9b61f3bff7
that file names for Make modules are ".apk" in apkcerts.txt.

This was because PACKAGES.$(LOCAL_MODULE).STEM was only set for the
modules from Soong. It is now set for Make modules too.

Bug: 155440232
Test: OVERRIDE_TARGET_FLATTEN_APEX=true m apkcerts-list
and check the generated apkcerts txt file to see that it doesn't have an
entry where file name is ".apk"

Exempt-From-Owner-Approval: cherry-pick from internal

Merged-In: I6f14bbb5678255bef2c1f2397f59ede6c2b5df18
(cherry picked from commit db64e3d528)
Change-Id: I6f14bbb5678255bef2c1f2397f59ede6c2b5df18
2020-05-03 13:43:08 +09:00
Jaewoong Jung
95445e6913 Add signing certificate lineage file support.
Also add multi-cert support to prebuilt apps so that they can benefit
from the new lineage feature.

(This is a cherry-pick change.)

Test: m GoogleServicesFramework w/ modified build rules
Test: m PrebuiltGmsCore w/ modified build rules
Test: apksigner lineage -v --print-certs -in <built_module_path>
Fixes: 152897457
Change-Id: If7d5d4bd308629c8340231520214c76c8a568a65
Merged-In: If7d5d4bd308629c8340231520214c76c8a568a65
2020-04-06 13:42:23 -07:00
Bill Peckham
19c3feb2d3 Build merged apexkeys.txt/apkcerts.txt by partition.
Propagate partition tag data to apexkeys.txt and
apkcerts.txt so that merge_target_files.py can build
merged versions of these files by filtering the
framework files for framework partitions and filtering
the vendor files for vendor partitions.

Bug: 138942268
Change-Id: Ic3226728e97dae84d38ec230ccc86d1b124bea94
2020-03-30 22:33:27 +00:00
Nicolas Geoffray
2ca0e49f61 Remove support for stripping dex.
Stripping is incompatible with ART module updatability.

Bug: 65154345
Bug: 138851227

Test: build and observe no change in output (stripping is not used by
default).

Change-Id: Ic2d9738ef393814c3af3cad116071f7b5938aa84
2019-10-21 09:36:45 +01:00
Justin Yun
6151e3f1ea Rename product_services to system_ext
Bug: 134359158
Test: build and check if system_ext.img is created
Change-Id: I67f2e95dd29eac6a28e07e24ea973d3a134c3bfc
2019-07-09 08:57:19 +00:00
Colin Cross
56199af6c2 Move verify_uses_libraries.sh out of dexpreopt
dexpreopt usually gets a dex jar instead of the final APK, which
means targetSdkVersion can't be parsed out of it.  Move the
shared library verification to a tool that operates on the final
AndroidManifest.xml instead.  verify_uses_libraries.sh is still
used to verify prebuilts where we don't have an AndroidManifest.xml
and must parse it out of the APK.

Test: m Gallery2
Bug: 132357300
Change-Id: I6ade74b6144c73aee094f5d5ff343067ca0a0e5a
2019-05-26 17:42:17 +00:00
Colin Cross
a0d89b994f Always use aapt2 for prebuilt appcompat
Running appcompat is missing a dependency on aapt/aapt2.  There
is no need to switch between aapt and aapt2, so always use aapt2
and add the missing dependency.

Fixes: 130575935
Test: treehugger
Change-Id: If32c03410fbdb3945bf20f7405de13dc8cd83038
2019-04-16 22:40:25 +00:00
Jaewoong Jung
09bfe55bd6 Split out app_prebuilt_internal.mk.
This is part of prebuilt_internal.mk refactoring work and also a
preliminary task to design and implement its Soong counterpart.

Test: built and flashed an image for a Pixel device + TreeHugger
Change-Id: I89b13b1e0a2780b02fda7ee888e73052ac1abd9c
2019-03-19 13:35:23 -07:00