Commit graph

2695 commits

Author SHA1 Message Date
Jingwen Chen
6cb124b8d9 Append APEX version instead of build ID for APK-in-APEX paths.
This CL removes the build_id.mk suffix and replaces it with a hardcoded
placeholder string that will be replaced with the actual version in
apex_manifest.json by apexer at apex construction time.

This means that as long as the apex version is incremented, the
APK-in-APEX will be installed to a new directory path from the package
manager's perspective.

Fixes: 229574810
Bug: 229625490
Bug: 226559955
Bug: 224589412
Bug: 227417611
Bug: 228157333
Bug: 228803590
Bug: 229136249

Test: atest StrictJavaPackagesTest
Test: soong tests
Test: deapexer list out/dist/com.google.android.permission.apex
Change-Id: I9cef1418c3fc7e0970d96995b8398f5e82f479e0
2022-04-21 10:20:51 +00:00
Jingwen Chen
3a5be76dc0 Merge "Suffix the build ID to the dirname of APK-in-APEX files." 2022-04-21 09:24:22 +00:00
Jingwen Chen
8ce1efc5af Suffix the build ID to the dirname of APK-in-APEX files.
This fixes an issue with package manager's cache invalidation.

Test: CI

Bug: 226559955
Bug: 224589412
Change-Id: I8af49d51ff99cf8184d0e4d1136fff1cdb29c23e
Merged-In: I8af49d51ff99cf8184d0e4d1136fff1cdb29c23e
2022-04-19 13:57:01 +00:00
Colin Cross
02730b93b2 Only install to $OUT/apex for installable apexes
When coverage is enabled there are two variants of the apex, one
installable and one not installable.  Don't try to install files
files to $OUT/apex for the non-installable variant.

Bug: 217453046
Test: m NATIVE_COVERAGE_PATHS="*" NATIVE_COVERAGE_EXCLUDE_PATHS="art bionic/libc device" CLANG_COVERAGE=true USE_HOST_MUSL=true com.android.runtime
Change-Id: I23e58c811ff943b9d5dec025fa619c8db835b29c
2022-04-19 00:45:07 +00:00
Jiyong Park
9c58a3628b Merge "Remove apex10000_private variants" 2022-04-12 19:37:57 +00:00
Jiyong Park
d4a0063d3e Remove apex10000_private variants
When a library is included in two APEXes whose platform_apis settings
are different, two apex variants of the library is created: apex1000 and
apex1000_private.

This change was introduced with ag/15061306, especially by the commit
[1].

However, that part should be reverted because it actually creates
unnecessary variants. It's unnecessary because the two variants of the
library are compiled (excluding the linking) exactly the same. If a
private symbol of its dependency was actually used when compiling the
apex1000_private variant, then the other apex1000 variant wouldn't have
been built because that private symbol must have caused a linkage error.

[1] https://googleplex-android-review.git.corp.google.com/c/platform/build/soong/+/15061306/2..4/android/apex.go#b527).

Bug: 228785792
Test: m
Change-Id: Id58d3e98a51de5e628ca72ef86e9cd11b0ee8971
2022-04-12 12:23:20 +09:00
Colin Cross
abc0dab477 Move proguard test files to java package
The proguard test files are duplicated in apex and sysprop and will
be needed by app tests, move them to the java package.

Test: run all soong tests
Change-Id: Ie13817dcda8d98801d16a97ffceef1100c7d5380
2022-04-11 11:44:32 -07:00
Albert Martin
eefabcf321 Flag to globally override apexes' min_sdk_version
Override all mainline updateable apexes' min_sdk_version
to same version to get single shared native libs on DCLA.

Test: Run "vendor/google/build/go/mainline_go_modules_arm.sh" and inspect built apexes
Bug: 212609891
Change-Id: Ide7d3f2bc772ac6240f1c917b87285d051d6f605
Merged-In: Ide7d3f2bc772ac6240f1c917b87285d051d6f605
2022-04-08 17:51:07 +00:00
Wei Li
340ee8e699 Export provenance metadata for prebuilt APKs and APEXes.
Bug: 217434690
Test: atest --host gen_provenance_metadata_test
Test: m provenance_metadata

Change-Id: I91c184b6e6fe5ccfc3fc65b55b09e7a3da9502a0
2022-04-05 16:16:16 -07:00
Treehugger Robot
5f58c378b6 Merge "Keep dependency files out of the apk file." 2022-04-05 05:53:22 +00:00
Bob Badour
2c8888edef Keep dependency files out of the apk file.
Bug: 227682036

Test: TARGET_BUILD_VARIANT=userdebug UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true vendor/google/build/mainline_modules_bundles.sh -j97

Change-Id: I1a9775af7c652191bb1ce3b97c1cb9365b469c19
2022-04-04 19:21:18 -07:00
Spandan Das
f14e254a28 Change permitted_packages check to be per-jar rather than per-apex
(cherry-pick of ag/17524387 into aosp)

Summary:
- updates the Q and R maps, the new keys are the bcp jars and not the
apexes. neverallow build rules ensure that these bcp jars have a
restricted set of permitted_packages
- remove BootclasspathJar from the neverallow rule. This is no longer
necessary since the keys in the maps are the bootjars themselves, and
not apexes

Bug: 205289292
Test: In build/soong, go test ./apex
Change-Id: Icb91de934181a8b6f085e03a0ce8c5e08504ff94
Merged-In: Icb91de934181a8b6f085e03a0ce8c5e08504ff94
(cherry picked from commit 440ff96728)
2022-04-04 17:42:00 +00:00
Anton Hansson
e1b1836939 Revert "Relax apex package restriction for T+ jars"
This reverts commit 1fdd6ca88a.

Reason for revert: b/205289292 tracks the real fix for this

Test: presubmit
Change-Id: I5a2edaf4f930dafa26659f85d9425e9041c72275
Merged-In: I5a2edaf4f930dafa26659f85d9425e9041c72275
2022-04-04 17:27:43 +00:00
Bob Badour
de6a087d2d Revert "Revert "Build notice files from license metadata.""
This reverts commit 77807b3c27.

Reason for revert: fix and roll forward again

Change-Id: I80c796ca81ecf29df9522babe54d684a0d11b9e6
2022-04-01 18:00:00 +00:00
Wei Sheng Shih
77807b3c27 Revert "Build notice files from license metadata."
This reverts commit 43c2dcaef6.

Reason for revert: suspect build break

Bug: 227682036

Test: TARGET_BUILD_VARIANT=userdebug UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true vendor/google/build/mainline_modules_bundles.sh -j97


Change-Id: Ibfb8b4fefc264f52f32ba661c269a9cd625d800a
2022-04-01 14:10:53 +00:00
Bob Badour
2a5c090c31 Fix breakage: bad path join using '/' literal
Typo in filename s/b NOTICE.html.gz not NOTICES.html.gz

Bug: 227682036

Test: TARGET_BUILD_VARIANT=userdebug UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true vendor/google/build/mainline_modules_bundles.sh -j97

Change-Id: I75cc28e3ef22d975ad46f4e167071f6d82ba253d
2022-03-31 23:40:28 -07:00
Bob Badour
43c2dcaef6 Build notice files from license metadata.
Switch from generate-notice-files.py and mergenotice.py to htmlnotice.

Bug: 151177513
Bug: 213388645
Bug: 210912771

Test: m droid dist reportmissinglicenses
Change-Id: I6cac049d24f35ec358c6f341a04f4ba6161703bf
2022-03-31 17:29:01 +00:00
Spandan Das
2cf278e75b Do not propagate strict_updatability linting to conscrypt
and framework-media java_sdk_libraries

Tmp fix for
https://android-build.googleplex.com/builds/quarterdeck?branch=aosp-master&target=errorprone&lkgb=8352129&lkbb=8353967&fkbb=8352538

Test: m
out/soong/.intermediates/external/conscrypt/conscrypt.module.public.api.stubs.system/android_common/lint/lint-baseline.xml
Test: (internal CI target) https://android-build.googleplex.com/builds/abtd/run/L67700000953708519
Bug: 182349282
Bug: 226637002
Bug: 226608044

Change-Id: I17e540877200f59bfd51e69e57d8bcca6cf3850f
2022-03-25 02:31:20 +00:00
Spandan Das
ad40fffa64 Merge changes I4c373b29,I9ccda6fc,I1b390b0e,I30151217
* changes:
  Do not propagate strict updatability linting to libcore/
  Create allowlist to skip strict updatability lint check
  Propagate strict_updatability_linting to transitive deps of updatable apexes
  Export LintDepSetsIntf from java package
2022-03-24 16:38:20 +00:00
Colin Cross
3c66771c62 Merge "Use single module for clang runtime libraries" 2022-03-08 06:51:43 +00:00
Colin Cross
d9ccb6a2cb Skip install rules for apexes with installable: false
When an apex sets installable: false call SkipInstall to prevent
creating the install rules, and don't report the install rules
to Make.

Fixes: 221261079
Test: m checkbuild
Change-Id: If94759b16f79ee10ddcf8ee89603ca9e822b74f5
2022-03-08 02:40:32 +00:00
Colin Cross
4c4c1be915 Use single module for clang runtime libraries
The clang prebuilts now provide a single module with per-architecture
variants instead of a module per architecture.

Bug: 220019988
Test: m checkbuild
Change-Id: I39e2cf8ae14edf8510276dab38011afaef85822c
Merged-In: I39e2cf8ae14edf8510276dab38011afaef85822c
2022-03-07 14:56:32 -08:00
Remi NGUYEN VAN
979b652dec Merge "Support overriding APEX java contents" 2022-03-03 01:26:19 +00:00
Remi NGUYEN VAN
be90172f0a Support overriding APEX java contents
In addition to the current "apps", support overriding
bootclasspath_fragments, systemserverclasspath_fragments, and java_libs.

This is useful to build APEXes with slightly different contents, for
example where the base APEX could contain libraries that only use stable
APIs, but the overriding APEX could contain a variant that also uses
non-finalized APIs.

Bug: 222247869
Test: m (runs apex tests)
Change-Id: I14da6f835c58b44be31e517598695ec8ff830648
2022-03-02 21:23:15 +09:00
Jiakai Zhang
0407606ce1 Merge "Install required deps for flattened APEX." 2022-02-28 15:29:31 +00:00
Jiakai Zhang
d70dff7c9b Install required deps for flattened APEX.
The primary boot image is a required dep of the ART APEX. It needs to be
installed no matter the APEX is flattened or not.

Bug: 220991677
Test: 1. m OVERRIDE_TARGET_FLATTEN_APEX=true com.android.art
  2. See boot.art in /system/framework/<isa>
Change-Id: I1a69ae1b86df97fc44ea6c75c8bb9ec960c8d249
2022-02-28 11:18:29 +00:00
Treehugger Robot
7ff6e3d257 Merge "apex: track transitive dependencies of rust jni lib" 2022-02-24 23:50:14 +00:00
Jiyong Park
34d5c33529 apex: track transitive dependencies of rust jni lib
dependencies of rust library registered as jni_lib are correctly
tracked.

Bug: 220397949
Test: m nothing
Change-Id: I43016a77656d04f59f798b02d541c6a19288ec9c
2022-02-24 18:02:44 +09:00
Jooyung Han
a6d3667b67 apex supports ".apex" tag
Tests can embed non-compressed .apex output with the tag.

Bug: 221024307
Test: soong test
Change-Id: Id4a239d1897237105a064cea8c97029f5b996a98
2022-02-24 13:59:45 +09:00
Spandan Das
d9c23abeca Do not propagate strict updatability linting to libcore/
propogation of this flag is determined by the location of the Android.bp
where a library is defined.
libcore/ libraries that are transtive deps of updatable apexes will
- inherit strict_updatability_linting:true if defined in libcore root
- not inherit strict_updatability_linting:true if defined in libcore
  subdir

Note that the module can explicitly list `lint:{strict_updatability_linting: true}'
in their Android.bp file, in which case they will not be allowed to
baseline NewApi errors

Test: m lint-check
Test: TH
Bug: 208656169
Bug: 182349282

Change-Id: I4c373b2960a7af16301d7f06aab448f39b937ea9
2022-02-23 21:49:56 +00:00
Gurpreet Singh
7761de5d4e Merge "Manifest Fixer Params code refactor" 2022-02-10 18:22:30 +00:00
Gurpreet Singh
7deabfacd0 Manifest Fixer Params code refactor
This CL refactors the code related to ManifestFixer parameters.
The required parameters android.ModuleContext, manifest android.Path are
passed separately as the parameters and the optional parameters are
kept as part of the ManifestFixerParams struct.

By default, the member variable of struct have the zero (nil, false,
empty string) values. Hence, it is only required to pass the
parameters of interest at the time of function call to
ManifestFixer.

Manual testing done to check the working of the code.

Test: m nothing && m test_com.android.sdkext
Test: manually tested the generation of AndroidManifest in the out
directory with the testOnly attribute
Test: atest manifest_fixer_test --host
To test the existing unittests are not breaking.

Change-Id: I20cb6c06c57f8fe7811050288bcb03945dc0425b
2022-02-10 13:37:50 +00:00
Spandan Das
08c911f4eb Create allowlist to skip strict updatability lint check
As of Jan 2022, some updatable mainline modules have (transitive) deps with
NewApi in their respective lint-baseline.xml. Create an allowlist to
relax this check temporarily for those mainline modules.

Test: m lint-check
Test: TH
Bug: 182349282

Change-Id: I9ccda6fccb973e9100e31b7e559f5642289ac717
2022-02-10 02:25:21 +00:00
Gurpreet Singh
a76f874d55 Geneate AndroidManifest file if the apex_test module does not have one.
If the build file contains the apex_test module, but the apex_test
module does not contain the AndroindManifest file, then create the
AndroidManifest file.

In such case, the apexer tool is already generating an AndroidManifest
file. In order to handle the testOnly attribute for apex_test modules, a
--test_only flag is appended to the opt flags.

The apexer tool reads the opt flags and if the --test_only flag is
present then it generate the AndroidManifest file with testOnly
attribute.

Bug: 213310150
Test: m nothing && m test_com.android.sdkext
Test: manually checked the generation of AndroidManifest file in the
unsigned zip file mentioned in the description.
This command allows to read the attribute of the binary xml file -
aapt2 dump xmltree test_com.android.sdkext.apex.unsigned --file
AndroidManifest.xml

Verified the presence of testOnly flag in the output.

Change-Id: Ic47378428b2dba51d73e75d912546c2374f68d57
2022-02-09 16:06:15 +00:00
Spandan Das
6677325124 Propagate strict_updatability_linting to transitive deps of updatable apexes
Create a topdown mutator to walk the deps of updatable apexes. If a dep
is lintable, set its strictUpdatabilityLinting to true

Creating a new mutator after apexInfoMutator makes it easy to maintain
an allowlist (e.g. override_apex does not require an entry in the
allowlist, its canonical name can be retrieved using ApexVariationName())

Test: In build/soong/, go test ./apex
Test: TH
Bug: 182349282

Change-Id: I1b390b0e3a8fb20754ce50c6b253d68d2b3f263b
2022-02-08 19:25:37 +00:00
Jooyung Han
472be14f26 Merge changes I11693286,I8d79a434
* changes:
  VNDK libs use "unique" APEX variants
  use_vndk_as_stable APEX shouldn't include VNDK lib
2022-02-08 01:03:41 +00:00
Treehugger Robot
210957500c Merge "Allow installing boot images outside of APEX for prebuilt." 2022-02-07 15:58:36 +00:00
Jooyung Han
91f9203af4 VNDK libs use "unique" APEX variants
In case there are two vendor apexes(one with "use_vndk_as_stable:true",
and the other with "use_vndk_as_stable:false") a VNDK lib used by both
will have "APEX" variant and the former APEX will use "apex" variation.

For example,

 apex1(use_vndk_as_stable) -> foo -> libvndk
 apex2 -> bar -> libvndk

Since foo, bar and libvndk are mutated into two APEX variations("",
"apex10000"), foo will use the apex variation of libvndk.

To fix this, VNDK libs can use "unique" APEX variations. Then, in the
above example, foo will have "myapex1" variation and libvndk will have
two APEX variations("" and "apex2"). So foo will link to ""(non-APEX)
variation as fallback.

Bug: 216847402
Test: m nothing (soong tests)
Change-Id: I116932860ef79e22dc338a58b251e3ca693ab4f3
2022-02-04 13:07:14 +09:00
Jooyung Han
c5a967630e use_vndk_as_stable APEX shouldn't include VNDK lib
Even though a vendor APEX sets use_vndk_as_stable:true it was possible
to include a VNDK lib by directly depending on it with
native_shared_libs.

But it's contradictory to have a VNDK lib while declaring not to include
VNDK libs. It was missing since pruning dependencies on VNDK libs was
done only for transitive deps.

Added a check to reject this.

Bug: 216847402
Test: m nothing(running soong tests)
Change-Id: I8d79a434b1bfe8e563cf8968fa76830b0e582f66
2022-02-04 13:07:11 +09:00
Gurpreet Singh
75d65f360c Add testOnly attribute to AndroidManifest file of apex_test
If the build file contains the apex_test module, add the
testOnly attribute to the application element of the
corresponding AndroidManifest file and set its value to true.
If the testOnly attribute is already present and has value
false, then do nothing.

Tests added in manifest_fixer_test.py to check if the updated
AndroidManifest file has the testOnly attribute set to true or not.

Bug: 213310150
Test: atest --host manifest_fixer_test
Test: m nothing
Test: manually checked the AndroidManifest file generated
Change-Id: I36247dbe0261c342d451a4422c314fd8fe0c2369
2022-02-01 12:03:48 +00:00
Jiakai Zhang
e6e90db00a Allow installing boot images outside of APEX for prebuilt.
This change is similar to aosp/1947127, but for prebuilts.

After this change, if `bootImageConfig.installDirOnDevice` is set to a
path outside of the APEX, the build system will build a boot image from
the dex files and the profile extracted from the prebuilt APEX.
Otherwise, it keeps the current behavior: extracting the boot image from
the prebuilt APEX.

This is a no-op change. Current behavior is not affected.

Bug: 211973309
Test: m nothing
Test: -
  On internal master:
  1. Patch aosp/1947128.
  2. Patch ag/16743847 and ag/16746804.
  3. m SOONG_CONFIG_art_module_source_build=false com.google.android.art
  4. See the boot image being installed in `/system/framework/<arch>`.
Change-Id: I24ca525309fecaf3ab7a67960fbf118cd00ecd1d
2022-01-28 15:08:06 +00:00
Wei Li
f034cb4d7b Add bp2build support for property "compressible" of apex module.
Bug: 214466457
Bug: 207551677
Test: b build //build/bazel/examples/apex/minimal:build.bazel.examples.apex.minimal
Test: b test //build/bazel/tests/apex:build.bazel.examples.apex.minimal_apex
Test: b test //build/bazel/tests/apex:build.bazel.examples.apex.minimal_capex

Change-Id: I6bf12c1b0c52d4486968bb430a67a3c3110766db
2022-01-25 19:42:43 +00:00
Oriol Prieto Gasco
a07099d858 Make 'Compressible' an overridable property
This is needed to allow the Android Go versions of modules
(com.google.android.go.*) to select a different compression toggle than
their non-Go (com.google.android.*) conterparts. go/go-updatability

Bug: 203024418
Test: Preloaded go variants on wembley, booted Android.
Change-Id: Ic96aff5fafb65fbd08e8a69d47c994532e27819e
Merged-In: Ic96aff5fafb65fbd08e8a69d47c994532e27819e
(cherry picked from commit 2c4a96375a)
2022-01-22 00:45:58 +00:00
Treehugger Robot
c85964a734 Merge "Improve apex build check explanation" 2022-01-20 21:06:39 +00:00
Andrei Onea
d967aee96f Improve apex build check explanation
Discourage jarjaring code where there are alternatives with
better system health implications.

Test: m
Bug: 215233995
Change-Id: I1b076d00e1ad6aa32b41da6bda1033978b5e829d
2022-01-19 16:07:21 +00:00
Jingwen Chen
539d41b686 Merge "Support multilib in apex." 2022-01-19 11:11:05 +00:00
Treehugger Robot
a9a5d36884 Merge "[NETD-BPF#34] Add a tag for bpf to specify the install folder" 2022-01-19 09:41:57 +00:00
Ken Chen
fad7f9d8b7 [NETD-BPF#34] Add a tag for bpf to specify the install folder
Currently, the bpf module netd.o (source system/netd/bpf_progs/netd.c)
will be built to /system/etc/bpf/netd.o. In Android T, it will be moved
to mainline module com.android.tethering.

The expected behavior is:
- In T device, it uses the netd.o in mainline module.
- In pre-T devices, it uses the original netd, built from platform.

However, netd.o will be double loaded if the tethering module is
installed in Pre-T devices. Because:
1. bpf in apex is packed into /apex/MAINLINE_MODULE/etc/bpf/
2. bpf in platform is packed into /system/etc/bpf/
3. bpfloader in pre-T loads ANY bpf modules under
/apex/com.android.tethering/etc/bpf/ and /system/etc/bpf/.

We can't change the behavior of bpfloader in pre-T devices. We can't
delete the /system/etc/bpf/netd.o from pre-T devices. Both of them are
not mainline modules. So the mainlined netd.o needs to be packed into a
folder other than /apex/com.android.tethering/etc/bpf/ or
/system/etc/bpf/.

This commit adds a tag 'sub_dir' for bpf module. The installation path
of bpf modules will be:
- /system/etc/bpf/SUB_DIR/     (for platform code)
- /apex/MAINLINE_MODULE/etc/bpf/SUB_DIR/     (for mainline module)

Bug: 202086915
Test: add test in apex_test.go and build
Change-Id: Icc6619768ab006de9f86620a7df1bb2853eaba13
2022-01-19 04:02:29 +00:00
Yu Liu
4ae55d17f6 Support multilib in apex.
Bug: b/208325023
Test: Added unit tests, also tested with adbd apex build manually.
Change-Id: I47e04cd4eb5d05227f0a84683dcb66dff00e3514
2022-01-18 10:38:05 -08:00
Jiakai Zhang
6decef916c Allow installing boot images outside of APEX.
After this change, `bootImageConfig.installDirOnDevice` can be set to a
path outside of the APEX, in which case, the boot image will not be
installed in the APEX. Instead, it will be installed to the given path
by Make.

This is a no-op change. Current behavior is not affected.

Bug: 211973309
Test: m nothing
Test: -
  1. m com.android.art
  2. See the boot image still being installed in the ART APEX.
Test: -
  1. Change `installDirOnDevice` of the ART boot image config to
     `system/framework`.
  2. See the boot image being installed in `/system/framework/<arch>`.
Change-Id: Ib13b17cc9e94dc5754c9b51b04df3307323b8783
2022-01-13 14:50:05 +00:00