Commit graph

3089 commits

Author SHA1 Message Date
Jingwen Chen
fb708e99f7 Delete apexBundle#prebuiltFileToDelete.
Nothing is reading this field. Delete it.

Test: presubmits
Change-Id: I47d15b7c4e2aca4b251059305c27c2a9b5f05b1f
2023-01-30 12:07:19 +00:00
Colin Cross
ec41b5c2e2 Merge "Disable VNDK apexes for unsupported API levels" 2023-01-27 19:49:48 +00:00
Colin Cross
bb137a3956 Disable VNDK apexes for unsupported API levels
Disable VNDK apexes when their version is below the minimum
supported API level for the primary architecture.

Test: TestVndkApexCurrent
Change-Id: Ie72a5beb9da432660d3fec5c520402224326f961
2023-01-27 19:49:38 +00:00
Colin Cross
a13de4dea4 Merge "Don't install system image copies of libraries in unbundled apex builds" 2023-01-27 19:27:54 +00:00
Diwas Sharma
fe4587161b Merge "Revert "Don't add flattened files apex as dependencies of an image apex"" 2023-01-27 17:55:13 +00:00
Treehugger Robot
6e7441edde Merge "Read ApexMkInfo for modules to be installed." 2023-01-27 15:45:08 +00:00
Dennis Shen
0c79be54b6 Merge "Support trimmed variant build in soong" 2023-01-27 13:11:50 +00:00
Jingwen Chen
29743c8423 Read ApexMkInfo for modules to be installed.
This piggybacks onto the ApexInfo cquery handler, so we're issuing a
single bazel query call that reads two providers in the starlark expr.

Also rename requiredDeps to makeModulesToInstall to differentiate it from
APEX's required/provided libs in the apex manifest.

Test: unit test
Test: mkdiff
Fixes: 263123189
Change-Id: Ib7e43f1586f29864eee8627dba3631bfaff27afa
2023-01-27 04:02:45 +00:00
Diwas Sharma
bb9202e688 Revert "Don't add flattened files apex as dependencies of an image apex"
This reverts commit eb8cd3122a.

Reason for revert: mainline module jacoco jar do not contain JAVA_LIBRARIES needed for coverage, see: b/266679012

Change-Id: If756f7aaf40c6bcfed170c59c494bcc426620039
2023-01-27 00:40:21 +00:00
Colin Cross
df2043e96a Don't install system image copies of libraries in unbundled apex builds
Apex builds are setting LOCAL_REQUIRED_MODULES to include external
dependencies into the system image.  This make sense for device builds,
but just causes extra unnecessary builds for unbundled apex builds
that are not building device images.  Skip the dependency during
unbundled builds.

Test: aosp-master-art mainline_modules_x86_64-userdebug builds
Change-Id: I363995b7309cc3c90b0a584d051050f105b5b915
2023-01-26 15:40:58 -08:00
Cole Faust
8733a89cf8 Merge "Refactor python rules" 2023-01-26 19:03:25 +00:00
Dennis Shen
e2ed70c61a Support trimmed variant build in soong
variable.go:
add a new product variable TrimmedApex which is controlled by
environment variable PRODUCT_TRIMMED_APEX

config.go:
all config to check if trimmed build is turned on or not

apex.go:
add overridable apex module property:
use_DCLA: <DCLA apex module>

"use_DCLA" allows user to just use the lib list in DCLA to determine
which native shared libraries to trim. This property is no-op if
TrimApexEnabled is set to false.

builder.go
1, if it is to produce a trimmed variant, fix the default version code
by making the last variant digit to 2. this is only useful in local
build. in production build, there is apex manifest injection by
coastguard that determines the actual version code.

2, create a new apex rule called: "TrimmedApexRule", this rule invokes
an apexer wrapper called apexer_with_trim_preprocessing which will
properly trim the target libs.

BUG: b/259381334
TEST: adbd banchan build for both static and trimmed variant
Change-Id: I38a91cdef86a3c9185d00610ab3dd7acd07fd90a
2023-01-26 15:57:21 +00:00
Vinh Tran
ba46e76622 Merge "Delete __ANDROID_APEX_MIN_SDK_VERSION__ from Soong" 2023-01-25 19:09:27 +00:00
Cole Faust
4d247e6f21 Refactor python rules
The goal of this cl is to simplify the python rules,
mostly by removing the "decorator" pattern that they
currently use, and instead making separate module
types for libraries, binaries, and tests that inherit
from each other.

Bug: 259718110
Test: Verified ninja files are unchanged (they only change in the list of soong sources because I added/deleted files)
Change-Id: I1e836e2cc4782c7818f91db7df7895de3b8db7ca
2023-01-25 10:40:59 -08:00
Vinh Tran
f9754735f2 Delete __ANDROID_APEX_MIN_SDK_VERSION__ from Soong
Currently, Bazel sets __ANDROID_APEX_MIN_SDK_VERSION__ based on the cc library's min_sdk_version while Soong does based on apex's min_sdk_version. This causes a diff in the clang commands.

Digging further, we realized __ANDROID_APEX_MIN_SDK_VERSION__ isn't used anywhere so we might just delete it altogether instead of fixing it.

Bug: 265134933
Test: presubmit
Change-Id: I08e89dc8f6ef86669248ea5c47de6603e9d2ffbb
2023-01-20 00:14:48 -05:00
Cole Faust
eb8cd3122a Don't add flattened files apex as dependencies of an image apex
The image apex does not need all the files that make up a flattened
apex.

Bug: 254205429
Test: go tests
Change-Id: I7c574c5b30b55ab6d1b3981ee26d168c2f2427c4
2023-01-19 18:36:11 -08:00
Sasha Smundak
d6322939f7 Sort canned fs_config lines to facilitate comparison with Bazel-built APEXes
Bug: 237037156
Test: mixed builds regression testing
Change-Id: Ifc9a7b4231c947fe85e77c56ffeb30a2d53df6c4
2023-01-11 22:01:01 -08:00
Liz Kammer
b83b7b024e bp2build apex min_sdk_version w/ soong config var
Previously min_sdk_version did not handle soong config vars

Test: m bp2build and verify com.android.adbd
Change-Id: I48426a8e6e03b61234b77ce7d7ec07b1cab36b7b
2023-01-11 22:01:01 -08:00
Jingwen Chen
94098e880e apex mixed builds: use the .capex when required.
The .capex is the compressed apex. Depending on various conditions, the
.capex should be installed, and thus the
apex.go#ProcessBazelQueryResponse should set the .capex as the main apex
output file.

Fixes: 264873511
Test: new unit test with install rules
Test: m com.android.adbd --bazel-mode-staging gives:

$ ls -lah
out/target/product/generic_arm64/system/apex/com.android.adbd.capex
-rw-r----- 1 jingwen primarygroup 3.6M Jan 10 14:44 out/target/product/generic_arm64/system/apex/com.android.adbd.capex

Change-Id: Ic3143cc6999f111428c6adb76760be8ddc4b6344
2023-01-10 14:50:42 +00:00
Treehugger Robot
4520481c6a Merge changes I07db8afc,Ia89e0239
* changes:
  Stop module types being SdkAware
  Replace usages of SdkAware in sdk module with Module
2023-01-07 14:46:22 +00:00
Cole Faust
a734749148 Use WriteFileRule instead of custom echo commands
These instances could use WriteFileRule instead of
making their own shell code to write a file.

Test: Presubmits
Change-Id: I9c809b2164a68b4ce1c22fbbd0d7497240110b39
2023-01-03 14:42:23 -08:00
Jooyung Han
1724d58a91 apex_vndk doen't need stub variants
This was revealed by the new check added in
Ib3c6efd16bdf13b59f79be66d4f9dba49100f6cc.

This was okay since the old implementation relied on the fact that impl
variant comes before stub variants.

To make the new check happy and keep the intention explicit, stub
variants are not added to VNDK apex.

Bug: 191770320
Test: m (apex_test)
Change-Id: I455f2c9b6bc471c579379286c0198f36d325adf6
2022-12-21 10:17:44 +09:00
Jooyung Han
862c0d68ff Check for duplicate bundled files from different modules.
A single file generated by different modules is almost never correct;
make it an error.

The check is skipped for some error cases, which will be handled in follow-ups.

Bug: 191770320
Test: m (soong test)
Change-Id: Ib3c6efd16bdf13b59f79be66d4f9dba49100f6cc
2022-12-21 10:15:37 +09:00
Jingwen Chen
889f2f2844 mixed builds: Make apex's GetBazelLabel return the label of the override_apex, if applicable.
And add test1_com.android.tzdata to prod allowlist.

Fixes: 261054570
Bug: 261054570
Test: mkcompare
Change-Id: I314a4e44ade958ba9a91f71430d76175d734579e
2022-12-20 07:35:20 +00:00
Vinh Tran
b6803a5f52 Add ApexInfo.RequiresLibs to mixed build handler for apex
Adding ApexInfo.RequiresLibs from Bazel to apexBundle.requiredDeps which is eventuallyread by apex androidmk writer for LOCAL_REQUIRED_MODULES to ensures the libs are installed as part of a bundle build.

In Soong, apexBundle.requiredDeps is set in
https://cs.android.com/android/platform/build/soong/+/master:apex/apex.go;l=2305-2323;drc=cb7e73bc0130a95f5991c925c349387185abc098

The same logic is replicated in Bazel at
https://cs.android.com/android/platform/build/bazel/+/master:rules/apex/cc.bzl;l=141-163;drc=cb7e73bc0130a95f5991c925c349387185abc098.

This CL is porting the required libs set by Bazel in mixed build.

Test: go test
Test: run build/bazel/ci/mixed_libc.sh
Bug: 215500321
Change-Id: Id7256d279ac09a8fd42db391a7e93ce0021d8345
2022-12-14 18:54:47 -05:00
Treehugger Robot
16d87f33a2 Merge "Streamline AndroidMk generation" 2022-12-13 19:39:20 +00:00
Sasha Smundak
dcb6129269 Streamline AndroidMk generation
Add AndroidMkEmitAssignList to emit a line to assign the items from
the given list of string arrays.

Test: treehugger
Change-Id: Id5acbef38ea4e91349bd2461f226db352d4b8123
2022-12-12 18:06:49 -08:00
Paul Duffin
76fdd67f9f Allow building against prerelease prebuilt APEXes
Generally, when building system images from prebuilt APEXes the APEXes
should be released versions and the build ensures that is the case when
extracting .apex files from prebuilt .apks files. However, it is useful
to test building against prebuilt APEXes before finalization to flush
out any issues early on. Previously, the build would fail in that case.
This change adds support for using the SOONG_ALLOW_PRERELEASE_APEXES
environment variable to allow prerelease APEXes to be suppported.

Bug: 259958590
Test: m MODULE_BUILD_FROM_SOURCE=false droid
      # Above fails because it could not find non-prelease APEXes in the
      # prebuilt .apks files.
      m SOONG_ALLOW_PRERELEASE_APEXES=true MODULE_BUILD_FROM_SOURCE=false droid
      # Above works.
Change-Id: I20b8e5db0b9fd2a21434be25652195fae929bd3f
2022-12-12 18:00:47 +00:00
Paul Duffin
4f2282c2d8 Make apex_set support ":<apex>" syntax to access the apex file
The apex and prebuilt_apex module types make the output APEX available
using ":<apex>" syntax, e.g. for use as a data file in a test. This
change adds compatible behavior to apex_set to ensure consistent
behavior when building against prebuilts.

Bug: 259958590
Test: m MODULE_BUILD_FROM_SOURCE=false nothing
Change-Id: Ic6f105976cfdd6af4920cc1e11ab0b4ff72e6a6f
2022-12-12 17:44:33 +00:00
Paul Duffin
e17c31611a Fix deapexer usage in prebuilt_apex/apex_set
A previous change to the deapexer script to check that blkid_path and
fsckerofs_path were set broke the scripts/unpack-prebuilt-apex.sh
scripts use of deapexer. This change fixes it by passing the paths
through to the script which then passes it on to deapexer.

Bug: 255963179
Bug: 240288941
Bug: 259958590
Test: m MODULE_BUILD_FROM_SOURCE=false droid
Change-Id: Ief7f36219b7fe1cf7104c08163e10d8e39f181d0
2022-12-12 17:40:26 +00:00
Paul Duffin
d796f6f6dc Stop module types being SdkAware
Removes all usages of SdkBase and InitSdkAwareModule.

Bug: 260237150
Test: m nothing
Change-Id: I07db8afc805eadbeb5b23f2e1d2f51567eecfab0
2022-12-12 17:33:06 +00:00
Treehugger Robot
93ca271c21 Merge "Vendor apex sets "vndkVersion" when it uses vndk libs" am: da62908229
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2330035

Change-Id: Ie7557b723485adc600f52e5bbd585a6ce0d4721d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-08 03:24:16 +00:00
Jooyung Han
d045ebca4c Vendor apex sets "vndkVersion" when it uses vndk libs
Vendor apex with "use_vndk_as_stable:true" sets the dependency in
"requireNativeLibs: ":vndk"". But this isn't enough because the APEX
won't work if VNDK version mismatches.

Now, when a vendor apex uses VNDK libs, "vndkVersion" is set as well in
apex_manifest so that apexd can abort the installation/staging when
device's VNDK version mimatches.

Bug: 222620439
Test: VendorApexHostTestCases
Test: built vendor apex how has "vndkVersion" field in its
 apex_manifest
Change-Id: If03340c230efe854ab932cdf472c276f7646ad0c
2022-12-08 09:42:03 +09:00
Treehugger Robot
612a0e28e5 Merge "Add option to override defaultManifestVersion" am: 720e0ce5e2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2323675

Change-Id: I254fb1d934928aa069139eaf4377e84630d34bfa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-06 12:43:00 +00:00
Sahana Rao
16ebdfdf0f Add option to override defaultManifestVersion
Add an option to override defaultManifestVersion using environment
variable. The environment variable will be used to override the apex
version locally when developing a desert release feature in
mainline-prod branch. Overriding the apex version in mainline-prod
branch allows us to install apex built in mainline-prod branch to device
running code from git_master which has a higher apex version than
mainline-prod branch.

Bug: b/233608815
Bug: b/196860838
Test: presubmit
Test: go test -v ./build/soong/apex/
Change-Id: I8ac2aae2b6b29da7f09db6edb893e0a0f0691e51
2022-12-06 07:15:44 +00:00
Treehugger Robot
1ed3a7a0f7 Merge changes Ia4016240,Iba586155 am: a36589c4ca
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2309617

Change-Id: I14b21791d36601bc832c382391b003a1e9b4cd71
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-02 11:18:24 +00:00
Treehugger Robot
a36589c4ca Merge changes Ia4016240,Iba586155
* changes:
  Allow choosing which soong_build invocations to run in the debugger
  Show module type in a module section of the Android-TARGET.mk
2022-12-02 10:36:07 +00:00
Jingwen Chen
9867290c71 Merge "Convert apex_available (for supported modules) to bazel tags." am: 8ec23f846d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2321580

Change-Id: I813778da920431fe7a46384782ffbfc19e435444
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-02 07:41:55 +00:00
Sasha Smundak
5c4729df93 Show module type in a module section of the Android-TARGET.mk
The first line of each section will be
```
include $(CLEAR_VARS)  # <module type>
...
```

Bug: 257037252
Test: treehugger
Change-Id: Iba586155b682fe4e1e5817d8397eda8f9d9c8789
2022-12-01 21:12:11 -08:00
Jingwen Chen
c4c34e1eab Convert apex_available (for supported modules) to bazel tags.
The tags will then be read by an aspect applied from apex attributes to
validate that the deps are explicitly opt-in to the appropriate apex.

The semantics of this is the same as the Soong apex_available property.

This also adds the "base_apex_name" attr to override_apex conversion so
that apex_available checks continue to work on the non-Google and non-Go
apex names.

Test: presubmits
Fixes: 218841706
Change-Id: I19b3637da9aa47573b252d74f62b601fbdc3784d
2022-12-01 06:25:25 +00:00
Anton Hansson
912316068b Ignore native bridge archs for apex selection am: 805e0a53ef
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2318630

Change-Id: I0d655c0efb51396423aae1836d32d104ac25393f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-29 17:12:52 +00:00
Anton Hansson
805e0a53ef Ignore native bridge archs for apex selection
This leads to an arm64 apex being used on a device that is mixed
x86_64 with nativebridge=arm64. A device like that doesn't appear
to work with arm64 binaries. For example, the boringssl-self-check
binary crashes on boot.

Bug: 260115309
Test: unit test
Test: boot emulator with this combination
Change-Id: Ic4a91974290a05b1799f755fcf52ef226d68f4c2
2022-11-29 12:56:37 +00:00
Treehugger Robot
6ba2a5b746 Merge "Allow stubs implementation to be omitted" am: 378124baf1
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2301917

Change-Id: I6fb94bba4db679feb806ff8712d21eb7191b8b1c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-24 11:46:32 +00:00
Alan Stokes
73feba3330 Allow stubs implementation to be omitted
When defining a stubs library, allow specifying that the
implementation library does not need to be installed. This allows for
cases where the implementation is deployed in some non-standard way -
e.g. inside a Microdroid virtual machine.

Without this, we get build errors like: "TARGET module
com.android.compos requires non-existent TARGET module: libvm_payload".

Default behavior is unchanged. The change is protected by an allowlist
to limit usage to the immediate use case.

Bug: 243512108
Test: builds; soong tests pass
Test: Remove allowlist, see build failure
Change-Id: Iaae75f2e93b842f5944a7518cc95069d62c5a638
2022-11-22 16:00:02 +00:00
Treehugger Robot
7db19f9485 Merge "Make htmlGzNotice an internal variable instead of apexBundle field." am: 3d99948e29
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2305471

Change-Id: I58654133c2d27b6d50dbd3716388e68c92233b17
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-16 23:51:23 +00:00
Treehugger Robot
3d99948e29 Merge "Make htmlGzNotice an internal variable instead of apexBundle field." 2022-11-16 23:19:44 +00:00
Ulya Trofimovich
545835d5e9 Merge "Do not assume that boot image profile exists when building ART apex." am: a672771df9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2304851

Change-Id: Icec9811bdfee0183f46992a59a0f0899f5bbe9ec
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-16 19:54:15 +00:00
Ulya Trofimovich
a672771df9 Merge "Do not assume that boot image profile exists when building ART apex." 2022-11-16 19:36:31 +00:00
Jingwen Chen
4a9630b4ad Make htmlGzNotice an internal variable instead of apexBundle field.
It's not read outside of the function / action generation logic, so keep
it inside the function.

Test: presubmits
Fixes: 190817312
Change-Id: I0626e6c86adc584abb2a251cbc7ffb1bec2c7f59
2022-11-16 19:12:35 +00:00
Ulya Trafimovich
f5c548db17 Do not assume that boot image profile exists when building ART apex.
If the apex is built without boot images, profile may not exist.

Test: treehugger
Change-Id: I0824100d0ac38f4b7b71b302b401a0c66c3ff3cf
2022-11-16 14:59:05 +00:00